Improve error logging in yang-store-impl 69/4069/1
authortomas <tolvecky@cisco.com>
Wed, 8 Jan 2014 14:00:52 +0000 (15:00 +0100)
committertomas <tolvecky@cisco.com>
Wed, 8 Jan 2014 14:00:52 +0000 (15:00 +0100)
Resulting exception should contain getMessage information from each nested exception.

Change-Id: Idcb124a6e15f2be952d6b64028924929011e7156
Signed-off-by: tomas <tolvecky@cisco.com>
opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTracker.java

index 9356dd3752331f2f34fcc33b5df87151081a04b7..0d704a8f6aa49825da36d62b011d9294479fbb3d 100644 (file)
@@ -186,7 +186,15 @@ public class ExtenderYangTracker extends BundleTracker<Object> implements YangSt
                     yangStoreSnapshot.countModuleMXBeanEntries(), multimap.values().size());
             return yangStoreSnapshot;
         } catch (RuntimeException e) {
-            throw new YangStoreException("Unable to parse yang files from following URLs: " + multimap, e);
+            StringBuffer causeStr = new StringBuffer();
+            Throwable cause = e;
+            while (cause != null) {
+                causeStr.append(e.getMessage());
+                causeStr.append("\n");
+                cause = e.getCause();
+            }
+            throw new YangStoreException("Unable to parse yang files. \n" + causeStr.toString() +
+                    "URLs: " + multimap, e);
         }
     }