You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by bu...@apache.org on 2007/01/04 13:37:17 UTC

DO NOT REPLY [Bug 41288] New: - Parse error for integers >= 2**31 in attributes

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41288>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41288

           Summary: Parse error for integers >= 2**31 in attributes
           Product: Batik
           Version: 1.6
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: CSS
        AssignedTo: batik-dev@xmlgraphics.apache.org
        ReportedBy: x00000000@freenet.de


stroke-width="10000000000" or similar gives a parse error:

***** CSSEngine: exception
property.syntax.error:java.lang.NumberFormatException: For input string:
"10000000000"

AttrValue:10000000000

Exception:java.lang.NumberFormatException
java.lang.NumberFormatException: For input string: "10000000000"
        at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:459)
        at java.lang.Integer.parseInt(Integer.java:497)
        at org.apache.batik.css.parser.Parser.parseTerm(Unknown Source)
        at org.apache.batik.css.parser.Parser.parseExpression(Unknown Source)
        at org.apache.batik.css.parser.Parser.parsePropertyValueInternal(Unknown
Source)
        at org.apache.batik.css.parser.Parser.parsePropertyValue(Unknown Source)
        at org.apache.batik.css.engine.CSSEngine.getCascadedStyleMap(Unknown Source)
        at org.apache.batik.css.engine.CSSEngine.getComputedStyle(Unknown Source)
        at org.apache.batik.bridge.CSSUtilities.getComputedStyle(Unknown Source)
        at org.apache.batik.bridge.CSSUtilities.convertDisplay(Unknown Source)
        at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
        at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
        at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
        at org.apache.batik.swing.svg.GVTTreeBuilder.run(Unknown Source)

There's no problem if a ".0" or "px" is added.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 41288] - Parse error for integers >= 2**31 in attributes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41288>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41288





------- Additional Comments From x00000000@freenet.de  2007-01-04 04:38 -------
Created an attachment (id=19353)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19353&action=view)
testcase


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 41288] - Parse error for integers >= 2**31 in attributes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41288>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41288





------- Additional Comments From x00000000@freenet.de  2007-03-28 06:05 -------
Wouldn't it be possible to just catch the NumberFormatException and reparse
it as a float:

                try {
                    int val = Integer.parseInt(sval);
                    nextIgnoreSpaces();
                    return CSSLexicalUnit.createInteger(val, prev);
                } catch (NumberFormatException e) {
                    // fall through
                }

instead of

                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 ...

(I proposed this in bug 38207 but failed to post it here too.)


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 41288] - Parse error for integers >= 2**31 in attributes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41288>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41288


info@dvholten.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From info@dvholten.de  2007-03-25 10:42 -------
fixed in svn 522311 
hmm - just pushes the limit to 2^61 ..

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org