diff options
author | Benoit Foucher <benoit@zeroc.com> | 2013-01-15 10:33:18 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2013-01-15 10:33:18 +0100 |
commit | 9ee1bf93d1837e48ccb8b93d5b219bf48a1ba909 (patch) | |
tree | 387bf0e45be6e75e2af2fcf36eb7588000578e2c /java/src/IceInternal/Protocol.java | |
parent | Fixed add-in unexpected exception (diff) | |
download | ice-9ee1bf93d1837e48ccb8b93d5b219bf48a1ba909.tar.bz2 ice-9ee1bf93d1837e48ccb8b93d5b219bf48a1ba909.tar.xz ice-9ee1bf93d1837e48ccb8b93d5b219bf48a1ba909.zip |
Fixed ICE-5126 - Improved client side encoding checks
Diffstat (limited to 'java/src/IceInternal/Protocol.java')
-rw-r--r-- | java/src/IceInternal/Protocol.java | 25 |
1 files changed, 25 insertions, 0 deletions
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) { |