From: Jan Hajnar Date: Tue, 7 Jul 2015 09:38:33 +0000 (+0200) Subject: Bug 1500 - Null pointer exception when using mounted resources tab to X-Git-Tag: release/beryllium~413 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=cb4800008fe5852753b2809da429ec373dd0092a Bug 1500 - Null pointer exception when using mounted resources tab to see the operations on mount point * added check for when revision is null in modules comparator Change-Id: I3bdc4ed798297d31ea25001d25918e298c8124bb Signed-off-by: Jan Hajnar --- diff --git a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java index c8bf6e6675..c86b89c004 100644 --- a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java +++ b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java @@ -388,13 +388,15 @@ public class BaseYangSwaggerGenerator { SortedSet sortedModules = new TreeSet<>(new Comparator() { @Override - public int compare(Module o1, Module o2) { - int result = o1.getName().compareTo(o2.getName()); + public int compare(Module module1, Module module2) { + int result = module1.getName().compareTo(module2.getName()); if (result == 0) { - result = o1.getRevision().compareTo(o2.getRevision()); + Date module1Revision = module1.getRevision() != null ? module1.getRevision() : new Date(0); + Date module2Revision = module2.getRevision() != null ? module2.getRevision() : new Date(0); + result = module1Revision.compareTo(module2Revision); } if (result == 0) { - result = o1.getNamespace().compareTo(o2.getNamespace()); + result = module1.getNamespace().compareTo(module2.getNamespace()); } return result; }