NPE calling POJO setter for primitive arrayin OObjectEntitySerializer #1391

Closed
zerovian opened this Issue Mar 11, 2013 · 1 comment

Comments

Projects
None yet
2 participants

orientdb 1.3.0

When calling the setter for a field that is a primitive array, an NPE is thrown.

Test class:

public class ArrayWrapper {

private long[] data;

@Test
public void testSave() {
    OObjectDatabaseTx db = new OObjectDatabaseTx("local:c:\\temp\\orientdb\\test");
    db.create();
    db.getEntityManager().registerEntityClass(ArrayWrapper.class);
    ArrayWrapper newInstance = db.newInstance(ArrayWrapper.class);
    newInstance.setData(new long[10]);
    db.close();
    OObjectIteratorClass<ArrayWrapper> browseClass = db.browseClass(ArrayWrapper.class);
    for (ArrayWrapper arrayWrapper : browseClass) {
        System.out.println(arrayWrapper.getData());
    }

}

public long[] getData() {
    return data;
}

public void setData(long[] data) {
    this.data = data;
}

}

Stack Trace:

java.lang.NullPointerException
at com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.typeToStream(OObjectEntitySerializer.java:668)
at com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler.setValue(OObjectProxyMethodHandler.java:704)
at com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler.manageSetMethod(OObjectProxyMethodHandler.java:643)
at com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler.invoke(OObjectProxyMethodHandler.java:109)
at fathom.test.ArrayWrapper_$$javassist_0.setData(ArrayWrapper$$_javassist_0.java)
at fathom.test.ArrayWrapper.testSave(ArrayWrapper.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

@ghost ghost assigned MaDaPHaKa Mar 11, 2013

Contributor

MaDaPHaKa commented Jul 17, 2013

Fixed in 1.4.2-SNAPSHOT commit 91c8545

@MaDaPHaKa MaDaPHaKa closed this Jul 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment