diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/BooleanOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/ByteOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/DoubleOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/FloatOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/IntOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/LongOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/ObjectImpl.java | 6 | ||||
-rw-r--r-- | java/src/Ice/ObjectPrxHelperBase.java | 2 | ||||
-rw-r--r-- | java/src/Ice/OutputStream.java | 12 | ||||
-rw-r--r-- | java/src/Ice/OutputStreamI.java | 10 | ||||
-rw-r--r-- | java/src/Ice/PropertiesI.java | 21 | ||||
-rw-r--r-- | java/src/Ice/ShortOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/_ObjectDelM.java | 2 | ||||
-rw-r--r-- | java/src/IceInternal/BasicStream.java | 322 | ||||
-rw-r--r-- | java/src/IceInternal/EndpointFactoryManager.java | 2 | ||||
-rw-r--r-- | java/src/IceInternal/Incoming.java | 2 | ||||
-rw-r--r-- | java/src/IceInternal/IncomingBase.java | 12 | ||||
-rw-r--r-- | java/src/IceInternal/OpaqueEndpointI.java | 2 | ||||
-rw-r--r-- | java/src/IceInternal/Outgoing.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/OutgoingAsync.java | 4 |
20 files changed, 1024 insertions, 119 deletions
diff --git a/java/src/Ice/BooleanOptional.java b/java/src/Ice/BooleanOptional.java new file mode 100644 index 00000000000..724f89e7460 --- /dev/null +++ b/java/src/Ice/BooleanOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional boolean parameter. + **/ +public class BooleanOptional +{ + /** + * The value defaults to unset. + **/ + public BooleanOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public BooleanOptional(boolean v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public BooleanOptional(BooleanOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public boolean get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(boolean v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(BooleanOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = false; + } + + private boolean _value; + private boolean _isSet; +} diff --git a/java/src/Ice/ByteOptional.java b/java/src/Ice/ByteOptional.java new file mode 100644 index 00000000000..4430f634ffc --- /dev/null +++ b/java/src/Ice/ByteOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional byte parameter. + **/ +public class ByteOptional +{ + /** + * The value defaults to unset. + **/ + public ByteOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public ByteOptional(byte v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public ByteOptional(ByteOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public byte get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(byte v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(ByteOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private byte _value; + private boolean _isSet; +} diff --git a/java/src/Ice/DoubleOptional.java b/java/src/Ice/DoubleOptional.java new file mode 100644 index 00000000000..d9b78066616 --- /dev/null +++ b/java/src/Ice/DoubleOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional double parameter. + **/ +public class DoubleOptional +{ + /** + * The value defaults to unset. + **/ + public DoubleOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public DoubleOptional(double v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public DoubleOptional(DoubleOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public double get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(double v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(DoubleOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private double _value; + private boolean _isSet; +} diff --git a/java/src/Ice/FloatOptional.java b/java/src/Ice/FloatOptional.java new file mode 100644 index 00000000000..d8f11cb6e5e --- /dev/null +++ b/java/src/Ice/FloatOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional float parameter. + **/ +public class FloatOptional +{ + /** + * The value defaults to unset. + **/ + public FloatOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public FloatOptional(float v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public FloatOptional(FloatOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public float get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(float v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(FloatOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = (float)0; + } + + private float _value; + private boolean _isSet; +} diff --git a/java/src/Ice/IntOptional.java b/java/src/Ice/IntOptional.java new file mode 100644 index 00000000000..d80f963b11a --- /dev/null +++ b/java/src/Ice/IntOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional int parameter. + **/ +public class IntOptional +{ + /** + * The value defaults to unset. + **/ + public IntOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public IntOptional(int v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public IntOptional(IntOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public int get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(int v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(IntOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private int _value; + private boolean _isSet; +} diff --git a/java/src/Ice/LongOptional.java b/java/src/Ice/LongOptional.java new file mode 100644 index 00000000000..a40c362736f --- /dev/null +++ b/java/src/Ice/LongOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional long parameter. + **/ +public class LongOptional +{ + /** + * The value defaults to unset. + **/ + public LongOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public LongOptional(long v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public LongOptional(LongOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public long get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(long v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(LongOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private long _value; + private boolean _isSet; +} diff --git a/java/src/Ice/ObjectImpl.java b/java/src/Ice/ObjectImpl.java index 6d2352d6075..7ff5636cc0f 100644 --- a/java/src/Ice/ObjectImpl.java +++ b/java/src/Ice/ObjectImpl.java @@ -91,7 +91,7 @@ public abstract class ObjectImpl implements Object, java.lang.Cloneable, java.io String __id = __is.readString(); __inS.endReadParams(); boolean __ret = __obj.ice_isA(__id, __current); - IceInternal.BasicStream __os = __inS.__startWriteParams(); + IceInternal.BasicStream __os = __inS.__startWriteParams(Ice.FormatType.DefaultFormat); __os.writeBool(__ret); __inS.__endWriteParams(true); return DispatchStatus.DispatchOK; @@ -154,7 +154,7 @@ public abstract class ObjectImpl implements Object, java.lang.Cloneable, java.io { __inS.readEmptyParams(); String[] __ret = __obj.ice_ids(__current); - IceInternal.BasicStream __os = __inS.__startWriteParams(); + IceInternal.BasicStream __os = __inS.__startWriteParams(Ice.FormatType.DefaultFormat); __os.writeStringSeq(__ret); __inS.__endWriteParams(true); return DispatchStatus.DispatchOK; @@ -188,7 +188,7 @@ public abstract class ObjectImpl implements Object, java.lang.Cloneable, java.io { __inS.readEmptyParams(); String __ret = __obj.ice_id(__current); - IceInternal.BasicStream __os = __inS.__startWriteParams(); + IceInternal.BasicStream __os = __inS.__startWriteParams(Ice.FormatType.DefaultFormat); __os.writeString(__ret); __inS.__endWriteParams(true); return DispatchStatus.DispatchOK; diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java index 916ada0220d..9a1de69d685 100644 --- a/java/src/Ice/ObjectPrxHelperBase.java +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -209,7 +209,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable try { __result.__prepare(__ice_isA_name, OperationMode.Nonmutating, __context, __explicitCtx); - IceInternal.BasicStream __os = __result.__startWriteParams(); + IceInternal.BasicStream __os = __result.__startWriteParams(Ice.FormatType.DefaultFormat); __os.writeString(__id); __result.__endWriteParams(); __result.__send(true); diff --git a/java/src/Ice/OutputStream.java b/java/src/Ice/OutputStream.java index d921241b2f4..7c92d240ff3 100644 --- a/java/src/Ice/OutputStream.java +++ b/java/src/Ice/OutputStream.java @@ -190,13 +190,6 @@ public interface OutputStream void writeException(UserException ex); /** - * Select the format to be used for classes and exceptions. - * - * @param format Specify the compact or sliced format. - **/ - void format(FormatType format); - - /** * Marks the start of an Ice object. * * @param slicedData Preserved slices for this object, or null. @@ -237,8 +230,11 @@ public interface OutputStream * Writes the start of an encapsulation to the stream. * * @param encoding The encoding version of the encapsulation. + * + * @param format Specify the compact or sliced format. + * **/ - void startEncapsulation(Ice.EncodingVersion encoding); + void startEncapsulation(Ice.EncodingVersion encoding, Ice.FormatType format); /** * Writes the start of an encapsulation to the stream. diff --git a/java/src/Ice/OutputStreamI.java b/java/src/Ice/OutputStreamI.java index 0a28528037f..67a51d4cbe5 100644 --- a/java/src/Ice/OutputStreamI.java +++ b/java/src/Ice/OutputStreamI.java @@ -172,12 +172,6 @@ public class OutputStreamI implements OutputStream } public void - format(FormatType format) - { - _os.format(format); - } - - public void startObject(SlicedData slicedData) { _os.startWriteObject(slicedData); @@ -214,9 +208,9 @@ public class OutputStreamI implements OutputStream } public void - startEncapsulation(Ice.EncodingVersion encoding) + startEncapsulation(Ice.EncodingVersion encoding, Ice.FormatType format) { - _os.startWriteEncaps(encoding); + _os.startWriteEncaps(encoding, format); } public void diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java index ff76acfb62e..9af0d68033a 100644 --- a/java/src/Ice/PropertiesI.java +++ b/java/src/Ice/PropertiesI.java @@ -176,7 +176,9 @@ public final class PropertiesI implements Properties // assert(dotPos != -1); String propPrefix = pattern.substring(0, dotPos - 1); - if(!propPrefix.equals(prefix)) + boolean mismatchCase = false; + String otherKey = ""; + if(!propPrefix.toUpperCase().equals(prefix.toUpperCase())) { continue; } @@ -197,11 +199,28 @@ public final class PropertiesI implements Properties key = IceInternal.PropertyNames.validProps[i][j].deprecatedBy(); } } + + if(!found) + { + pComp = java.util.regex.Pattern.compile(pattern.toUpperCase()); + m = pComp.matcher(key.toUpperCase()); + if(m.matches()) + { + found = true; + mismatchCase = true; + otherKey = pattern.replaceAll("\\\\", ""); + break; + } + } } if(!found) { logger.warning("unknown property: " + key); } + else if(mismatchCase) + { + logger.warning("unknown property: `" + key + "'; did you mean `" + otherKey + "'"); + } } } diff --git a/java/src/Ice/ShortOptional.java b/java/src/Ice/ShortOptional.java new file mode 100644 index 00000000000..b3d3742f8ad --- /dev/null +++ b/java/src/Ice/ShortOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional short parameter. + **/ +public class ShortOptional +{ + /** + * The value defaults to unset. + **/ + public ShortOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public ShortOptional(short v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public ShortOptional(ShortOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public short get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(short v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(ShortOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private short _value; + private boolean _isSet; +} diff --git a/java/src/Ice/_ObjectDelM.java b/java/src/Ice/_ObjectDelM.java index 05e217f45a6..398eed35a11 100644 --- a/java/src/Ice/_ObjectDelM.java +++ b/java/src/Ice/_ObjectDelM.java @@ -20,7 +20,7 @@ public class _ObjectDelM implements _ObjectDel { try { - IceInternal.BasicStream __os = __og.startWriteParams(); + IceInternal.BasicStream __os = __og.startWriteParams(Ice.FormatType.DefaultFormat); __os.writeString(__id); __og.endWriteParams(); } diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java index 3ed20b61b90..e8d0483e8fa 100644 --- a/java/src/IceInternal/BasicStream.java +++ b/java/src/IceInternal/BasicStream.java @@ -48,7 +48,6 @@ public class BasicStream _unlimited = unlimited; _startSeq = -1; - _format = _instance.defaultsAndOverrides().defaultFormat; _sizePos = -1; } @@ -142,10 +141,6 @@ public class BasicStream other._minSeqSize = _minSeqSize; _minSeqSize = tmpMinSeqSize; - Ice.FormatType tmpFormat = other._format; - other._format = _format; - _format = tmpFormat; - int tmpSizePos = other._sizePos; other._sizePos = _sizePos; _sizePos = tmpSizePos; @@ -188,15 +183,6 @@ public class BasicStream } public void - format(Ice.FormatType format) - { - if(format != Ice.FormatType.DefaultFormat) - { - _format = format; - } - } - - public void startWriteObject(Ice.SlicedData data) { assert(_writeEncapsStack != null && _writeEncapsStack.encoder != null); @@ -263,16 +249,16 @@ public class BasicStream if(_writeEncapsStack != null) { - startWriteEncaps(_writeEncapsStack.encoding); + startWriteEncaps(_writeEncapsStack.encoding, _writeEncapsStack.format); } else { - startWriteEncaps(_encoding); + startWriteEncaps(_encoding, Ice.FormatType.DefaultFormat); } } public void - startWriteEncaps(Ice.EncodingVersion encoding) + startWriteEncaps(Ice.EncodingVersion encoding, Ice.FormatType format) { Protocol.checkSupportedEncoding(encoding); @@ -289,6 +275,7 @@ public class BasicStream curr.next = _writeEncapsStack; _writeEncapsStack = curr; + _writeEncapsStack.format = format; _writeEncapsStack.setEncoding(encoding); _writeEncapsStack.start = _buf.size(); @@ -822,11 +809,20 @@ public class BasicStream } public void - writeByte(int tag, Ice.Optional<Byte> v) + writeByte(int tag, Ice.ByteOptional v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F1)) + if(v != null && v.isSet()) { - writeByte(v.get()); + writeByte(tag, v.get()); + } + } + + public void + writeByte(int tag, byte v) + { + if(writeOpt(tag, Ice.OptionalType.F1)) + { + writeByte(v); } } @@ -854,9 +850,18 @@ public class BasicStream public void writeByteSeq(int tag, Ice.Optional<byte[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeByteSeq(tag, v.get()); + } + } + + public void + writeByteSeq(int tag, byte[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - writeByteSeq(v.get()); + writeByteSeq(v); } } @@ -896,7 +901,7 @@ public class BasicStream } public void - readByte(int tag, Ice.Optional<Byte> v) + readByte(int tag, Ice.ByteOptional v) { if(readOpt(tag, Ice.OptionalType.F1)) { @@ -965,11 +970,20 @@ public class BasicStream } public void - writeBool(int tag, Ice.Optional<Boolean> v) + writeBool(int tag, Ice.BooleanOptional v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F1)) + if(v != null && v.isSet()) { - writeBool(v.get()); + writeBool(tag, v.get()); + } + } + + public void + writeBool(int tag, boolean v) + { + if(writeOpt(tag, Ice.OptionalType.F1)) + { + writeBool(v); } } @@ -1000,9 +1014,18 @@ public class BasicStream public void writeBoolSeq(int tag, Ice.Optional<boolean[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeBoolSeq(tag, v.get()); + } + } + + public void + writeBoolSeq(int tag, boolean[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - writeBoolSeq(v.get()); + writeBoolSeq(v); } } @@ -1020,7 +1043,7 @@ public class BasicStream } public void - readBool(int tag, Ice.Optional<Boolean> v) + readBool(int tag, Ice.BooleanOptional v) { if(readOpt(tag, Ice.OptionalType.F1)) { @@ -1072,11 +1095,20 @@ public class BasicStream } public void - writeShort(int tag, Ice.Optional<Short> v) + writeShort(int tag, Ice.ShortOptional v) + { + if(v != null && v.isSet()) + { + writeShort(tag, v.get()); + } + } + + public void + writeShort(int tag, short v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F2)) + if(writeOpt(tag, Ice.OptionalType.F2)) { - writeShort(v.get()); + writeShort(v); } } @@ -1100,11 +1132,19 @@ public class BasicStream public void writeShortSeq(int tag, Ice.Optional<short[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) { - final short[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 2 + (arr.length > 254 ? 5 : 1)); - writeShortSeq(arr); + writeShortSeq(tag, v.get()); + } + } + + public void + writeShortSeq(int tag, short[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) + { + writeSize(v == null || v.length == 0 ? 1 : v.length * 2 + (v.length > 254 ? 5 : 1)); + writeShortSeq(v); } } @@ -1122,7 +1162,7 @@ public class BasicStream } public void - readShort(int tag, Ice.Optional<Short> v) + readShort(int tag, Ice.ShortOptional v) { if(readOpt(tag, Ice.OptionalType.F2)) { @@ -1174,11 +1214,20 @@ public class BasicStream } public void - writeInt(int tag, Ice.Optional<Integer> v) + writeInt(int tag, Ice.IntOptional v) + { + if(v != null && v.isSet()) + { + writeInt(tag, v.get()); + } + } + + public void + writeInt(int tag, int v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F4)) + if(writeOpt(tag, Ice.OptionalType.F4)) { - writeInt(v.get()); + writeInt(v); } } @@ -1208,11 +1257,19 @@ public class BasicStream public void writeIntSeq(int tag, Ice.Optional<int[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) { - final int[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 4 + (arr.length > 254 ? 5 : 1)); - writeIntSeq(arr); + writeIntSeq(tag, v.get()); + } + } + + public void + writeIntSeq(int tag, int[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) + { + writeSize(v == null || v.length == 0 ? 1 : v.length * 4 + (v.length > 254 ? 5 : 1)); + writeIntSeq(v); } } @@ -1230,7 +1287,7 @@ public class BasicStream } public void - readInt(int tag, Ice.Optional<Integer> v) + readInt(int tag, Ice.IntOptional v) { if(readOpt(tag, Ice.OptionalType.F4)) { @@ -1282,11 +1339,20 @@ public class BasicStream } public void - writeLong(int tag, Ice.Optional<Long> v) + writeLong(int tag, Ice.LongOptional v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F8)) + if(v != null && v.isSet()) { - writeLong(v.get()); + writeLong(tag, v.get()); + } + } + + public void + writeLong(int tag, long v) + { + if(writeOpt(tag, Ice.OptionalType.F8)) + { + writeLong(v); } } @@ -1310,11 +1376,19 @@ public class BasicStream public void writeLongSeq(int tag, Ice.Optional<long[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeLongSeq(tag, v.get()); + } + } + + public void + writeLongSeq(int tag, long[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - final long[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 8 + (arr.length > 254 ? 5 : 1)); - writeLongSeq(arr); + writeSize(v == null || v.length == 0 ? 1 : v.length * 8 + (v.length > 254 ? 5 : 1)); + writeLongSeq(v); } } @@ -1332,7 +1406,7 @@ public class BasicStream } public void - readLong(int tag, Ice.Optional<Long> v) + readLong(int tag, Ice.LongOptional v) { if(readOpt(tag, Ice.OptionalType.F8)) { @@ -1384,11 +1458,20 @@ public class BasicStream } public void - writeFloat(int tag, Ice.Optional<Float> v) + writeFloat(int tag, Ice.FloatOptional v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F4)) + if(v != null && v.isSet()) { - writeFloat(v.get()); + writeFloat(tag, v.get()); + } + } + + public void + writeFloat(int tag, float v) + { + if(writeOpt(tag, Ice.OptionalType.F4)) + { + writeFloat(v); } } @@ -1412,11 +1495,19 @@ public class BasicStream public void writeFloatSeq(int tag, Ice.Optional<float[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeFloatSeq(tag, v.get()); + } + } + + public void + writeFloatSeq(int tag, float[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - final float[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 4 + (arr.length > 254 ? 5 : 1)); - writeFloatSeq(arr); + writeSize(v == null || v.length == 0 ? 1 : v.length * 4 + (v.length > 254 ? 5 : 1)); + writeFloatSeq(v); } } @@ -1434,7 +1525,7 @@ public class BasicStream } public void - readFloat(int tag, Ice.Optional<Float> v) + readFloat(int tag, Ice.FloatOptional v) { if(readOpt(tag, Ice.OptionalType.F4)) { @@ -1486,11 +1577,20 @@ public class BasicStream } public void - writeDouble(int tag, Ice.Optional<Double> v) + writeDouble(int tag, Ice.DoubleOptional v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F8)) + if(v != null && v.isSet()) { - writeDouble(v.get()); + writeDouble(tag, v.get()); + } + } + + public void + writeDouble(int tag, double v) + { + if(writeOpt(tag, Ice.OptionalType.F8)) + { + writeDouble(v); } } @@ -1514,11 +1614,19 @@ public class BasicStream public void writeDoubleSeq(int tag, Ice.Optional<double[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) { - final double[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 8 + (arr.length > 254 ? 5 : 1)); - writeDoubleSeq(arr); + writeDoubleSeq(tag, v.get()); + } + } + + public void + writeDoubleSeq(int tag, double[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) + { + writeSize(v == null || v.length == 0 ? 1 : v.length * 8 + (v.length > 254 ? 5 : 1)); + writeDoubleSeq(v); } } @@ -1536,7 +1644,7 @@ public class BasicStream } public void - readDouble(int tag, Ice.Optional<Double> v) + readDouble(int tag, Ice.DoubleOptional v) { if(readOpt(tag, Ice.OptionalType.F8)) { @@ -1649,9 +1757,18 @@ public class BasicStream public void writeString(int tag, Ice.Optional<String> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeString(tag, v.get()); + } + } + + public void + writeString(int tag, String v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - writeString(v.get()); + writeString(v); } } @@ -1675,10 +1792,19 @@ public class BasicStream public void writeStringSeq(int tag, Ice.Optional<String[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.FSize)) + if(v != null && v.isSet()) + { + writeStringSeq(tag, v.get()); + } + } + + public void + writeStringSeq(int tag, String[] v) + { + if(writeOpt(tag, Ice.OptionalType.FSize)) { startSize(); - writeStringSeq(v.get()); + writeStringSeq(v); endSize(); } } @@ -1809,10 +1935,19 @@ public class BasicStream public void writeProxy(int tag, Ice.Optional<Ice.ObjectPrx> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.FSize)) + if(v != null && v.isSet()) + { + writeProxy(tag, v.get()); + } + } + + public void + writeProxy(int tag, Ice.ObjectPrx v) + { + if(writeOpt(tag, Ice.OptionalType.FSize)) { startSize(); - writeProxy(v.get()); + writeProxy(v); endSize(); } } @@ -1895,9 +2030,18 @@ public class BasicStream public <T extends Ice.Object> void writeObject(int tag, Ice.Optional<T> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.Size)) + if(v != null && v.isSet()) + { + writeObject(tag, v.get()); + } + } + + public void + writeObject(int tag, Ice.Object v) + { + if(writeOpt(tag, Ice.OptionalType.Size)) { - writeObject(v.get()); + writeObject(v); } } @@ -3529,11 +3673,10 @@ public class BasicStream private static final class EncapsEncoder { - EncapsEncoder(BasicStream stream, WriteEncaps encaps, Ice.FormatType format) + EncapsEncoder(BasicStream stream, WriteEncaps encaps) { _stream = stream; _encaps = encaps; - _format = format; _sliceType = SliceType.NoSlice; _usesClasses = false; _objectIdIndex = 0; @@ -3562,7 +3705,7 @@ public class BasicStream _stream.writeInt(-index); _usesClasses = true; } - else if(_sliceType != SliceType.NoSlice && _format == Ice.FormatType.SlicedFormat) + else if(_sliceType != SliceType.NoSlice && _encaps.format == Ice.FormatType.SlicedFormat) { // // An object reference that appears inside a slice of an @@ -3674,7 +3817,7 @@ public class BasicStream // Encode the slice size for the old encoding and if using the // sliced format. // - if(_encaps.encoding_1_0 || _format == Ice.FormatType.SlicedFormat) + if(_encaps.encoding_1_0 || _encaps.format == Ice.FormatType.SlicedFormat) { _sliceFlags |= FLAG_HAS_SLICE_SIZE; } @@ -3700,7 +3843,7 @@ public class BasicStream // Encode the type ID (only in the first slice for the compact // encoding). // - if(_format == Ice.FormatType.SlicedFormat || _encaps.encoding_1_0 || _firstSlice) + if(_encaps.format == Ice.FormatType.SlicedFormat || _encaps.encoding_1_0 || _firstSlice) { // // If the type ID has already been seen, write the index @@ -3767,7 +3910,7 @@ public class BasicStream if(!_indirectionTable.isEmpty()) { assert(!_encaps.encoding_1_0); - assert(_format == Ice.FormatType.SlicedFormat); + assert(_encaps.format == Ice.FormatType.SlicedFormat); _sliceFlags |= FLAG_HAS_INDIRECTION_TABLE; // @@ -3899,7 +4042,7 @@ public class BasicStream // using the sliced format. Otherwise, we ignore the preserved slices, which // essentially "slices" the object into the most-derived type known by the sender. // - if(_encaps.encoding_1_0 || _format != Ice.FormatType.SlicedFormat) + if(_encaps.encoding_1_0 || _encaps.format != Ice.FormatType.SlicedFormat) { return; } @@ -3962,7 +4105,6 @@ public class BasicStream private final BasicStream _stream; private final WriteEncaps _encaps; - private final Ice.FormatType _format; // Object/exception attributes private SliceType _sliceType; @@ -4022,6 +4164,7 @@ public class BasicStream } int start; + Ice.FormatType format; Ice.EncodingVersion encoding; boolean encoding_1_0; @@ -4092,9 +4235,14 @@ public class BasicStream _writeEncapsStack.setEncoding(_encoding); } + if(_writeEncapsStack.format == Ice.FormatType.DefaultFormat) + { + _writeEncapsStack.format = _instance.defaultsAndOverrides().defaultFormat; + } + if(_writeEncapsStack.encoder == null) // Lazy initialization. { - _writeEncapsStack.encoder = new EncapsEncoder(this, _writeEncapsStack, _format); + _writeEncapsStack.encoder = new EncapsEncoder(this, _writeEncapsStack); } } @@ -4106,8 +4254,6 @@ public class BasicStream private int _startSeq; private int _minSeqSize; - private Ice.FormatType _format; - private int _sizePos; private static final byte FLAG_HAS_TYPE_ID_STRING = (byte)(1<<0); diff --git a/java/src/IceInternal/EndpointFactoryManager.java b/java/src/IceInternal/EndpointFactoryManager.java index 9c7c075851e..b3c666c4c6a 100644 --- a/java/src/IceInternal/EndpointFactoryManager.java +++ b/java/src/IceInternal/EndpointFactoryManager.java @@ -108,7 +108,7 @@ public final class EndpointFactoryManager // and ask the factory to read the endpoint data from that stream to create // the actual endpoint. // - BasicStream bs = new BasicStream(_instance, Protocol.currentEncoding, true, false); + BasicStream bs = new BasicStream(_instance, Protocol.currentProtocolEncoding, true, false); ue.streamWrite(bs); Buffer buf = bs.getBuffer(); buf.b.position(0); diff --git a/java/src/IceInternal/Incoming.java b/java/src/IceInternal/Incoming.java index 25eeab25bf5..819a6dda886 100644 --- a/java/src/IceInternal/Incoming.java +++ b/java/src/IceInternal/Incoming.java @@ -149,7 +149,7 @@ final public class Incoming extends IncomingBase implements Ice.Request if(_response) { _os.writeByte(ReplyStatus.replyUserException); - _os.startWriteEncaps(encoding); + _os.startWriteEncaps(encoding, Ice.FormatType.DefaultFormat); _os.writeUserException(ex); _os.endWriteEncaps(); _connection.sendResponse(_os, _compress); diff --git a/java/src/IceInternal/IncomingBase.java b/java/src/IceInternal/IncomingBase.java index 0f4000efbad..f3d89f3b71d 100644 --- a/java/src/IceInternal/IncomingBase.java +++ b/java/src/IceInternal/IncomingBase.java @@ -88,14 +88,14 @@ public class IncomingBase } public BasicStream - __startWriteParams() + __startWriteParams(Ice.FormatType format) { if(_response) { assert(_os.size() == Protocol.headerSize + 4); // Reply status position. assert(_current.encoding != null); // Encoding for reply is known. _os.writeByte((byte)0); - _os.startWriteEncaps(_current.encoding); + _os.startWriteEncaps(_current.encoding, format); } // @@ -152,6 +152,14 @@ public class IncomingBase } } + public void + __writeUserException(Ice.UserException ex, Ice.FormatType format) + { + BasicStream __os = __startWriteParams(format); + __os.writeUserException(ex); + __endWriteParams(false); + } + // // These functions allow this object to be reused, rather than reallocated. // diff --git a/java/src/IceInternal/OpaqueEndpointI.java b/java/src/IceInternal/OpaqueEndpointI.java index 91c34ad00bf..3982b095415 100644 --- a/java/src/IceInternal/OpaqueEndpointI.java +++ b/java/src/IceInternal/OpaqueEndpointI.java @@ -164,7 +164,7 @@ final class OpaqueEndpointI extends EndpointI streamWrite(BasicStream s) { s.writeShort(_type); - s.startWriteEncaps(_rawEncoding); + s.startWriteEncaps(_rawEncoding, Ice.FormatType.DefaultFormat); s.writeBlob(_rawBytes); s.endWriteEncaps(); } diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java index c7ace46eb31..aa07f8aa052 100644 --- a/java/src/IceInternal/Outgoing.java +++ b/java/src/IceInternal/Outgoing.java @@ -457,9 +457,9 @@ public final class Outgoing implements OutgoingMessageCallback } public BasicStream - startWriteParams() + startWriteParams(Ice.FormatType format) { - _os.startWriteEncaps(_encoding); + _os.startWriteEncaps(_encoding, format); return _os; } diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java index ca55efc67b1..2333c148c47 100644 --- a/java/src/IceInternal/OutgoingAsync.java +++ b/java/src/IceInternal/OutgoingAsync.java @@ -397,9 +397,9 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa } public BasicStream - __startWriteParams() + __startWriteParams(Ice.FormatType format) { - _os.startWriteEncaps(_encoding); + _os.startWriteEncaps(_encoding, format); return _os; } |