Repository: cxf Updated Branches: refs/heads/2.7.x-fixes c43b26fa6 -> 5c18477c2
[CXF-6614] Returning 0 if both interfaces are null Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5c18477c Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5c18477c Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5c18477c Branch: refs/heads/2.7.x-fixes Commit: 5c18477c2885e5984bfca05c8e0b4a063d947095 Parents: c43b26f Author: Sergey Beryozkin <[email protected]> Authored: Mon Oct 5 13:49:13 2015 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Mon Oct 5 13:51:59 2015 +0100 ---------------------------------------------------------------------- .../transport/http/DestinationRegistryImpl.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/5c18477c/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java ---------------------------------------------------------------------- diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java index 539ba6f..7d01b17 100644 --- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java +++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java @@ -30,6 +30,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import org.apache.cxf.service.model.InterfaceInfo; import org.apache.cxf.transport.AbstractDestination; public class DestinationRegistryImpl implements DestinationRegistry { @@ -122,16 +123,19 @@ public class DestinationRegistryImpl implements DestinationRegistry { getDestinations()); Collections.sort(dest2, new Comparator<AbstractHTTPDestination>() { public int compare(AbstractHTTPDestination o1, AbstractHTTPDestination o2) { - if (o1.getEndpointInfo().getInterface() == null) { + InterfaceInfo i1 = o1.getEndpointInfo().getInterface(); + InterfaceInfo i2 = o2.getEndpointInfo().getInterface(); + if (i1 == null && i2 == null) { + return 0; + } else if (i1 == null) { return -1; - } - if (o2.getEndpointInfo().getInterface() == null) { + } else if (i2 == null) { return 1; + } else { + return i1.getName().getLocalPart() + .compareTo( + i2.getName().getLocalPart()); } - return o1.getEndpointInfo().getInterface().getName() - .getLocalPart().compareTo( - o2.getEndpointInfo().getInterface().getName() - .getLocalPart()); } });
