Loading Camera xml crashes

Hi!



Well this is a xml Camera saved file, that when I try to load it crashes.

I always have to add this to Camera.java, when I update weekly with nightly builds:

public Camera(){this(100,100);}

otherwise I cannot load its data.



Is this a bug or I should load this Savable in another way?



thx!

mhhh what’s the Exception?

it seems to require a default empty constructor available.



the exception:

[patch]

SEVERE: Could not access constructor of class ‘com.jme3.renderer.Camera’!

Some types need to have the BinaryImporter set up in a special way. Please doublecheck the setup.

java.io.IOException: java.lang.InstantiationException: com.jme3.renderer.Camera

at com.jme3.export.xml.DOMInputCapsule.readSavable(DOMInputCapsule.java:950)

at com.jme3.export.xml.XMLImporter.load(XMLImporter.java:82)



Caused by: java.lang.InstantiationException: com.jme3.renderer.Camera

at java.lang.Class.newInstance0(Class.java:357)

at java.lang.Class.newInstance(Class.java:325)

at com.jme3.export.binary.BinaryClassLoader.fromName(BinaryClassLoader.java:67)

at com.jme3.export.xml.DOMInputCapsule.readSavableFromCurrentElem(DOMInputCapsule.java:976)

at com.jme3.export.xml.DOMInputCapsule.readSavable(DOMInputCapsule.java:941)

… 8 more

[/patch]



i try to load it with:

[patch]

FileInputStream fis = null;

fis = new FileInputStream(new File(strPath+"/"+strFile));

XMLImporter imp = XMLImporter.getInstance();

imp.setAssetManager(getAssetManager());

Object obj = imp.load(new BufferedInputStream(fis));

return obj;

[/patch]



but it only works if I add the empty constructor.

Yes, every savable need an empty constructor…the question would be : why doesn’t Camera have one…

Gonna fix that

fixed in last svn , could you check everything is ok?

I got a new crash, I tried to find the reason but didnt understand…



[patch]

java.io.IOException: java.lang.NullPointerException

at com.jme3.export.xml.DOMInputCapsule.readSavable(DOMInputCapsule.java:950)

at com.jme3.export.xml.XMLImporter.load(XMLImporter.java:82)

at output.SaveData.loadXML(SaveData.java:128)

at main.Main.camLoad(Main.java:438)

at main.Main.simpleInitApp(Main.java:348)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:223)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:123)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:199)

at java.lang.Thread.run(Thread.java:636)

Caused by: java.lang.NullPointerException

at com.jme3.renderer.Camera.onFrameChange(Camera.java:1179)

at com.jme3.renderer.Camera.onFrustumChange(Camera.java:1165)

at com.jme3.renderer.Camera.read(Camera.java:1384)

at com.jme3.export.xml.DOMInputCapsule.readSavableFromCurrentElem(DOMInputCapsule.java:981)

at com.jme3.export.xml.DOMInputCapsule.readSavable(DOMInputCapsule.java:941)

… 8 more[/patch]



I replaced it again with:

public Camera(){this(100,100);}

and it worked.

I think it may need some var initializations?



PS.: I got the latest SVN, cool, didnt know it was so easy to setup on eclipse, just copied the “engine” path to workspace! my monocore freezes with the SDK alpha :frowning:

mhhh, yes it might need some init done in the constructor that is not done in the read method, I’ll check that

Should be fixed in last SVN

worked thx!