package org.osgi.impl.bundle.obr.resource;

import java.util.Comparator;

public class ResourceImplComparator implements Comparator<ResourceImpl> {
	private String getName(ResourceImpl impl) {
		String s = impl.getSymbolicName();
		if (s != null) {
			return s;
		} else {
			return "no-symbolic-name";
		}
	}

	public int compare(ResourceImpl r1, ResourceImpl r2) {
		String s1 = getName(r1);
		String s2 = getName(r2);
		return s1.compareTo(s2);
	}
}

@@ -147,97 +147,72 @@
 %7B%0A%09p
-rivate String getName(ResourceImpl impl) %7B%0A%09%09String s = impl.getSymbolicName();
+ublic int compare(ResourceImpl r1, ResourceImpl r2) %7B
 %0A%09%09if (
-s !
+r2 =
 = nu
@@ -231,194 +231,100 @@
 urn 
-s
+-1
 ;%0A%09%09%7D
- else %7B%0A%09%09%09return %22no-symbolic-name%22;%0A%09%09%7D%0A%09%7D%0A%0A%09public int compare(ResourceImpl r1, ResourceImpl r2) %7B%0A%09%09String s1 = getName(r1);%0A%09%09String s2 = getName(r2);%0A%09%09return s1.compareTo(s2
+%0A%09%09if (r1 == null) %7B%0A%09%09%09return 1;%0A%09%09%7D%0A%0A%09%09return r1.toString().compareTo(r2.toString()
 );%0A%09

improve the comparator