[Bug] Very strange behaviour in 0.5.2

Anything related to a beta release of JPatch: Bugs, enhancements, general discussion...

[Bug] Very strange behaviour in 0.5.2

Postby Torf » Sat Feb 25, 2006 6:23 pm

Wow, this is definitely getting weird here. I had some kind of lock-up several times now, something that happened while computing patches or adding hooks (or so it seemed): The bird's view viewport froze, it did neither repaint nor react to mouse clicks. Recomputing the patches or a hide patches/show patches combo usually solved it. But not the last time, so I saved the model and just wanted to reopen it after restarting JPatch. But now I get a wonderful
Code: Select all
points
patch
points
patch
points
patch
points
-1
java.lang.ArrayIndexOutOfBoundsException: -1
        at java.util.ArrayList.get(ArrayList.java:323)
        at jpatch.control.importer.JPatchImport.endElement(JPatchImport.java:361)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endEleme
nt(AbstractSAXParser.java:633)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scan
EndElement(XMLNSDocumentScannerImpl.java:719)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:834)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:764)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.
java:148)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab
stractSAXParser.java:1242)
        at jpatch.control.importer.JPatchImport.importModel(JPatchImport.java:86
)
        at jpatch.boundary.action.ImportJPatchAction.load(ImportJPatchAction.jav
a:98)
        at jpatch.boundary.action.ImportJPatchAction.actionPerformed(ImportJPatc
hAction.java:49)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
49)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:234)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:2
31)
        at java.awt.Component.processMouseEvent(Component.java:5488)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
        at java.awt.Component.processEvent(Component.java:5253)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3955)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
(Some more caller hierarchy here)

The model file looks sane, though. I've attached it nevertheless.

Unfortunately I didn't start JPatch from the console all the time, so I missed any error message spit out during the lockups. I think it would be a good idea to at least display exceptions which aren't caught otherwise to the user in a dialog. If you need more information, just ask. I'm going to dig into a bit, too. After diner, that is :P
Attachments
gecko.zip
(14.02 KiB) Downloaded 235 times
Torf
 
Posts: 155
Joined: Mon Nov 08, 2004 8:45 pm
Location: Germany/Konstanz

Postby sascha » Sun Feb 26, 2006 7:55 am

There are still some bugs in JPatch0.5 (the entire code in the jpatch.control.edit package as been rewritten between 0.4 and 0.5!).

It looks like a point from a five-point patch has been deleted, but JPatch failed to delete the five-point patch itself. If you open the file in a text-editor, search for a patch with a "-1" in its <points></points> section. You should be able to recover by manually deleting this patch from the file.

I guess the bug is releted to the Remove or Delete edits, but I'll have to look into it.
I think it would be a good idea to at least display exceptions which aren't caught otherwise to the user in a dialog.

Agreed. For stable releases it would also be a nice option to automatically (with the user's permission) sumbit those bug-reports to the JPatch homepage and store them in a database...
sascha
Site Admin
 
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria

Postby Torf » Sun Feb 26, 2006 10:32 am

sascha wrote:It looks like a point from a five-point patch has been deleted, but JPatch failed to delete the five-point patch itself. If you open the file in a text-editor, search for a patch with a "-1" in its <points></points> section. You should be able to recover by manually deleting this patch from the file.

Yep, removing two invalid patches gave me my file back. Wonderful! Today is cleaning day, so I'm not sure whether I'll have time to dig into that clone-issue, but we'll see.
Torf
 
Posts: 155
Joined: Mon Nov 08, 2004 8:45 pm
Location: Germany/Konstanz

Postby sascha » Sun Feb 26, 2006 11:24 am

Don't trust the "Edit..." classes. Even if they do what they're designed to do, I can't rule out design errors. Just think about what a (seemingly) simple operation like "delete" does: Let's say there's a spline with only two controlpoints - if one of them is deleted, the other has to be deleted as well, and the curve has to be removed from the model. Other cp's that were attached to these cps have to be detached, and patches containing the cps have to be removed. If there was a hook on the segment, it has to be removed as well.
If any of the deleted cps was part of a selection, it has to be removed from the selection. The same is true for morphs.
Etc, etc, etc...

It was quite difficult to devide all this into "atomic edits" and ensure that all modifications are applied in the right order (and none of them twice), and I wouldn't be surprised if there are some errors in the design of the "Edits" (not even talking about implementation errors).

That's the main reason why I started making the flow-charts for all edits. Unfortunately they're a bit "out of sync" right now, but it's on my todo list to have the flowcharts reflect what the edits do again. This way it's easier to separate logical errors (if the algorithms don't work) from implementation errors (if the code doesn't do what the flowchart shows).

The old edits in JPatch0.4 seemed to work fine, but as they grew with JPatch there was a point where adding new features was virually impossible, so I had to redesign (and document) them.

Btw, Torf, do you have a berlios.de account? I'd like to grant CVS write access to you, this way you can directly add your changes to the CVS. Don't worry - the only "rule" is that the CVS code should compile without errors (but I already broke that rule several times), and that JPatch should (more or less) be useable - i.e. other features shouldn't be affected by the changed ones.
All this wasn't important when I was the only one who worked on the source, but I think it is as soon as two people work on it.
But still you should commit as soon as possible to prevent CVS conflicts.
sascha
Site Admin
 
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria

Postby Torf » Sun Feb 26, 2006 12:28 pm

I think the edits are a very good idea and I do think that they can be made to work without bugs. But bug-hunting requires serious knowledge of the inner workings of the code, something I haven't got, yet. But I'm sure I'll get there.

I do have a BerliOS account, which is named - who would've thought it? - torf. And I'm not really afraid of breaking stuff, either, because with CVS it would be easy to make it work again :wink:
Torf
 
Posts: 155
Joined: Mon Nov 08, 2004 8:45 pm
Location: Germany/Konstanz

Postby sascha » Sun Feb 26, 2006 8:19 pm

I think the edits are a very good idea...

Yes, it was the only way I could imagine when thinking about undo/redo support (when I added it to JPatch 0.1) and it seems to be common practive (swing has a quite similar undo support, and IIRC it's also used in the "Command" design pattern).

...and I do think that they can be made to work without bugs.

I certainly hope so :)

But bug-hunting requires serious knowledge of the inner workings of the code, something I haven't got, yet.

Don't worry, I wasn't going to ask you to find and fix all the bugs :wink:
But I really appreciate your help with JPatch development!

I do have a BerliOS account, which is named - who would've thought it? - torf. And I'm not really afraid of breaking stuff, either, because with CVS it would be easy to make it work again

Cool. I've added you as a developer, you should have write access to the CVS (which only works using ssh).
sascha
Site Admin
 
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria


Return to Beta

Who is online

Users browsing this forum: No registered users and 3 guests

cron