You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by dv...@apache.org on 2007/03/25 19:39:20 UTC
svn commit: r522311 -
/xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java
Author: dvholten
Date: Sun Mar 25 10:39:19 2007
New Revision: 522311
URL: http://svn.apache.org/viewvc?view=rev&rev=522311
Log:
fix bug 41688. we convert to long. then we test, if it fits in an int. if not, we convert to float.
Modified:
xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java?view=diff&rev=522311&r1=522310&r2=522311
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/parser/Parser.java Sun Mar 25 10:39:19 2007
@@ -948,9 +948,17 @@
case LexicalUnits.INTEGER:
String sval = scanner.getStringValue();
if (!plus) sval = "-"+sval;
- int val = Integer.parseInt(sval);
- nextIgnoreSpaces();
- return CSSLexicalUnit.createInteger(val, prev);
+
+ long lVal = Long.parseLong( sval ); // fix #41288
+ if ( lVal >= Integer.MIN_VALUE && lVal <= Integer.MAX_VALUE ){
+ // we can safely convert to int
+ int iVal = (int) lVal;
+ nextIgnoreSpaces();
+ return CSSLexicalUnit.createInteger( iVal, prev);
+ }
+
+ // we are too large for an int: convert to float
+ // we can just fall-through to the float-handling ...
case LexicalUnits.REAL:
return CSSLexicalUnit.createFloat(LexicalUnit.SAC_REAL,
number(plus), prev);