diff --git a/core/src/main/java/org/jacorb/orb/CDROutputStream.java b/core/src/main/java/org/jacorb/orb/CDROutputStream.java index 7f47cb8..4d8fcb9 100644 --- a/core/src/main/java/org/jacorb/orb/CDROutputStream.java +++ b/core/src/main/java/org/jacorb/orb/CDROutputStream.java @@ -1875,7 +1875,7 @@ public class CDROutputStream } Integer index = getValueMap().get (value); - if (index != null) + if (index != null && isIndirectionEnabled()) { // value has already been written -- make an indirection write_long (0xffffffff); @@ -1891,7 +1891,7 @@ public class CDROutputStream private void write_repository_id(final String repository_id) { Integer _index = getRepIdMap().get (repository_id); - if ( _index == null) + if ( _index == null || !isIndirectionEnabled() ) { // a new repository id -- write it @@ -1929,7 +1929,7 @@ public class CDROutputStream { _index = getCodebaseMap().get (codebase); } - if ( _index == null) + if ( _index == null && !isIndirectionEnabled()) { // a new codebase -- write it# @@ -2180,7 +2180,7 @@ public class CDROutputStream { // look at the new value Integer index = getValueMap().get(newValue); - if (index != null) + if (index != null && isIndirectionEnabled()) { // previously marshaled value -- make an indirection write_long (0xffffffff); diff --git a/core/src/main/java/org/jacorb/orb/typecode/ComplexTypeCodeWriter.java b/core/src/main/java/org/jacorb/orb/typecode/ComplexTypeCodeWriter.java index a3438ab..72d167c 100644 --- a/core/src/main/java/org/jacorb/orb/typecode/ComplexTypeCodeWriter.java +++ b/core/src/main/java/org/jacorb/orb/typecode/ComplexTypeCodeWriter.java @@ -34,26 +34,19 @@ public abstract class ComplexTypeCodeWriter implements TypeCodeWriter public void writeTypeCode(TypeCode typeCode, CDROutputStream out, Map recursiveTCMap, Map repeatedTCMap) { - if (out.isIndirectionEnabled() && repeatedTCMap.containsKey(typeCode)) + try { - writeIndirectionMarker(out, typeCode, repeatedTCMap); + tryWriteTypeCode(typeCode, out, recursiveTCMap, repeatedTCMap); } - else + catch (BadKind e) { - try - { - tryWriteTypeCode(typeCode, out, recursiveTCMap, repeatedTCMap); - } - catch (BadKind e) - { - assert false; - throw new RuntimeException(e); - } - catch (Bounds e) - { - assert false; - throw new RuntimeException(e); - } + assert false; + throw new RuntimeException(e); + } + catch (Bounds e) + { + assert false; + throw new RuntimeException(e); } } @@ -82,15 +75,4 @@ public abstract class ComplexTypeCodeWriter implements TypeCodeWriter } protected abstract void doWriteTypeCodeParameters(TypeCode typeCode, CDROutputStream out, Map recursiveTCMap, Map repeatedTCMap) throws BadKind, Bounds; - - private final void writeIndirectionMarker(final CDROutputStream out, - final Object key, - final Map indirectionTCMap) - { - out.write_long( -1 ); // recursion marker - int negative_offset = - ((Integer) indirectionTCMap.get(key)).intValue() - out.get_pos() - 4; - - out.write_long( negative_offset ); - } } diff --git a/core/src/main/java/org/jacorb/orb/typecode/DelegatingTypeCodeWriter.java b/core/src/main/java/org/jacorb/orb/typecode/DelegatingTypeCodeWriter.java index 20308a6..c390831 100644 --- a/core/src/main/java/org/jacorb/orb/typecode/DelegatingTypeCodeWriter.java +++ b/core/src/main/java/org/jacorb/orb/typecode/DelegatingTypeCodeWriter.java @@ -68,7 +68,7 @@ public class DelegatingTypeCodeWriter { try { - if(TypeCode.isRecursive(typeCode) && recursiveTCMap.containsKey(typeCode.id())) + if(out.isIndirectionEnabled() && TypeCode.isRecursive(typeCode) && recursiveTCMap.containsKey(typeCode.id())) { writeIndirectionMarker(out, typeCode.id(), recursiveTCMap); }