diff options
Diffstat (limited to 'java/src/IceInternal/BasicStream.java')
-rw-r--r-- | java/src/IceInternal/BasicStream.java | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java index 12e6f64ceb1..50b96d75c22 100644 --- a/java/src/IceInternal/BasicStream.java +++ b/java/src/IceInternal/BasicStream.java @@ -171,8 +171,7 @@ public class BasicStream public void startWriteEncaps() { - writeByte(Protocol.encodingMajor); - writeByte(Protocol.encodingMinor); + writeByte((byte)0); // Encoding writeInt(0); // Placeholder for the encapsulation length WriteEncaps curr = _writeEncapsCache; if(curr != null) @@ -183,6 +182,7 @@ public class BasicStream { curr = new WriteEncaps(); } + curr.encoding = 0; curr.start = _buf.position(); curr.next = _writeEncapsStack; _writeEncapsStack = curr; @@ -208,17 +208,11 @@ public class BasicStream public void startReadEncaps() { - byte eMajor = readByte(); - byte eMinor = readByte(); - if(eMajor != Protocol.encodingMajor || eMinor > Protocol.encodingMinor) - { - Ice.UnsupportedEncodingException e = new Ice.UnsupportedEncodingException(); - e.badMajor = eMajor < 0 ? eMajor + 255 : eMajor; - e.badMinor = eMinor < 0 ? eMinor + 255 : eMinor; - e.major = Protocol.encodingMajor; - e.minor = Protocol.encodingMinor; - throw e; - } + byte encoding = readByte(); + if(encoding != 0) + { + throw new Ice.UnsupportedEncodingException(); + } // // I don't use readSize() and writeSize() for encapsulations, // because when creating an encapsulation, I must know in @@ -241,8 +235,7 @@ public class BasicStream { curr = new ReadEncaps(); } - curr.encodingMajor = eMajor; - curr.encodingMinor = eMinor; + curr.encoding = encoding; curr.start = _buf.position(); curr.next = _readEncapsStack; _readEncapsStack = curr; @@ -321,17 +314,11 @@ public class BasicStream public void skipEncaps() { - byte version = readByte(); // Ignore major - version = readByte(); // Ignore minor - - // - // We don't check the encoding here because encapsulations always - // have the encoding followed by the size of the encapsulation - // (regardless of the version of the encoding). We care about the - // version information only if we want to decode what's in the - // encapsulation. - // - + byte encoding = readByte(); + if(encoding != 0) + { + throw new Ice.UnsupportedEncodingException(); + } int sz = readInt(); if(sz < 0) { @@ -1336,8 +1323,7 @@ public class BasicStream private static final class ReadEncaps { int start; - byte encodingMajor; - byte encodingMinor; + byte encoding; java.util.ArrayList objectsRead; ReadEncaps next; } @@ -1345,6 +1331,7 @@ public class BasicStream private static final class WriteEncaps { int start; + byte encoding; java.util.IdentityHashMap objectsWritten; WriteEncaps next; } |