BUG-7446: Bump odlparent to 2.0.0
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / yangtools / binding / data / codec / impl / EncapsulatedValueCodec.java
index 03414a0e8e673be97bc2d1afba18e082d8cc365c..b036a384bc21457e9ab33a21ecb49f35e8a0fe75 100644 (file)
@@ -39,17 +39,14 @@ final class EncapsulatedValueCodec extends ReflectionBasedCodec implements Schem
     }
 
     static Callable<EncapsulatedValueCodec> loader(final Class<?> typeClz) {
-        return new Callable<EncapsulatedValueCodec>() {
-            @Override
-            public EncapsulatedValueCodec call() throws IllegalAccessException, NoSuchMethodException, SecurityException {
-                final Method m = typeClz.getMethod("getValue");
-                final MethodHandle getter = LOOKUP.unreflect(m).asType(OBJ_METHOD);
-                final Class<?> valueType = m.getReturnType();
+        return () -> {
+            final Method m = typeClz.getMethod("getValue");
+            final MethodHandle getter = LOOKUP.unreflect(m).asType(OBJ_METHOD);
+            final Class<?> valueType = m.getReturnType();
 
-                final MethodHandle constructor = LOOKUP.findConstructor(typeClz,
-                    MethodType.methodType(void.class, valueType)).asType(OBJ_METHOD);
-                return new EncapsulatedValueCodec(typeClz, constructor, getter, valueType);
-            }
+            final MethodHandle constructor = LOOKUP.findConstructor(typeClz,
+                MethodType.methodType(void.class, valueType)).asType(OBJ_METHOD);
+            return new EncapsulatedValueCodec(typeClz, constructor, getter, valueType);
         };
     }
 
@@ -68,7 +65,8 @@ final class EncapsulatedValueCodec extends ReflectionBasedCodec implements Schem
         try {
             return constructor.invokeExact(input);
         } catch (Throwable e) {
-            throw Throwables.propagate(e);
+            Throwables.throwIfUnchecked(e);
+            throw new RuntimeException(e);
         }
     }
 
@@ -77,7 +75,8 @@ final class EncapsulatedValueCodec extends ReflectionBasedCodec implements Schem
         try {
             return getter.invokeExact(input);
         } catch (Throwable e) {
-            throw Throwables.propagate(e);
+            Throwables.throwIfUnchecked(e);
+            throw new RuntimeException(e);
         }
     }
 }
\ No newline at end of file