db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Bouschen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (JDO-640) NPE when running tck in debug mode
Date Fri, 18 Sep 2009 19:17:16 GMT

     [ https://issues.apache.org/jira/browse/JDO-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Michael Bouschen updated JDO-640:

    Attachment: JDO-640.patch

Attached you find a patch for review (JDO-640.patch). 

The NPE is caused by a debug statement in the company factory methods. It prints the newly
created instance before its fields are initialized,  which fails for date fields. The patch
moves the debug statement  at the end of the factory method and changes the print code to
check for date fields being null.

> NPE when running tck in debug mode
> ----------------------------------
>                 Key: JDO-640
>                 URL: https://issues.apache.org/jira/browse/JDO-640
>             Project: JDO
>          Issue Type: Bug
>          Components: tck2
>    Affects Versions: JDO 2 maintenance release 2
>            Reporter: Michael Bouschen
>            Assignee: Michael Bouschen
>             Fix For: JDO 2 maintenance release 3
>         Attachments: JDO-640.patch, TCK-results.txt
> 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.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message