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

Craig Russell updated JDO-581:
------------------------------

    Summary: Undecipherable error message from JPOX when value of configuration 
map is null  (was: Jdoconfig tests fail on tck2-legacy)

The error turned out to be in the maven.xml not passing the property into the 
test case, resulting in a Map with a key of "javax.jdo.option.Mapping" and a 
value of null.

This causes a ClassCastException from JPOX.

I suggest that the algorithm in protected void setOptions(Map props) should 
test the result of the PROPERTY_SETTERS.get(key) to decide what type it is, 
rather than the actual value in the Map. Otherwise, a user error results in 
ClassCastException instead of a useful message.

> Undecipherable error message from JPOX when value of configuration map is null
> ------------------------------------------------------------------------------
>
>                 Key: JDO-581
>                 URL: https://issues.apache.org/jira/browse/JDO-581
>             Project: JDO
>          Issue Type: Bug
>          Components: tck2-legacy
>            Reporter: Craig Russell
>            Assignee: Andy Jefferson
>             Fix For: JDO 2 maintenance release 1
>
>
> I've ported the JDOHelper changes from api2 to api2-legacy and the tests from 
> tck2 to tck2-lecacy.
> Everything works fine except for the tck2-legacy Jdoconfig override tests. 
> All tests fail with 
>     [java] RUN Jdoconfig.testGetPMFEmptyStringOverrides          ERROR
>     [java] RUN Jdoconfig.testGetPMFNullOverrides         ERROR
>     [java] RUN Jdoconfig.testGetPMFStringSpaceOverrides          ERROR
>     [java] RUN Jdoconfig.testGetPMFNamedOverrides        ERROR
>     [java] RUN Jdoconfig.testGetPMFNamedSpacesOverrides          ERROR
>     [java] 1) 
> testGetPMFEmptyStringOverrides(org.apache.jdo.tck.api.persistencemanagerfactory.config.Jdoconfig)javax.jdo.JDOFatalInternalException:
>  Unexpected exception caught.
>     [java]    at 
> javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1024)
>     [java]    at 
> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:714)
>     [java]    at 
> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:967)
>     [java]    at 
> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:836)
>     [java]    at 
> org.apache.jdo.tck.api.persistencemanagerfactory.config.Jdoconfig.testGetPMFEmptyStringOverrides(Jdoconfig.java:115)
>     [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:259)
>     [java]    at 
> org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
>     [java]    at 
> org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
>     [java]    at 
> org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)
>     [java] NestedThrowablesStackTrace:
>     [java] java.lang.reflect.InvocationTargetException
>     [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 javax.jdo.JDOHelper$16.run(JDOHelper.java:1763)
>     [java]    at java.security.AccessController.doPrivileged(Native Method)
>     [java]    at javax.jdo.JDOHelper.invoke(JDOHelper.java:1758)
>     [java]    at 
> javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1002)
>     [java]    at 
> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:714)
>     [java]    at 
> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:967)
>     [java]    at 
> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:836)
>     [java]    at 
> org.apache.jdo.tck.api.persistencemanagerfactory.config.Jdoconfig.testGetPMFEmptyStringOverrides(Jdoconfig.java:115)
>     [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:259)
>     [java]    at 
> org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
>     [java]    at 
> org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
>     [java]    at 
> org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)
> ==> ClassCastException??? <===
>     [java] Caused by: java.lang.ClassCastException: 
> org.jpox.PersistenceConfiguration$20
>     [java]    at 
> org.jpox.PersistenceConfiguration.setOptions(PersistenceConfiguration.java:4658)
>     [java]    at 
> org.jpox.jdo.JDOPersistenceManagerFactory.setPMFOptions(JDOPersistenceManagerFactory.java:381)
>     [java]    at 
> org.jpox.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:188)
>     [java]    ... 30 more
> It looks from the stack trace that there is an Object (not a String) in the 
> overrides map, but I just can't find where the error lies. I'm pretty sure 
> it's a bonehead mistake I made while porting the changes from tck2 or api2 to 
> legacy, but I just can't see it.

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

Reply via email to