summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/BasicStream.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2003-05-22 17:19:36 +0000
committerBenoit Foucher <benoit@zeroc.com>2003-05-22 17:19:36 +0000
commit4e635c7f413b934e2606cb06e3d07f1823324d4a (patch)
tree007bd17c81009148c1e794b3c6b17a1b5b93ee2e /java/src/IceInternal/BasicStream.java
parentavoid exception for secure datagram attempts (diff)
downloadice-4e635c7f413b934e2606cb06e3d07f1823324d4a.tar.bz2
ice-4e635c7f413b934e2606cb06e3d07f1823324d4a.tar.xz
ice-4e635c7f413b934e2606cb06e3d07f1823324d4a.zip
Temporary fix
Diffstat (limited to 'java/src/IceInternal/BasicStream.java')
-rw-r--r--java/src/IceInternal/BasicStream.java46
1 files changed, 27 insertions, 19 deletions
diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java
index 797016914df..22375079608 100644
--- a/java/src/IceInternal/BasicStream.java
+++ b/java/src/IceInternal/BasicStream.java
@@ -1217,29 +1217,37 @@ public class BasicStream
public void
writePendingObjects()
{
- while(_writeEncapsStack.toBeMarshaledMap.size() > 0)
+ //
+ // TODO: Benoit: I think we need to check for these to be null here because it's possible that
+ // these attributes are null if no objects have been written (which might be the case when
+ // marshalling a sequence of objects if the sequence has no elements).
+ //
+ if(_writeEncapsStack != null && _writeEncapsStack.toBeMarshaledMap != null)
{
- java.util.IdentityHashMap savedMap = new java.util.IdentityHashMap(_writeEncapsStack.toBeMarshaledMap);
- writeSize(savedMap.size());
- for(java.util.Iterator p = savedMap.entrySet().iterator(); p.hasNext(); )
+ while(_writeEncapsStack.toBeMarshaledMap.size() > 0)
{
+ java.util.IdentityHashMap savedMap = new java.util.IdentityHashMap(_writeEncapsStack.toBeMarshaledMap);
+ writeSize(savedMap.size());
+ for(java.util.Iterator p = savedMap.entrySet().iterator(); p.hasNext(); )
+ {
+ //
+ // Add an instance from the old to-be-marshaled map to the marshaled map and then
+ // ask the instance to marshal itself. Any new class instances that are triggered
+ // by the classes marshaled are added to toBeMarshaledMap.
+ //
+ java.util.Map.Entry e = (java.util.Map.Entry)p.next();
+ _writeEncapsStack.marshaledMap.put(e.getKey(), e.getValue());
+ writeInstance((Ice.Object)e.getKey(), (Integer)e.getValue());
+ }
+
//
- // Add an instance from the old to-be-marshaled map to the marshaled map and then
- // ask the instance to marshal itself. Any new class instances that are triggered
- // by the classes marshaled are added to toBeMarshaledMap.
+ // We have marshaled all the instances for this pass, substract what we have
+ // marshaled from the toBeMarshaledMap.
//
- java.util.Map.Entry e = (java.util.Map.Entry)p.next();
- _writeEncapsStack.marshaledMap.put(e.getKey(), e.getValue());
- writeInstance((Ice.Object)e.getKey(), (Integer)e.getValue());
- }
-
- //
- // We have marshaled all the instances for this pass, substract what we have
- // marshaled from the toBeMarshaledMap.
- //
- for(java.util.Iterator p = savedMap.keySet().iterator(); p.hasNext(); )
- {
- _writeEncapsStack.toBeMarshaledMap.remove(p.next());
+ for(java.util.Iterator p = savedMap.keySet().iterator(); p.hasNext(); )
+ {
+ _writeEncapsStack.toBeMarshaledMap.remove(p.next());
+ }
}
}
writeSize(0); // Zero marker indicates end of sequence of sequences of instances.