[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-lib/release] Fix a regression in parsing descriptors.
commit 0917016f6b2ac6e383fa6862a3a530b4dcf777bc
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Fri Jun 16 14:43:20 2017 +0200
Fix a regression in parsing descriptors.
---
CHANGELOG.md | 7 ++++++-
.../org/torproject/descriptor/impl/DescriptorParserImpl.java | 12 +++++++++---
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 44420bf..409d0e8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,9 @@
-# Changes in version 1.9.0 - 2017-06-??
+# Changes in version 1.8.2 - 2017-06-16
+
+ * Medium changes
+ - Fix a regression where any DescriptorParseException thrown while
+ parsing a descriptor is encapsulated and rethrown as
+ RuntimeException.
# Changes in version 1.8.1 - 2017-06-08
diff --git a/src/main/java/org/torproject/descriptor/impl/DescriptorParserImpl.java b/src/main/java/org/torproject/descriptor/impl/DescriptorParserImpl.java
index 6317597..ad0d512 100644
--- a/src/main/java/org/torproject/descriptor/impl/DescriptorParserImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/DescriptorParserImpl.java
@@ -195,9 +195,15 @@ public class DescriptorParserImpl implements DescriptorParser {
try {
return constructor.newInstance(rawDescriptorBytes,
offsetAndLength, failUnrecognizedDescriptorLines);
- } catch (InstantiationException | IllegalAccessException
- | InvocationTargetException e) {
- throw new RuntimeException();
+ } catch (InvocationTargetException e) {
+ if (null != e.getCause()
+ && e.getCause() instanceof DescriptorParseException) {
+ throw (DescriptorParseException) e.getCause();
+ } else {
+ throw new RuntimeException(e);
+ }
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new RuntimeException(e);
}
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits