From 61ae76644a2d68823aaeabf4c0310c1717f52236 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Thu, 7 Sep 2017 12:22:28 +0200 Subject: Fix Sonar error-handling issues Change-Id: Iae8a7d27ed4ba778abe5bdbb937f55fa4d7a6638 Signed-off-by: Marek Gradzki --- .../src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java | 6 +++--- .../fd/honeycomb/test/tools/annotations/InjectablesProcessor.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'infra/test-utils/test-tools') diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java index 7c04eac84..6722d01af 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java @@ -78,7 +78,7 @@ interface YangDataProcessor { try { parentInstanceId = serializer.toBinding(parentYangId); } catch (DeserializationException e) { - throw new IllegalArgumentException(String.format("Unable to deserialize %s", parentYangId)); + throw new IllegalArgumentException(String.format("Unable to deserialize %s", parentYangId), e); } if (!parentInstanceId.isPresent()) { @@ -108,7 +108,7 @@ interface YangDataProcessor { throw new IllegalArgumentException(String.format("Unable to create node binding for %s|%s", identifier, data)); }); } catch (DeserializationException e) { - throw new IllegalArgumentException(String.format("Unable to deserialize node %s|%s", identifier, data)); + throw new IllegalArgumentException(String.format("Unable to deserialize node %s|%s", identifier, data), e); } } @@ -121,7 +121,7 @@ interface YangDataProcessor { throw new IllegalArgumentException(String.format("Unable convert %s to binding", identifier)); }); } catch (DeserializationException e) { - throw new IllegalArgumentException(String.format("Unable to deserialize %s", identifier)); + throw new IllegalArgumentException(String.format("Unable to deserialize %s", identifier), e); } } } diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/annotations/InjectablesProcessor.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/annotations/InjectablesProcessor.java index c09f26e08..0afb89007 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/annotations/InjectablesProcessor.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/annotations/InjectablesProcessor.java @@ -77,7 +77,7 @@ public interface InjectablesProcessor { try { FieldUtils.writeField(field, testInstance, data); } catch (IllegalAccessException e) { - throw new IllegalStateException("Unable to access field " + field); + throw new IllegalStateException("Unable to access field " + field, e); } } @@ -85,9 +85,9 @@ public interface InjectablesProcessor { try { return YangInstanceIdentifier.of(QName.class.cast(type.getField("QNAME").get(null))); } catch (IllegalAccessException e) { - throw new IllegalStateException("Constant QNAME not accessible for type" + type); + throw new IllegalStateException("Constant QNAME not accessible for type" + type, e); } catch (NoSuchFieldException e) { - throw new IllegalStateException("Class " + type + " does not have QName defined"); + throw new IllegalStateException("Class " + type + " does not have QName defined", e); } } -- cgit 1.2.3-korg