Expect null in ReflexChildWriterCustomizer 76/1276/2
authorMaros Marsalek <mmarsale@cisco.com>
Thu, 26 May 2016 12:24:00 +0000 (14:24 +0200)
committerMarek Gradzki <mgradzki@cisco.com>
Mon, 30 May 2016 12:56:58 +0000 (12:56 +0000)
Change-Id: I41311f840bb5e5cdb8911353763fa3c9feb8735a
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/write/ReflexiveChildWriterCustomizer.java

index ba67e56..79cdf62 100644 (file)
@@ -46,8 +46,8 @@ public class ReflexiveChildWriterCustomizer<C extends DataObject> extends NoopWr
 
         try {
             return method.isPresent()
-                ? Optional.of((C) method.get().invoke(parentData))
-                : Optional.<C>absent();
+                ? Optional.fromNullable((C) method.get().invoke(parentData))
+                : Optional.absent();
         } catch (IllegalAccessException | InvocationTargetException e) {
             throw new IllegalArgumentException("Unable to get " + currentType + " from " + parentData, e);
         }