Issue Details (XML | Word | Printable)

Key: JDO-85
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Michelle Caisse
Reporter: Michelle Caisse
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JDO

NullPointerException in TestFieldsOfObject

Created: 14/Jul/05 06:01 AM   Updated: 23/Apr/06 02:38 AM
Component/s: tck2
Affects Version/s: None
Fix Version/s: JDO 2 beta

Time Tracking:
Not Specified

Resolution Date: 23/Apr/06 02:38 AM


 Description  « Hide
 test(org.apache.jdo.tck.models.fieldtypes.TestFieldsOfObject)java.lang.NullPointerException
at org.apache.jdo.tck.models.fieldtypes.TestFieldsOfObject.checkValues(TestFieldsOfObject.java:132)
at org.apache.jdo.tck.models.fieldtypes.TestFieldsOfObject.runTest(TestFieldsOfObject.java:99)
at org.apache.jdo.tck.models.fieldtypes.TestFieldsOfObject.test(TestFieldsOfObject.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:203)
at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:128)
at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:106)

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Craig Russell added a comment - 16/Jul/05 04:33 AM
This appears to be incorrect mapping.

Michelle Caisse added a comment - 20/Jul/05 05:10 AM
I fixed the mapping problem (revision 21976), but the error persists. This appears to be a JPOX problem. After clearing the cache, the values of some fields are null. The error message is changed because of improvements to TestFieldsOfObject checked in by Craig.

[java] 1) test(org.apache.jdo.tck.models.fieldtypes.TestFieldsOfObject)junit.framework.AssertionFailedError
[java] Field private Object Object0 is null. Expected Hello.
[java] Field private volatile Object Object16 is null. Expected Hello.
[java] Field public Object Object36 is null. Expected Hello.
[java] Field public volatile Object Object52 is null. Expected Hello.
[java] Field protected Object Object72 is null. Expected Hello.
[java] Field protected volatile Object Object88 is null. Expected Hello.
[java] Field Object Object108 is null. Expected Hello.
[java] Field volatile Object Object124 is null. Expected Hello.
[java]
[java] at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:537)
[java] at org.apache.jdo.tck.models.fieldtypes.TestFieldsOfObject.checkValues(TestFieldsOfObject.java:
[java] at org.apache.jdo.tck.models.fieldtypes.TestFieldsOfObject.runTest(TestFieldsOfObject.java:99)
[java] at org.apache.jdo.tck.models.fieldtypes.TestFieldsOfObject.test(TestFieldsOfObject.java:68)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:197)
[java] at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:128)
[java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:106)
[java] FAILURES!!!

Andy Jefferson added a comment - 24/Jul/05 03:49 AM
Maybe I'm missing something about this test, but I look at Object0, Object16, etc and I see that the field is an Object, and in the metadata there is nothing to define the persistence-modifier as "persistent" so they will revert to the default value of "persistence-modifier" as per JDO 2 spec 18.13, which has to be "none" since java.lang.Object doesnt appear in the list of persistent field types. This means that it will not be persisted and hence *will* be null when read back in. So the FieldsOfObject.isPersistent is incorrect ?

Craig Russell added a comment - 27/Jul/05 12:20 AM
You are not missing anything. The test is incorrect. It has been incorrect from the JDO 1 TCK. Funny no one noticed it earlier.

The fields that are missing are indeed defaulted to persistence-modifier="none". But the test expects the fields to default to "persistent".

The test case needs to be changed to identify these fields as not persistent.

Michelle Caisse added a comment - 27/Jul/05 06:18 AM
Index: test/java/org/apache/jdo/tck/pc/fieldtypes/FieldsOfObject.java
===================================================================
--- test/java/org/apache/jdo/tck/pc/fieldtypes/FieldsOfObject.java (revision 225197)
+++ test/java/org/apache/jdo/tck/pc/fieldtypes/FieldsOfObject.java (working copy)
@@ -166,19 +166,19 @@
   static transient volatile Object Object143;

 public static final boolean [] isPersistent = {
-true,true,true,false,true,true,true,false,false,false,
-false,true,true,true,false,false,true,true,true,false,
+false,true,true,false,true,true,true,false,false,false,
+false,true,true,true,false,false,false,true,true,false,
 true,true,true,false,false,false,false,false,false,false,
-true,true,true,false,false,false,true,true,true,false,
+true,true,true,false,false,false,false,true,true,false,
 true,true,true,false,false,false,false,true,true,true,
-false,false,true,true,true,false,true,true,true,false,
+false,false,false,true,true,false,true,true,true,false,
 false,false,false,false,false,false,true,true,true,false,
-false,false,true,true,true,false,true,true,true,false,
-false,false,false,true,true,true,false,false,true,true,
+false,false,false,true,true,false,true,true,true,false,
+false,false,false,true,true,true,false,false,false,true,
 true,false,true,true,true,false,false,false,false,false,
-false,false,true,true,true,false,false,false,true,true,
+false,false,true,true,true,false,false,false,false,true,
 true,false,true,true,true,false,false,false,false,true,
-true,true,false,false,true,true,true,false,true,true,
+true,true,false,false,false,true,true,false,true,true,
 true,false,false,false,false,false,false,false,true,true,
 true,false,false,false
  };

Michael Bouschen added a comment - 23/Apr/06 02:35 AM
Reopened to set the Fix Version/s field to JDO 2 beta.