BUG-1425: fix LazyDataObject.toString()
authorRobert Varga <rovarga@cisco.com>
Tue, 12 Aug 2014 05:32:07 +0000 (07:32 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Thu, 21 Aug 2014 07:22:00 +0000 (07:22 +0000)
A major usability improvement is skipping of null fields, as dumping
them adds quite a bit of verbosity to logs.

Change-Id: I94c030f11505718ee48b0e3f4556587a85f8f4e4
Signed-off-by: Robert Varga <rovarga@cisco.com>
code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/impl/LazyDataObject.java

index c86585c7e09c6541069fed00158c306dc625f753..6a22641e1353c8e6c5b19dc4020d64731aa4956d 100644 (file)
@@ -75,7 +75,7 @@ class LazyDataObject implements InvocationHandler, AugmentationReader {
         } else if (EQUALS.equals(method.getName())) {
             return bindingEquals(args[0]);
         }
-        throw new UnsupportedOperationException("UNsupported method " + method);
+        throw new UnsupportedOperationException("Unsupported method " + method);
     }
 
     private boolean bindingEquals(final Object other) {
@@ -94,7 +94,7 @@ class LazyDataObject implements InvocationHandler, AugmentationReader {
                 }
             }
         } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
-            LOG.warn("Can not determine equality of {} and {}",this,other,e);
+            LOG.warn("Can not determine equality of {} and {}", this, other, e);
             return false;
         }
         return true;
@@ -174,7 +174,7 @@ class LazyDataObject implements InvocationHandler, AugmentationReader {
     }
 
     public String bindingToString() {
-        ToStringHelper helper = com.google.common.base.Objects.toStringHelper(context.bindingClass());
+        ToStringHelper helper = com.google.common.base.Objects.toStringHelper(context.bindingClass()).omitNullValues();
 
         for (Method m :context.getHashCodeAndEqualsMethods()) {
             helper.add(m.getName(), getBindingData(m));