Mantis - Hessian
Viewing Issue Advanced Details
3692 minor always 09-22-09 11:39 01-12-11 18:31
lcwik  
 
normal  
new 4.0.1  
open  
none    
none  
0003692: MicroHessianOutput writeBytes wrong size
MicroHessianOutput writeBytes incorrectly encodes the size of the array into the stream. The "<<" is the wrong way.
Fix:

  public void writeBytes(byte []buffer, int offset, int length)
    throws IOException
  {
    if (buffer == null) {
      os.write('N');
    }
    else {
      os.write('B');
      os.write(length >> 8);
      os.write(length);
      os.write(buffer, offset, length);
    }
  

Previously:

  public void writeBytes(byte []buffer, int offset, int length)
    throws IOException
  {
    if (buffer == null) {
      os.write('N');
    }
    else {
      os.write('B');
      os.write(length << 8);
      os.write(length);
      os.write(buffer, offset, length);
    }
  

Notes
(0004925)
cfreyer   
01-12-11 18:31   
I can confirm this defect. I've been using MicroHessionOutput in a mobile application I'm developing. All my outputs (with byte array length of > 180 bytes) were failing. Drove me crazy!! Once I applied the fix above, my application worked as designed. All of my defects disappeared.