in the write() method it should be ok. I tested this (with CloneImportExport) and it worked fine. Of course
the "true" (and maybe the "1"?) value could be changed.
I think the last commit just forgot that, small issue.
Bye
java.lang.RuntimeException: java.lang.NullPointerException
at com.jme.util.CloneImportExport.load(CloneImportExport.java:251)
at com.jme.util.CloneImportExport.loadClone(CloneImportExport.java:304)
...
If Ilook at line 251 in CloneImportExport and insert e.printStackTrace(); before the RTE is thrown,
I get this:
java.lang.NullPointerException
at com.jme.util.CloneImportExport$CloneCapsule.readBoolean(CloneImportExport.java:820)
at com.jme.scene.Spatial.read(Spatial.java:1124)
at com.jme.scene.Node.read(Node.java:682)
at com.jme.util.CloneImportExport.load(CloneImportExport.java:246)
at com.jme.util.CloneImportExport.loadClone(CloneImportExport.java:305)
...
I inserted System.out.println(name); in line 819 at CloneImportExport in the readBoolean() method. As I
try again, the last printout before the exception is "isCollidable". So obviously it is trying to read it, but it's
never writen? When I write isCollidable in Spatial.write(), this does not happen anymore.
I honestly do not understand what you did with the whole savable-spatial-thing, but this needs to be fixed
somehow ^^.
I hope it's clear how my bug-hunting worked ;)
Bye
Wasserleiche
Ok. Thanks for the details.
Looks like there's a bug in CloneImportExport$CloneCapsule. The indicated method (CloneImportExport$CloneCapsule.readBoolean) should never throw NPE regardless of input.
Are you using X3dToJme? That seems to be the only class that uses the CloneImportExport class. If yes, then I'll try to reproduce with the simpleScene.x3d file in the code base. If I can't, could you upload a model file that exhibits the problem to somewhere I can get it?
The reported line number doesn't make sense with the contents of CloneImportExport.java. Could you please revert the contents of that file to match svn HEAD, rebuild, reproduce the problem, and post that stack trace?
It might have something to do with my model-loading-methods in ModelImporter (at my project). Maybe
you could take a look there. The whole loading-thing is just glued together so it works somehow, I never
really got into it ^^.
Bye
Wasserleiche
That explains a lot (I mean wrt figuring out how the CloneImportExport class got involved).
I think I see the bug in CloneImportExport$CloneCapsule.readBoolean(). Autoboxing makes these kind of NPEs difficult to recognize. If I post a tiny patch here or PM it to you, could you apply it to the jME HEAD version of CloneImportExport.java and retry?
UPDATE: I went ahead and applied the fix with rev 4649, because even if it does not fix your issue (which it probably will), the coding for supporting the 'defVal' parameter was definitely incomplete.
Thank god, it works now.
But there is another RTE:
01.09.2009 19:22:04 com.jmex.game.DefaultUncaughtExceptionHandler uncaughtException
SCHWERWIEGEND: Main game loop broken by uncaught exception
java.lang.RuntimeException: java.lang.NullPointerException
at com.jme.util.CloneImportExport.load(CloneImportExport.java:252)
...
at com.jme.util.CloneImportExport.load(CloneImportExport.java:247)
... 23 more
This time its readInt(), so maybe it's a similiar issue. Maybe you can also take a look there, since I
have no idea whats going on there ^^.
Thanks for the help, I think all users benefit from this :)
Bye
Wasserleiche
Yes, very likely the same exact problem. I fixed about 12 occurrences of this same oversight in an XMLImporter-related class a few months back. I have to work on my own problems now, but will look into this later on today.