FELIX-108 Prevent NullPointerException if a locally installed bundle
does not have a Bundle-SymbolicName or version
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@689826 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/ResourceImpl.java b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/ResourceImpl.java
index 70040c2..607696b 100644
--- a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/ResourceImpl.java
+++ b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/ResourceImpl.java
@@ -67,16 +67,24 @@
public boolean equals(Object o)
{
+ if (getSymbolicName() == null || getVersion() == null)
+ {
+ return this == o;
+ }
if (o instanceof Resource)
{
- return ((Resource) o).getSymbolicName().equals(getSymbolicName())
- && ((Resource) o).getVersion().equals(getVersion());
+ return getSymbolicName().equals(((Resource) o).getSymbolicName())
+ && getVersion().equals(((Resource) o).getVersion());
}
return false;
}
public int hashCode()
{
+ if (getSymbolicName() == null || getVersion() == null)
+ {
+ return super.hashCode();
+ }
return getSymbolicName().hashCode() ^ getVersion().hashCode();
}