You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Sebastian Prehn (JIRA)" <ji...@apache.org> on 2010/05/30 19:18:37 UTC

[jira] Created: (OCM-44) getObjectByUuid throws exception instead of returning null as described in javadoc

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



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


[jira] Updated: (OCM-44) getObjectByUuid throws exception instead of returning null as described in javadoc

Posted by "Sebastian Prehn (JIRA)" <ji...@apache.org>.
     [ 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.