diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-02-09 15:32:54 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-02-09 15:32:54 +0100 |
commit | 8e6725c59d3e3bae9aa64bbda4a473f9ac80bb6d (patch) | |
tree | c3db8379c9c4b29c35da9788c59b374ac43184f6 /java/src | |
parent | Fixed ICE-7568 - namespace not correctly escape in C++ (diff) | |
download | ice-8e6725c59d3e3bae9aa64bbda4a473f9ac80bb6d.tar.bz2 ice-8e6725c59d3e3bae9aa64bbda4a473f9ac80bb6d.tar.xz ice-8e6725c59d3e3bae9aa64bbda4a473f9ac80bb6d.zip |
Improved readValue/readProxy methods and streaming helpers
Diffstat (limited to 'java/src')
13 files changed, 201 insertions, 249 deletions
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java index 7ae9b830ac8..8ec41d1f9eb 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java @@ -14,7 +14,6 @@ import java.io.IOException; import com.zeroc.IceInternal.Buffer; import com.zeroc.IceInternal.Instance; import com.zeroc.IceInternal.Protocol; -import com.zeroc.IceInternal.SequencePatcher; /** * Interface for input streams used to extract Slice types from a sequence @@ -585,7 +584,7 @@ public class InputStream } _encapsStack.sz = sz; - EncodingVersion encoding = EncodingVersion.ice_read(this, null); + EncodingVersion encoding = EncodingVersion.ice_read(this); Protocol.checkSupportedEncoding(encoding); // Make sure the encoding is supported. _encapsStack.setEncoding(encoding); @@ -654,7 +653,7 @@ public class InputStream throw new UnmarshalOutOfBoundsException(); } - EncodingVersion encoding = EncodingVersion.ice_read(this, null); + EncodingVersion encoding = EncodingVersion.ice_read(this); Protocol.checkSupportedEncoding(encoding); // Make sure the encoding is supported. if(encoding.equals(Util.Encoding_1_0)) @@ -750,7 +749,7 @@ public class InputStream { throw new UnmarshalOutOfBoundsException(); } - EncodingVersion encoding = EncodingVersion.ice_read(this, null); + EncodingVersion encoding = EncodingVersion.ice_read(this); try { _buf.b.position(_buf.b.position() + sz - 6); @@ -794,7 +793,7 @@ public class InputStream /** * Indicates that unmarshaling is complete, except for any class instances. The application must call this method * only if the stream actually contains class instances. Calling <code>readPendingValues</code> triggers the - * calls to {@link ReadValueCallback#valueReady} that inform the application that unmarshaling of an instance + * calls to consumers provided with {@link #readValue} to inform the application that unmarshaling of an instance * is complete. **/ public void readPendingValues() @@ -1046,7 +1045,7 @@ public class InputStream * * @return The deserialized Java object. **/ - public java.io.Serializable readSerializable() + public <T extends java.io.Serializable> T readSerializable(Class<T> cl) { int sz = readAndCheckSeqSize(1); if (sz == 0) @@ -1058,7 +1057,7 @@ public class InputStream { com.zeroc.IceInternal.InputStreamWrapper w = new com.zeroc.IceInternal.InputStreamWrapper(sz, _buf.b); in = new com.zeroc.IceInternal.ObjectInputStream(_instance, w); - return (java.io.Serializable)in.readObject(); + return cl.cast(in.readObject()); } catch(LocalException ex) { @@ -1085,6 +1084,24 @@ public class InputStream } /** + * Extracts a optional serializable Java object from the stream. + * + * @param tag The numeric tag associated with the value. + * @return The optional value (if any). + **/ + public <T extends java.io.Serializable> java.util.Optional<T> readSerializable(int tag, Class<T> cl) + { + if(readOptional(tag, OptionalFormat.VSize)) + { + return java.util.Optional.of(readSerializable(cl)); + } + else + { + return java.util.Optional.empty(); + } + } + + /** * Extracts a boolean value from the stream. * * @return The extracted boolean. @@ -1803,6 +1820,16 @@ public class InputStream return _instance.proxyFactory().streamToProxy(this); } + public <T extends ObjectPrx> T readProxy(java.util.function.Function<ObjectPrx, T> cast) + { + if(_instance == null) + { + throw new MarshalException("cannot unmarshal a proxy without a communicator"); + } + + return cast.apply(_instance.proxyFactory().streamToProxy(this)); + } + /** * Extracts an optional proxy from the stream. The stream must have been initialized with a communicator. * @@ -1823,6 +1850,26 @@ public class InputStream } /** + * Extracts an optional proxy from the stream. The stream must have been initialized with a communicator. + * + * @param tag The numeric tag associated with the value. + * @param cast The uncheckedCast function to call on the unmarshaled proxy to obtain the correct proxy type. + * @return The optional value (if any). + **/ + public <T extends ObjectPrx> java.util.Optional<T> readProxy(int tag, java.util.function.Function<ObjectPrx, T> cast) + { + if(readOptional(tag, OptionalFormat.FSize)) + { + skip(4); + return java.util.Optional.of(readProxy(cast)); + } + else + { + return java.util.Optional.empty(); + } + } + + /** * Read an enumerated value. * * @param maxValue The maximum enumerator value in the definition. @@ -1852,43 +1899,96 @@ public class InputStream } /** - * Extracts the index of a Slice value from the stream. + * Extracts a Slice value from the stream. * - * @param cb The callback to notify the application when the extracted instance is available. - * The stream extracts Slice values in stages. The Ice run time calls {@link ReadValueCallback#valueReady} - * when the corresponding instance has been fully unmarshaled. + * @param cb The consumer to notify when the extracted instance is available. The stream + * extracts Slice values in stages. The Ice run time calls accept on the consumer when + * the corresponding instance has been fully unmarshaled. * - * @see ReadValueCallback + * @param cls The type of the Ice.Value to unmarshal. **/ - public void readValue(ReadValueCallback cb) + public <T extends Value> void readValue(java.util.function.Consumer<T> cb, Class<T> cls) { initEncaps(); - _encapsStack.decoder.readValue(cb); + if(cb == null) + { + _encapsStack.decoder.readValue(null); + } + else + { + _encapsStack.decoder.readValue(v -> { + if(v == null || cls.isInstance(v)) + { + cb.accept(cls.cast(v)); + } + else + { + com.zeroc.IceInternal.Ex.throwUOE(cls, v); + } + }); + } + } + + /** + * Extracts a Slice value from the stream. + * + * @param cb The consumer to notify when the extracted instance is available. The stream + * extracts Slice values in stages. The Ice run time calls accept on the consumer when + * the corresponding instance has been fully unmarshaled. + **/ + public void readValue(java.util.function.Consumer<Value> cb) + { + readValue(cb, Value.class); } /** - * Extracts the index of an optional Slice value from the stream. + * Extracts an optional Slice value from the stream. * * @param tag The numeric tag associated with the value. - * @param cb The callback to notify the application when the extracted instance is available. - * The stream extracts Slice values in stages. The Ice run time calls {@link ReadValueCallback#valueReady} - * when the corresponding instance has been fully unmarshaled. * - * @see ReadValueCallback + * @param cb The consumer to notify when the extracted instance is available. The stream + * extracts Slice values in stages. The Ice run time calls accept on the consumer when + * the corresponding instance has been fully unmarshaled. + * + * @param cls The type of the Ice.Value to unmarshal. **/ - public void readValue(int tag, ReadValueCallback cb) + public <T extends Value> void readValue(int tag, java.util.function.Consumer<java.util.Optional<T>> cb, Class<T> cls) { if(readOptional(tag, OptionalFormat.Class)) { - readValue(cb); + if(cb != null) + { + readValue(v -> cb.accept(java.util.Optional.ofNullable(v)), cls); + } + else + { + readValue(null); + } } else { - cb.valueReady(null); + if(cb != null) + { + cb.accept(java.util.Optional.empty()); + } } } /** + * Extracts an optional Slice value from the stream. + * + * @param tag The numeric tag associated with the value. + * + * @param cb The consumer to notify when the extracted instance is available. The stream + * extracts Slice values in stages. The Ice run time calls accept on the consumer when + * the corresponding instance has been fully unmarshaled. + **/ + public void readValue(int tag, java.util.function.Consumer<java.util.Optional<Value>> cb) + { + readValue(tag, cb, Value.class); + } + + /** * Extracts a user exception from the stream and throws it. * * @throws UserException The user exception that was unmarshaled. @@ -2005,7 +2105,7 @@ public class InputStream } case Class: { - readValue(null); + readValue(null, null); break; } } @@ -2148,7 +2248,7 @@ public class InputStream _unmarshaledMap = new java.util.TreeMap<>(); } - abstract void readValue(ReadValueCallback cb); + abstract void readValue(java.util.function.Consumer<Value> cb); abstract void throwException(UserExceptionFactory factory) throws UserException; @@ -2275,7 +2375,7 @@ public class InputStream return v; } - protected void addPatchEntry(int index, ReadValueCallback cb) + protected void addPatchEntry(int index, java.util.function.Consumer<Value> cb) { assert(index > 0); @@ -2286,7 +2386,7 @@ public class InputStream Value obj = _unmarshaledMap.get(index); if(obj != null) { - cb.valueReady(obj); + cb.accept(obj); return; } @@ -2300,7 +2400,7 @@ public class InputStream // the callback will be called when the instance is // unmarshaled. // - java.util.LinkedList<ReadValueCallback> l = _patchMap.get(index); + java.util.LinkedList<java.util.function.Consumer<Value>> l = _patchMap.get(index); if(l == null) { // @@ -2335,7 +2435,7 @@ public class InputStream // // Patch all instances now that the instance is unmarshaled. // - java.util.LinkedList<ReadValueCallback> l = _patchMap.get(index); + java.util.LinkedList<java.util.function.Consumer<Value>> l = _patchMap.get(index); if(l != null) { assert(l.size() > 0); @@ -2343,9 +2443,9 @@ public class InputStream // // Patch all pointers that refer to the instance. // - for(ReadValueCallback cb : l) + for(java.util.function.Consumer<Value> cb : l) { - cb.valueReady(v); + cb.accept(v); } // @@ -2410,7 +2510,7 @@ public class InputStream // // Encapsulation attributes for value unmarshaling. // - protected java.util.TreeMap<Integer, java.util.LinkedList<ReadValueCallback> > _patchMap; + protected java.util.TreeMap<Integer, java.util.LinkedList<java.util.function.Consumer<Value>> > _patchMap; private java.util.TreeMap<Integer, Value> _unmarshaledMap; private java.util.TreeMap<Integer, String> _typeIdMap; private int _typeIdIndex; @@ -2427,7 +2527,7 @@ public class InputStream } @Override - void readValue(ReadValueCallback cb) + void readValue(java.util.function.Consumer<Value> cb) { assert(cb != null); @@ -2443,7 +2543,7 @@ public class InputStream if(index == 0) { - cb.valueReady(null); + cb.accept(null); } else { @@ -2721,7 +2821,7 @@ public class InputStream } @Override - void readValue(ReadValueCallback cb) + void readValue(java.util.function.Consumer<Value> cb) { int index = _stream.readSize(); if(index < 0) @@ -2732,7 +2832,7 @@ public class InputStream { if(cb != null) { - cb.valueReady(null); + cb.accept(null); } } else if(_current != null && (_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) @@ -3088,7 +3188,7 @@ public class InputStream return false; } - private int readInstance(int index, ReadValueCallback cb) + private int readInstance(int index, java.util.function.Consumer<Value> cb) { assert(index > 0); @@ -3255,7 +3355,7 @@ public class InputStream if(cb != null) { - cb.valueReady(v); + cb.accept(v); } return index; @@ -3286,8 +3386,8 @@ public class InputStream info.instances = new Value[table != null ? table.length : 0]; for(int j = 0; j < info.instances.length; ++j) { - addPatchEntry(table[j], - new SequencePatcher<Value>(info.instances, Value.class, Value.ice_staticId(), j)); + final int k = j; + addPatchEntry(table[j], v -> info.instances[k] = v); } } @@ -3313,7 +3413,7 @@ public class InputStream private static final class IndirectPatchEntry { int index; - ReadValueCallback cb; + java.util.function.Consumer<Value> cb; } private static final class InstanceData diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java index c48c3a2ac6c..99cc006d538 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java @@ -738,6 +738,34 @@ public class OutputStream } /** + * Writes an optional serializable Java object to the stream. + * + * @param tag The optional tag. + * @param v The optional serializable object to write. + **/ + public <T extends java.io.Serializable> void writeSerializable(int tag, java.util.Optional<T> v) + { + if(v != null && v.isPresent()) + { + writeSerializable(tag, v.get()); + } + } + + /** + * Writes an optional serializable Java object to the stream. + * + * @param tag The optional tag. + * @param v The serializable object to write. + **/ + public void writeSerializable(int tag, java.io.Serializable v) + { + if(writeOptional(tag, OptionalFormat.VSize)) + { + writeSerializable(v); + } + } + + /** * Writes a boolean to the stream. * * @param v The boolean to write to the stream. diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ReadValueCallback.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ReadValueCallback.java deleted file mode 100644 index 41e9ffba464..00000000000 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/ReadValueCallback.java +++ /dev/null @@ -1,28 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 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 com.zeroc.Ice; - -/** - * Callback class to inform an application when an instance of a Slice class has been - * unmarshaled from an input stream. - * - * @see InputStream#readValue - **/ -@FunctionalInterface -public interface ReadValueCallback -{ - /** - * The Ice run time calls this method when it has fully unmarshaled the state - * of a Slice class instance. - * - * @param v The unmarshaled Slice class instance. - **/ - void valueReady(Value v); -} diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java index 426c3b24e3b..f361b379f96 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java @@ -119,9 +119,7 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable OutgoingAsync<String[]> f = new OutgoingAsync<>(this, "ice_ids", OperationMode.Nonmutating, sync, null); f.invoke(true, context, null, null, istr -> { - String[] ret; - ret = StringSeqHelper.read(istr); - return ret; + return istr.readStringSeq(); }); return f; } diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/DictionaryPatcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DictionaryPatcher.java deleted file mode 100644 index f77f47eb84d..00000000000 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/DictionaryPatcher.java +++ /dev/null @@ -1,38 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 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 com.zeroc.IceInternal; - -public class DictionaryPatcher<K, V> implements com.zeroc.Ice.ReadValueCallback -{ - public DictionaryPatcher(java.util.Map<K, V> dict, Class<V> cls, String type, K key) - { - _dict = dict; - _cls = cls; - _type = type; - _key = key; - } - - public void valueReady(com.zeroc.Ice.Value v) - { - if(v == null || _cls.isInstance(v)) - { - _dict.put(_key, _cls.cast(v)); - } - else - { - Ex.throwUOE(_type, v); - } - } - - private java.util.Map<K, V> _dict; - private Class<V> _cls; - private String _type; - private K _key; -} diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java index 0880a697bae..347a954a501 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java @@ -11,6 +11,33 @@ package com.zeroc.IceInternal; public class Ex { + public static <T extends com.zeroc.Ice.Value> void throwUOE(Class<T> expectedType, com.zeroc.Ice.Value v) + { + // + // If the object is an unknown sliced object, we didn't find an + // value factory, in this case raise a NoValueFactoryException + // instead. + // + if(v instanceof com.zeroc.Ice.UnknownSlicedValue) + { + com.zeroc.Ice.UnknownSlicedValue usv = (com.zeroc.Ice.UnknownSlicedValue)v; + throw new com.zeroc.Ice.NoValueFactoryException("", usv.getUnknownTypeId()); + } + + String type = v.ice_id(); + String expected; + try + { + expected = (String)expectedType.getMethod("ice_staticId").invoke(null); + } + catch(Exception ex) + { + expected = ""; + assert(false); + } + throw new com.zeroc.Ice.UnexpectedObjectException( + "expected element of type `" + expected + "' but received '" + type, type, expected); + } public static void throwUOE(String expectedType, com.zeroc.Ice.Value v) { // diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java deleted file mode 100644 index b3772713014..00000000000 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java +++ /dev/null @@ -1,43 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 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 com.zeroc.IceInternal; - -public class ListPatcher<T> implements com.zeroc.Ice.ReadValueCallback -{ - public ListPatcher(java.util.List<T> list, Class<T> cls, String type, int index) - { - _list = list; - _cls = cls; - _type = type; - _index = index; - } - - public void valueReady(com.zeroc.Ice.Value v) - { - if(v == null || _cls.isInstance(v)) - { - // - // This isn't very efficient for sequentially-accessed lists, but there - // isn't much we can do about it as long as a new patcher instance is - // created for each element. - // - _list.set(_index, _cls.cast(v)); - } - else - { - Ex.throwUOE(_type, v); - } - } - - private java.util.List<T> _list; - private Class<T> _cls; - private String _type; - private int _index; -} diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java deleted file mode 100644 index 43263641dd0..00000000000 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java +++ /dev/null @@ -1,52 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 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 com.zeroc.IceInternal; - -public class Patcher<T> implements com.zeroc.Ice.ReadValueCallback -{ - @FunctionalInterface - public interface Callback<T> - { - void valueReady(T v); - } - - public Patcher(Class<T> cls, String type) - { - this(cls, type, null); - } - - public Patcher(Class<T> cls, String type, Callback<T> cb) - { - _cls = cls; - _type = type; - _cb = cb; - } - - public void valueReady(com.zeroc.Ice.Value v) - { - if(v == null || _cls.isInstance(v)) - { - value = _cls.cast(v); - if(_cb != null) - { - _cb.valueReady(value); - } - } - else - { - Ex.throwUOE(_type, v); - } - } - - private Class<T> _cls; - private String _type; - private Callback<T> _cb; - public T value; -} diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java index 321ac80e0b8..4475a642d66 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java @@ -59,8 +59,7 @@ public final class ProxyFactory public com.zeroc.Ice.ObjectPrx streamToProxy(com.zeroc.Ice.InputStream s) { - com.zeroc.Ice.Identity ident = com.zeroc.Ice.Identity.ice_read(s, null); - + com.zeroc.Ice.Identity ident = com.zeroc.Ice.Identity.ice_read(s); Reference ref = _instance.referenceFactory().create(ident, s); return referenceToProxy(ref); } diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBaseI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBaseI.java index d717ef07a49..f17b524caf7 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBaseI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBaseI.java @@ -71,7 +71,7 @@ public abstract class ProxyOutgoingAsyncBaseI<T> extends OutgoingAsyncBaseI<T> i case ReplyStatus.replyFacetNotExist: case ReplyStatus.replyOperationNotExist: { - com.zeroc.Ice.Identity id = com.zeroc.Ice.Identity.ice_read(is, null); + com.zeroc.Ice.Identity id = com.zeroc.Ice.Identity.ice_read(is); // // For compatibility with the old FacetPath. diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java index 1543263bfa0..9c53ce16157 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java @@ -589,8 +589,8 @@ public final class ReferenceFactory com.zeroc.Ice.EncodingVersion encoding; if(!s.getEncoding().equals(com.zeroc.Ice.Util.Encoding_1_0)) { - protocol = com.zeroc.Ice.ProtocolVersion.ice_read(s, null); - encoding = com.zeroc.Ice.EncodingVersion.ice_read(s, null); + protocol = com.zeroc.Ice.ProtocolVersion.ice_read(s); + encoding = com.zeroc.Ice.EncodingVersion.ice_read(s); } else { diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java deleted file mode 100644 index 22309d162f0..00000000000 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java +++ /dev/null @@ -1,39 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 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 com.zeroc.IceInternal; - -public class SequencePatcher<T> implements com.zeroc.Ice.ReadValueCallback -{ - public SequencePatcher(T[] seq, Class<T> cls, String type, int index) - { - _seq = seq; - _cls = cls; - _type = type; - _index = index; - } - - public void valueReady(com.zeroc.Ice.Value v) - { - if(v == null || _cls.isInstance(v)) - { - _seq[_index] = _cls.cast(v); - } - else - { - Ex.throwUOE(_type, v); - } - - } - - private T[] _seq; - private Class<T> _cls; - private String _type; - private int _index; -} diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java index 852c190b4ff..b8d1a2a273d 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java @@ -174,7 +174,7 @@ public final class TraceUtil toStringMode = stream.instance().toStringMode(); } - com.zeroc.Ice.Identity identity = com.zeroc.Ice.Identity.ice_read(stream, null); + com.zeroc.Ice.Identity identity = com.zeroc.Ice.Identity.ice_read(stream); out.write("\nidentity = " + com.zeroc.Ice.Util.identityToString(identity, toStringMode)); String[] facet = stream.readStringSeq(); |