Add packet names to logging messages
diff --git a/src/main/java/com/intel/jndn/utils/SegmentedClient.java b/src/main/java/com/intel/jndn/utils/SegmentedClient.java
index aa9cb1a..671d6a2 100644
--- a/src/main/java/com/intel/jndn/utils/SegmentedClient.java
+++ b/src/main/java/com/intel/jndn/utils/SegmentedClient.java
@@ -124,11 +124,11 @@
try {
lastSegment = segments.get(0).get().getMetaInfo().getFinalBlockId().toSegment();
} catch (ExecutionException | InterruptedException e) {
- logger.log(Level.FINE, "Failed to retrieve first segment: ", e);
+ logger.log(Level.FINE, "Failed to retrieve first segment: " + interest.toUri(), e);
((FutureData) segments.get(0)).reject(e); // TODO implies knowledge of underlying data structure
return segments;
} catch (EncodingException e) {
- logger.log(Level.FINER, "No FinalBlockId, returning first packet.");
+ logger.log(Level.FINER, "No FinalBlockId, returning first packet: " + interest.toUri());
return segments;
}
@@ -179,8 +179,9 @@
try {
return getAsync(face, interest).get();
} catch (ExecutionException | InterruptedException e) {
- logger.log(Level.FINE, "Failed to retrieve data.", e);
- throw new IOException("Failed to retrieve data.", e);
+ String message = "Failed to retrieve data: " + interest.toUri();
+ logger.log(Level.FINE, message, e);
+ throw new IOException(message, e);
}
}
diff --git a/src/main/java/com/intel/jndn/utils/client/FutureData.java b/src/main/java/com/intel/jndn/utils/client/FutureData.java
index dc6b393..55c001e 100644
--- a/src/main/java/com/intel/jndn/utils/client/FutureData.java
+++ b/src/main/java/com/intel/jndn/utils/client/FutureData.java
@@ -132,18 +132,18 @@
face.processEvents();
}
} catch (EncodingException | IOException e) {
- throw new ExecutionException("Failed to retrieve packet.", e);
+ throw new ExecutionException("Failed to retrieve packet while processing events: " + name.toUri(), e);
}
}
// case: cancelled
if (cancelled) {
- throw new InterruptedException("Interrupted by user.");
+ throw new InterruptedException("Interrupted by user while retrieving packet: " + name.toUri());
}
// case: error
if (error != null) {
- throw new ExecutionException("Future rejected with error.", error);
+ throw new ExecutionException("Error while retrieving packet: " + name.toUri(), error);
}
return data;
@@ -171,7 +171,7 @@
face.processEvents();
}
} catch (EncodingException | IOException e) {
- throw new ExecutionException("Failed to retrieve packet.", e);
+ throw new ExecutionException("Failed to retrieve packet while processing events: " + name.toUri(), e);
}
currentTime = System.currentTimeMillis();
@@ -179,17 +179,17 @@
// case: cancelled
if (cancelled) {
- throw new InterruptedException("Interrupted by user.");
+ throw new InterruptedException("Interrupted by user while retrieving packet: " + name.toUri());
}
// case: error
if (error != null) {
- throw new ExecutionException("Future rejected with error.", error);
+ throw new ExecutionException("Error while retrieving packet: " + name.toUri(), error);
}
// case: timed out
if (currentTime > endTime) {
- throw new TimeoutException("Timed out.");
+ throw new TimeoutException("Timed out while retrieving packet: " + name.toUri());
}
return data;
diff --git a/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java b/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java
index dec33df..403e2da 100644
--- a/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java
+++ b/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java
@@ -122,7 +122,7 @@
try {
content.write(futureData.get().getContent().getImmutableArray());
} catch (ExecutionException | IOException | InterruptedException e) {
- throw new ExecutionException("Failed while aggregating retrieved packets.", e);
+ throw new ExecutionException("Failed while aggregating retrieved packets: " + name.toUri(), e);
}
}
@@ -154,12 +154,12 @@
try {
content.write(futureData.get().getContent().getImmutableArray());
} catch (ExecutionException | IOException | InterruptedException e) {
- throw new ExecutionException("Failed while aggregating retrieved packets.", e);
+ throw new ExecutionException("Failed while aggregating retrieved packets: " + name.toUri(), e);
}
// check for timeout
if (System.currentTimeMillis() > endTime) {
- throw new TimeoutException("Timed out.");
+ throw new TimeoutException("Timed out while retrieving packets: " + name.toUri());
}
}
diff --git a/src/main/java/com/intel/jndn/utils/repository/Repository.java b/src/main/java/com/intel/jndn/utils/repository/Repository.java
index 4647b9f..f64c145 100644
--- a/src/main/java/com/intel/jndn/utils/repository/Repository.java
+++ b/src/main/java/com/intel/jndn/utils/repository/Repository.java
@@ -13,7 +13,6 @@
*/
package com.intel.jndn.utils.repository;
-import com.intel.jndn.utils.repository.DataNotFoundException;
import net.named_data.jndn.Data;
import net.named_data.jndn.Interest;