Mantis - Hessian
Viewing Issue Advanced Details
3804 minor always 12-08-09 09:18 12-17-09 18:21
emil  
 
normal  
closed 4.0.2  
fixed  
none    
none 4.0.3  
0003804: hessian flash long strings
(rep by Piet van Remortel)

We are trying to fix an unexplainable error in communicating between java
(hessian 4.0.2) and flex (hessian 4.0.0). For some input files we get a
"expected string at XX" where XX is a position number. Digging into the code,
we find that this seems like a wrong or unexpected code coming in when reading
characters. Is this a version mismatch ? If so, is there a plan to push the
flex version to 4.0.2 also ?

...


We stepped through the code and noticed the following: We typically transmit
long files consisting of strings (XML). Whenever such a file is chopped up in
blocks of 0x8000 size, the following can happen, making things go wrong:

When a string's length is a multiple of 0x8000, plus a tail that is less then
0x0400, the tail gets misread in the parseChar() method, since there is no case
clause capturing BC_STRING_SHORT.

The following adaptation of parseChar() in Hessian2Input fixes this:
(Actionscript version given - analogous for Java)

//=========

...

_isLastChunk = true;

_chunkLength = code - 0x00;


break;


// fix start ==============

case Hessian2Constants.BC_STRING_SHORT:

case Hessian2Constants.BC_STRING_SHORT + 1:

case Hessian2Constants.BC_STRING_SHORT + 2:

_isLastChunk = true;

_chunkLength = ((code - Hessian2Constants.BC_STRING_SHORT) << 8) + read();

break;

// fix end ================


default:

throw expect("string", code);

}

}
_chunkLength--;


return parseUTF8Char();

}

//=========

Notes
(0004350)
emil   
12-17-09 18:21   
Hessian2InputOutputTests - 0x8000 + 0x400 String: "a" * 0x8400