Details
Description
Looking over the bugfix in jaxen-116 I think I've spotted another bug: substring("hello", -50) should produce "hello", but the code will produce "". (I've not tested this, but you can see it in the path through the code below)
int substringLength = stringLength; // eg 5. default should effectively be 'infinity'.
...
int end = start + substringLength; // eg -4 + 5 = 1, but since length wasn't specified it isn't 5!
// negative start is treated as 0
if ( start < 0){
start = 0;
}
// ended up with (0,1) not (0, 5).
I'll supply tests and a patch for this shortly.
This one should be fixed now. It was trickier than it looked. Hopefully nothing else is broken here, but it's worth inspecting to be sure.