OBR expected all resources to have a presentation name when listing them,
when they did not an NPE resulted. (FELIX-1157)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@774904 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/ObrCommandImpl.java b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/ObrCommandImpl.java
index 1af286f..f079bd1 100644
--- a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/ObrCommandImpl.java
+++ b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/ObrCommandImpl.java
@@ -241,7 +241,12 @@
// Otherwise, compare the presentation name to keep them sorted
// by presentation name. If the presentation names are equal, then
// use the symbolic name to differentiate.
- int compare = r1.getPresentationName().compareToIgnoreCase(r2.getPresentationName());
+ int compare = (r1.getPresentationName() == null)
+ ? -1
+ : (r2.getPresentationName() == null)
+ ? 1
+ : r1.getPresentationName().compareToIgnoreCase(
+ r2.getPresentationName());
if (compare == 0)
{
return symCompare;