org/omg/IOP/TaggedComponentHelper.java

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes a failure when used with JacORB:

org.omg.CORBA.NO_IMPLEMENT:  Minor: 0 (0). Completed: not completed
   at org.omg.CORBA.portable.OutputStream.write(OutputStream.java:90)
   at java.io.OutputStream.write(OutputStream.java:110)
   at java.io.OutputStream.write(OutputStream.java:86)
   at org.omg.IOP.TaggedComponentHelper.write(TaggedComponentHelper.java:169)

This happens because org.omg.CORBA.portable.OutputStream.write mustn't
be called:

  public void write(int n)
             throws IOException
  {
    throw new NO_IMPLEMENT();
  }

We can easily fix this by calling write_octet_array(), not write().

Andrew.


2007-04-11  Andrew Haley  <aph@xxxxxxxxxx>

	* org/omg/IOP/TaggedComponentHelper.java (read): Use
	read_octet_array(), not read().
	(write): Use write_octet_array(), not write().
 
Index: omg/IOP/TaggedComponentHelper.java
===================================================================
--- omg/IOP/TaggedComponentHelper.java	(revision 123473)
+++ omg/IOP/TaggedComponentHelper.java	(working copy)
@@ -136,18 +136,9 @@
   {
     TaggedComponent value = new TaggedComponent();
     value.tag = input.read_long();
-    value.component_data = new byte[input.read_long()];
-    try
-      {
-        input.read(value.component_data);
-      }
-    catch (IOException e)
-      {
-        MARSHAL m = new MARSHAL();
-        m.minor = Minor.Encapsulation;
-        m.initCause(e);
-        throw m;
-      }
+    int length = input.read_long();
+    value.component_data = new byte[length];
+    input.read_octet_array(value.component_data, 0, length);
     return value;
   }
 
@@ -163,17 +154,6 @@
   {
     output.write_long(value.tag);
     output.write_long(value.component_data.length);
-
-    try
-      {
-        output.write(value.component_data);
-      }
-    catch (IOException e)
-      {
-        MARSHAL m = new MARSHAL();
-        m.minor = Minor.Encapsulation;
-        m.initCause(e);
-        throw m;
-      }
+    output.write_octet_array(value.component_data, 0, value.component_data.length);
   }
 }


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux