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

Sebastian Prehn updated OCM-44:
-------------------------------

    Description: 
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



  was:
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 ObjectContentManagerException 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




> 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
>
> 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.
-
You can reply to this email to add a comment to the issue online.

Reply via email to