[
https://issues.apache.org/jira/browse/OCM-44?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ard Schrijvers resolved OCM-44.
-------------------------------
Resolution: Won't Fix
Assignee: Ard Schrijvers
it returns null of does not exist, an exception if some other problem occurs
> getObjectByUuid throws exception instead of returning null as described in
> javadoc
> ----------------------------------------------------------------------------------
>
> Key: OCM-44
> URL: https://issues.apache.org/jira/browse/OCM-44
> Project: Jackrabbit OCM
> Issue Type: Bug
> Environment: jackrabbit-ocm 1.5.3
> jackrabbit 2.0
> any os
> Reporter: Sebastian Prehn
> Assignee: Ard Schrijvers
>
> javadoc of
> ObjectContentManager
> public Object getObjectByUuid(String uuid)
> sais that the method will return the object found or null.
> So I expected null as return value when no object with the provided id can be
> found.
> This behavior fits the behavior of other methods, such as getObject(String
> path).
> Instead I receive a RuntimeException with a wrapped ItemNotFoundException.
> By looking at the implementation in ObjectContentManagerImpl
> public Object getObjectByUuid(String uuid) {
> try {
> Node node = session.getNodeByUUID(uuid);
> Object object = objectConverter.getObject(session,
> node.getPath());
> requestObjectCache.clear();
> return object;
> } catch (RepositoryException e) {
> throw new
> org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to get
> the object with uuid : " + uuid, e);
> }
> }
> it becomes clear that the ItemNotFoundException is not caught individually.
> Btw: javadoc on this methods is in sync with the code.
> I suggest either returning null or making the javadoc more precise on method
> ObjectContentManager getObjectByUuid(String uuid)
> best regards
> Sebastian
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira