jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix Meschberger (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1142) ocm fails with NPE when a ClassDescriptor isn't found
Date Fri, 21 Sep 2007 15:30:50 GMT

    [ https://issues.apache.org/jira/browse/JCR-1142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12529469

Felix Meschberger commented on JCR-1142:

Edgar reported this presumably due to his testing Sling and not being able to get the DefaultContent
mapping for the root node. It seems that this method looks after the strategy of the node
type and then after a class descriptor given the node type or dscriminator accordingly.

In the latter case, an exception is thrown if no discriminator property is available, while
it former case a NullPointerException might be thrown if there is no class descriptor for
the node type.

Assuming from the method that I give the actual class I expect the returned object to be a
member of it is somewhat strange to have another class resolution step. Still, this step probably
makes sense if the mapper would be able to resolve to a more appropriate class mapping, yet
this mapping should actually be assignment compatible to the class given as a parameter, otherwise
unexpected behaviour may occurr.

I suggest to fix this method as follows: try to resolve a class descriptor from the discriminator
if available or from the node type. If such a descriptor can be found and the described class
is the same or extends the request class, the new descriptor is taken. Otherwise the descriptor
for the requested class is taken.

> ocm fails with NPE when a ClassDescriptor isn't found
> -----------------------------------------------------
>                 Key: JCR-1142
>                 URL: https://issues.apache.org/jira/browse/JCR-1142
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jcr-mapping
>            Reporter: Edgar Poce
>            Priority: Minor
> ObjectConverterImpl#getObject(Session session, Class clazz, String path) should validate
whether there's a suitable mapping in order to throw a more descriptive exception as ObjectConverterImpl#getObject(Session
session, String path) does.

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

View raw message