add additional sanity checks

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142880 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-05 03:02:12 +00:00
parent efd149c834
commit 9b69954212
2 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,11 @@ public abstract class BytePropertyNode extends PropertyNode {
translator.getCharIndex(fcEnd, translator.getCharIndex(fcStart)),
buf
);
if ( fcStart > fcEnd )
throw new IllegalArgumentException( "fcStart (" + fcStart
+ ") > fcEnd (" + fcEnd + ")" );
this.startBytes = fcStart;
this.endBytes = fcEnd;
}

View File

@ -56,6 +56,10 @@ public abstract class PropertyNode implements Comparable, Cloneable
_logger.log(POILogger.WARN, "A property claimed to start before zero, at " + _cpStart + "! Resetting it to zero, and hoping for the best");
_cpStart = 0;
}
if ( fcStart > fcEnd )
throw new IllegalArgumentException( "fcStart (" + fcStart
+ ") > fcEnd (" + fcEnd + ")" );
}
/**