Bug 1561 : "shape command not handled" on svg path load
Last modified: 2010-06-05 03:09




Status:
ASSIGNED
Resolution:
-
Priority:
P2
Severity:
normal

 

Reporter:
DaveAttacks
Assigned To:
fry

Attachment Type Created Size Actions
Archived sketch to reproduce error. application/zip 2010-05-10 02:19 799 bytes

Description:   Opened: 2010-05-10 02:18
This may be related to http://dev.processing.org/bugs/show_bug.cgi?id=1408

I try to load a simple SVG path:

<?xml version="1.0"?>
<svg xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" version="1.1" id="Layer_1" x="0px"
y="0px" width="768px" height="576px">
<path stroke-miterlimit="10" d="m 189.964,429.204 c 6.887,-0.87
18.044,1.501 41.592,-5.37 23.563,-6.87"
style="stroke:#000000;stroke-width:5;"/>
</svg>

...and get the error below.

0-May-2010 09:55:08 com.sun.corba.se.impl.ior.IORImpl getProfile
WARNING: "IOP00511201: (INV_OBJREF) IOR must have at least one IIOP profile"
org.omg.CORBA.INV_OBJREF: vmcid: SUN minor code: 1201 completed: No
at
com.sun.corba.se.impl.logging.IORSystemException.iorMustHaveIiopProfile(IORSystemException.java:473)
at
com.sun.corba.se.impl.logging.IORSystemException.iorMustHaveIiopProfile(IORSystemException.java:495)
at com.sun.corba.se.impl.ior.IORImpl.getProfile(IORImpl.java:334)
at
com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_Object(CDRInputStream_1_0.java:787)
at
com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_Object(CDRInputStream_1_0.java:761)
at
com.sun.corba.se.impl.encoding.CDRInputStream.read_Object(CDRInputStream.java:231)
at
com.sun.corba.se.impl.resolver.INSURLOperationImpl.getIORFromString(INSURLOperationImpl.java:120)
at
com.sun.corba.se.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:130)
at com.sun.corba.se.impl.orb.ORBImpl.string_to_object(ORBImpl.java:836)
at org.GNOME.Accessibility.AccessUtil.getRegistryObject(AccessUtil.java:143)
at
org.GNOME.Accessibility.JavaBridge.registerApplication(JavaBridge.java:1147)
at org.GNOME.Accessibility.JavaBridge.<init>(JavaBridge.java:398)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:786)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:875)
at processing.core.PApplet.<clinit>(Unknown Source)
parsed: m,189.964,429.204,c,6.887,-0.87,18.044,1.501,41.592,-5.37
unparsed: 23.563,-6.87
processing.app.debug.RunnerException: RuntimeException: shape command not
handled: 23.563
at processing.app.Sketch.placeException(Unknown Source)
at processing.app.debug.Runner.findException(Unknown Source)
at processing.app.debug.Runner.reportException(Unknown Source)
at processing.app.debug.Runner.exception(Unknown Source)
at processing.app.debug.EventThread.exceptionEvent(Unknown Source)
at processing.app.debug.EventThread.handleEvent(Unknown Source)
at processing.app.debug.EventThread.run(Unknown Source)
Exception in thread "Animation Thread" java.lang.RuntimeException: shape
command not handled: 23.563
at processing.core.PShapeSVG.parsePath(PShapeSVG.java:694)
at processing.core.PShapeSVG.parseChild(PShapeSVG.java:324)
at processing.core.PShapeSVG.parseChildren(PShapeSVG.java:264)
at processing.core.PShapeSVG.<init>(PShapeSVG.java:254)
at processing.core.PShapeSVG.<init>(PShapeSVG.java:152)
at processing.core.PShapeSVG.<init>(PShapeSVG.java:144)
at processing.core.PApplet.loadShape(Unknown Source)
at shape_bug.setup(shape_bug.java:30)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:636)


This is with Processing version 1.1 on On a dual Xeon PC running Ubuntu 9.10.

$ uname -a
Linux speedwell 2.6.31-21-generic-pae #59-Ubuntu SMP Wed Mar 24 08:47:55
UTC 2010 i686 GNU/Linux
Additional Comment #1 From DaveAttacks 2010-05-10 02:19
edit]
Archived sketch to reproduce error.
Additional Comment #2 From fry 2010-05-11 05:42
this should be fixed by bug #1503, but it's not, so i'll need to take a
look at why it's not working properly.

thanks for the report & example sketch. very helpful.
Additional Comment #3 From DaveAttacks 2010-05-20 09:26
I'm not sure if it is related to implicit commands, as in bug #1503 - if I
add in explicit 'c' commands in all the gaps, the error still occurs.
However, if I put explicit 'm' commands it *does* work, so maybe it's
related to the curveto command?..

Are there any workarounds that might help me avoid the bug in the short
term? I've tried resizing a few times but it didn't seem to make a
difference :-(
Additional Comment #4 From fry 2010-05-20 13:36
so it seems that there's a spare coordinate on the end of the path in that
file. a 'c' element needs three x/y pairs, but this one has four, and
that's the end of the path. in the spec, if there isn't another character
(like 'c') that follows, then it'll assume that there's another 'c'
element, and look for 3 more x/y pairs:

http://www.w3.org/TR/SVG/paths.html

so more recent builds of processing crash with an
ArrayIndexOutOfBoundsException because it tries to parse the curve data.
earlier versions (like the one you're using) complain because it's getting
data that it's not expecting.

adobe illustrator, when opening this file, has a hard crash. (amazing.)

inkscape seems to open it fine, but just ignore the rest of the path data.

bottom line, it looks like you have a malformed svg file, and inkscape
simply tolerates it. (removing the final point of the d="..." path results
in the same visual result.) where did the file originate? do you have any
ideas on how the path could have become truncated like that?
Additional Comment #5 From DaveAttacks 2010-05-21 04:00
The file was a vector image copied from a powerpoint, pasted into
Illustrator CS3, saved as SVG, tweaked in Inkscape, and XSLT-processed to
extract a single path.

However, I actually hand-edited it to try an minimise the test case,
removing coords to the minimum that triggered the error. (And my subsequent
tests are probably nonsense.)

The error did occur before I started editing the path, so I'll go back to
the original to verify it was malformed before I started hacking bits out
:-) Then I'll find out where the weird coords orginate...


Additional Comment #6 From fry 2010-06-05 03:09
do you have a version i can test against or can i close this bug?
This bug is now being tracked here.