Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NumberFormatException #2

Open
tuchief opened this issue Oct 14, 2016 · 7 comments
Open

java.lang.NumberFormatException #2

tuchief opened this issue Oct 14, 2016 · 7 comments

Comments

@tuchief
Copy link

tuchief commented Oct 14, 2016

Destination folder:C:\Users\Administrator\Documents
parsing demoSvg using 0 configs
java.lang.NumberFormatException: For input string: "30.493C141.45"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1250)
at java.lang.Double.valueOf(Double.java:504)
at com.mxgraph.svg2xml.Shape2Xml.getPathParam(Shape2Xml.java:1478)
at com.mxgraph.svg2xml.Shape2Xml.matrixTransformPathPartMove(Shape2Xml.java:1351)
at com.mxgraph.svg2xml.Shape2Xml.parseMatrixTransformPathPart(Shape2Xml.java:944)
at com.mxgraph.svg2xml.Shape2Xml.matrixTransformPath(Shape2Xml.java:901)
at com.mxgraph.svg2xml.Shape2Xml.parse(Shape2Xml.java:291)
at com.mxgraph.svg2xml.Svg2Xml.(Svg2Xml.java:474)
at com.mxgraph.svg2xml.Svg2XmlGui.actionPerformed(Svg2XmlGui.java:249)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6516)
......
my svg file:
path d="M142.49,30.493C141.45,6.455,94.925,0.499,70.118,0.499 c-23.781,0-70.643,6.674-69.62,29.994c1.04,24.036,46.525,29.992,72.032,29.992C96.651,60.485,143.512,54.053,142.49,30.493z M79.768,55.718c-17.233,1.908-34.803-11.426-36.193-30.697c-1.022-14.042,4.825-18.09,19.31-19.756 c17.219-1.908,34.803,11.184,36.529,30.466C100.436,49.773,94.589,54.294,79.768,55.718z" transform="matrix(0.6056338,0,0,1.033333,32.69718,26.48333)" fill="#000000" stroke="none" stroke-opacity="0"

@egrimate
Copy link
Contributor

For now, put a space in for every path element: "M 142.49,30.493 C 141.45,6.455,94.925,0.499,70.118,0.499 C ...". there will be a fix for this soon.

@egrimate
Copy link
Contributor

It should be ok now. Bounds error that will follow will need more time for fixing. Try to avoid transforms in svg in the meantime. Asa a temporary workaround, in Inkscape, there is a set of options to apply the transforms to each element.

@tuchief
Copy link
Author

tuchief commented Oct 16, 2016

thanks!!!!
I chose the source and target, click start, svg file analysis without error! However, nobody has any builds, nor any errors. why?

@egrimate
Copy link
Contributor

It's a bit unintuitive: in the target destination, the source path structure is recreated, so you probably need to navigate a couple subfolders to find your file. The file is named as the original, but has xml extension. Search for it. If you have source folder c:\folder1 and destination c:\folder2, the file will be c:\folder2\folder1\sourceFileName.xml. This happens because the converter supports multiple file conversions, so it tries to recreate the original folder structure at destination.

@tuchief
Copy link
Author

tuchief commented Oct 17, 2016

Thank you, I found it, because I chose the source file on the desktop, address: C: \ Users \ Administrator \ Desktop \ demoSvg.svg, but it generates the address is: C: \ Users \ Administrator \ Documents \ users \ Administrator \ desktop.xml. Now, I use mxGraph to read the xml to draw, do not come out, I found that the contents of the xml file structure and can be drawn to the structure of the xml inconsistent.

@tinder-haroldmartin
Copy link

@tuchief do you still have this issue?

@jaywarfield
Copy link

jaywarfield commented Jan 8, 2021

I'm seeing this exception on about 1 of every 10 svg files in drawio/src/main/webapp/img/lib/ibm when running svg2xml. Normalization doesn't seem to matter but I set it to 64,64. My understanding is that these svg files were redrawn to meet drawio quality standards so I'm not familiar with how they were created. One of the files causing the exception is sensor.svg attached which produces this exception:

parsing sensor using 0 configs
java.lang.NumberFormatException: For input string: "l"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at java.lang.Double.valueOf(Double.java:502)
at com.mxgraph.svg2xml.Shape2Xml.getPathParam(Shape2Xml.java:1564)
at com.mxgraph.svg2xml.Shape2Xml.matrixTransformPathPartCurve(Shape2Xml.java:1261)
at com.mxgraph.svg2xml.Shape2Xml.parseMatrixTransformPathPart(Shape2Xml.java:1024)
at com.mxgraph.svg2xml.Shape2Xml.matrixTransformPath(Shape2Xml.java:972)
at com.mxgraph.svg2xml.Shape2Xml.parse(Shape2Xml.java:351)
at com.mxgraph.svg2xml.Svg2Xml.(Svg2Xml.java:510)
at com.mxgraph.svg2xml.Svg2XmlGui.actionPerformed(Svg2XmlGui.java:253)

sensor.svg.zip

From the previous comments there is a workaround if it applies to my case here. Since we may not have created these svg files I'm not sure how to proceed. Only a few of these svg files are in drawio/src/main/webapp/stencils/ibm.xml that drawio created so the problematic svg files were probably not run through svg2xml previously. We can't change svg/xml files that were already published in drawio but looking at these svg files for future versions with running thru svg2xml. Any help would be appreciated, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants