diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/IceInternal/LocatorInfo.java | 6 | ||||
-rw-r--r-- | java/src/IceInternal/Outgoing.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/OutgoingAsync.java | 2 | ||||
-rw-r--r-- | java/src/IceInternal/Protocol.java | 25 |
4 files changed, 31 insertions, 6 deletions
diff --git a/java/src/IceInternal/LocatorInfo.java b/java/src/IceInternal/LocatorInfo.java index 5355d3759ac..29b0ccb3b03 100644 --- a/java/src/IceInternal/LocatorInfo.java +++ b/java/src/IceInternal/LocatorInfo.java @@ -29,9 +29,9 @@ public final class LocatorInfo if(_ref.isWellKnown() && !Protocol.isSupported(_ref.getEncoding(), r.getEncoding())) { // - // If a well-known proxy and the returned proxy encoding isn't - // supported, we're done: there are no compatible endpoints - // we can use. + // If a well-known proxy and the returned proxy + // encoding isn't supported, we're done: there's + // no compatible endpoint we can use. // } else if(!r.isIndirect()) diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java index ae5b60f3da9..b176fed16df 100644 --- a/java/src/IceInternal/Outgoing.java +++ b/java/src/IceInternal/Outgoing.java @@ -23,7 +23,7 @@ public final class Outgoing implements OutgoingMessageCallback _sent = false; _handler = handler; _observer = observer; - _encoding = handler.getReference().getEncoding(); + _encoding = Protocol.checkForCompatibleEncoding(handler.getReference().getEncoding()); _os = new BasicStream(_handler.getReference().getInstance(), Protocol.currentProtocolEncoding); Protocol.checkSupportedProtocol(_handler.getReference().getProtocol()); @@ -44,7 +44,7 @@ public final class Outgoing implements OutgoingMessageCallback _sent = false; _handler = handler; _observer = observer; - _encoding = handler.getReference().getEncoding(); + _encoding = Protocol.checkForCompatibleEncoding(handler.getReference().getEncoding()); Protocol.checkSupportedProtocol(_handler.getReference().getProtocol()); diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java index b2b66a3be88..7e89ec96058 100644 --- a/java/src/IceInternal/OutgoingAsync.java +++ b/java/src/IceInternal/OutgoingAsync.java @@ -15,7 +15,7 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa { super(prx.ice_getCommunicator(), ((Ice.ObjectPrxHelperBase)prx).__reference().getInstance(), operation, cb); _proxy = (Ice.ObjectPrxHelperBase)prx; - _encoding = _proxy.__reference().getEncoding(); + _encoding = Protocol.checkForCompatibleEncoding(_proxy.__reference().getEncoding()); } public void __prepare(String operation, Ice.OperationMode mode, java.util.Map<String, String> ctx, diff --git a/java/src/IceInternal/Protocol.java b/java/src/IceInternal/Protocol.java index af30ba0ee02..e1e88ce3511 100644 --- a/java/src/IceInternal/Protocol.java +++ b/java/src/IceInternal/Protocol.java @@ -130,6 +130,31 @@ final public class Protocol } } + // + // Either return the given encoding if not compatible, or the greatest + // supported encoding otherwise. + // + static public Ice.EncodingVersion + checkForCompatibleEncoding(Ice.EncodingVersion v) + { + if(v.major != currentEncoding.major) + { + return v; // Unsupported encoding, return as is. + } + else if(v.minor < currentEncoding.minor) + { + return v; // Supported encoding. + } + else + { + // + // Unsupported but compatible, use the currently supported + // encoding, that's the best we can do. + // + return currentEncoding; + } + } + static public boolean isSupported(Ice.ProtocolVersion version, Ice.ProtocolVersion supported) { |