Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
JDO 2 maintenance release 2 (2.2)
-
None
Description
A couple of test configurations fail with a NPE when running the tck in debug mode, e.g.:
[java] Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.apache.jdo.tck.pc.companyMapWithoutJoin.ICompany org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyFactoryAbstractImpl.newCompany(long,java.lang.String,java.util.Date)] threw exception; nested exception is java.lang.NullPointerException
[java] Caused by: java.lang.NullPointerException
[java] at java.util.Calendar.setTime(Calendar.java:1037)
[java] at java.text.SimpleDateFormat.format(SimpleDateFormat.java:803)
[java] at java.text.SimpleDateFormat.format(SimpleDateFormat.java:796)
[java] at java.text.DateFormat.format(DateFormat.java:314)
[java] at org.apache.jdo.tck.pc.companyMapWithoutJoin.Company.getFieldRepr(Company.java:177)
[java] at org.apache.jdo.tck.pc.companyMapWithoutJoin.Company.toString(Company.java:166)
[java] at java.lang.String.valueOf(String.java:2615)
[java] at java.lang.StringBuilder.append(StringBuilder.java:116)
[java] at org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyFactoryAbstractImpl.newCompany(CompanyFactoryAbstractImpl.java:55)
When running in debug mode the new Company method prints the created instance, before the field values are initialized. So any date fields are still null and the code in getRepr runs into the NPE for a null date field.
To enable the debug mode, replace line
log4j.logger.org.apache.jdo.tck = INFO, TCK
by
log4j.logger.org.apache.jdo.tck = DEBUG, TCK
in file src/conf/log4j.properties.