From cb4800008fe5852753b2809da429ec373dd0092a Mon Sep 17 00:00:00 2001 From: Jan Hajnar Date: Tue, 7 Jul 2015 11:38:33 +0200 Subject: [PATCH] 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 --- .../sal/rest/doc/impl/BaseYangSwaggerGenerator.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } -- 2.36.6