<html>
    <head>
      <base href="http://www.jacorb.org/bugzilla/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - read_fixed() fails with 0"
   href="http://www.jacorb.org/bugzilla/show_bug.cgi?id=996">996</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>read_fixed() fails with 0
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>JacORB
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P5
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ORB
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>jacorb-bugs@lists.spline.inf.fu-berlin.de
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>juergen@jwi.de
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If you send BigDecimal(new BigInteger("0")) over the wire, the receiving JacORB
fails with Zero length BigInteger.

Problem is at CDRInputStream.java:897 read_fixed_internal()

For 0 the CDR representation is 0C

so (outBuffer.length() > 0 || c != 0) is false || false and the 0 gets ignored.


47 49 4F 50  01 02 00 01  00 00 00 0D  00 00 00 04  GIOP .... .... .... 
00 00 00 00  00 00 00 00  0C                        .... .... .
FINE read GIOP message of size 25 from ClientGIOPConnection to
172.20.6.163:61759 (1010058)
java.lang.NumberFormatException: Zero length BigInteger
    at java.math.BigInteger.<init>(BigInteger.java:276)
    at java.math.BigInteger.<init>(BigInteger.java:451)
    at org.jacorb.orb.CDRInputStream.read_fixed(CDRInputStream.java:838)
    at demo.hello.FixedStructHelper.read(FixedStructHelper.java:41)
    at demo.hello._GoodDayStub.testFixed(_GoodDayStub.java:102)
    at demo.hello.Client.main(Client.java:65)

To reproduce:

struct FixedStruct
    {
        fixed<1,0> fnull; 
    };     

        interface GoodDay {
...            
            FixedStruct testFixed(in FixedStruct fs);         
        };

return with new BigDecimal(new BigInteger("0"))</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>