You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by re...@apache.org on 2001/02/09 04:29:35 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/structure Structure.java StructureImpl.java
remm 01/02/08 19:29:35
Modified: src/share/org/apache/slide/structure Structure.java
StructureImpl.java
Log:
- Fix for a NullPointerException which was occurring when calling
Structure.getParent() on the root node. The call will return null in such a
case.
- Document in the Javadoc that the call will return null when called on the
root node.
Revision Changes Path
1.6 +6 -5 jakarta-slide/src/share/org/apache/slide/structure/Structure.java
Index: Structure.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/Structure.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Structure.java 2000/11/25 01:34:55 1.5
+++ Structure.java 2001/02/09 03:29:35 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/Structure.java,v 1.5 2000/11/25 01:34:55 remm Exp $
- * $Revision: 1.5 $
- * $Date: 2000/11/25 01:34:55 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/Structure.java,v 1.6 2001/02/09 03:29:35 remm Exp $
+ * $Revision: 1.6 $
+ * $Date: 2001/02/09 03:29:35 $
*
* ====================================================================
*
@@ -78,7 +78,7 @@
* Structure helper.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public interface Structure {
@@ -107,7 +107,8 @@
*
* @param token Credentials token
* @param object Slide object
- * @return ObjectNode Object's parent
+ * @return ObjectNode Object's parent; null if the object specified
+ * if the root node of the namespace
* @exception ServiceAccessException Low level service access exception
* @exception ObjectNotFoundException The parent object specified
* by the object was not found
1.13 +13 -9 jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java
Index: StructureImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- StructureImpl.java 2001/01/23 17:26:55 1.12
+++ StructureImpl.java 2001/02/09 03:29:35 1.13
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java,v 1.12 2001/01/23 17:26:55 juergen Exp $
- * $Revision: 1.12 $
- * $Date: 2001/01/23 17:26:55 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java,v 1.13 2001/02/09 03:29:35 remm Exp $
+ * $Revision: 1.13 $
+ * $Date: 2001/02/09 03:29:35 $
*
* ====================================================================
*
@@ -78,7 +78,7 @@
* Data helper class.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
public final class StructureImpl implements Structure {
@@ -165,7 +165,8 @@
*
* @param token Credentials token
* @param object Slide object
- * @return ObjectNode Object's parent
+ * @return ObjectNode Object's parent; null if the object specified
+ * if the root node of the namespace
* @exception ServiceAccessException Low level service access exception
* @exception ObjectNotFoundException The parent object specified by
* the object was not found
@@ -177,10 +178,13 @@
public ObjectNode getParent(SlideToken token, ObjectNode object)
throws ServiceAccessException, ObjectNotFoundException,
LinkedObjectNotFoundException, AccessDeniedException {
- String objectUri = object.getUri();
- String parentUri = namespace.getUri(objectUri)
- .getParentUri().toString();
- ObjectNode parent = retrieve(token, parentUri);
+ String objectUriStr = object.getUri();
+ Uri parentUri = namespace.getUri(objectUriStr).getParentUri();
+ if (parentUri == null) {
+ return null;
+ }
+ String parentUriStr = parentUri.toString();
+ ObjectNode parent = retrieve(token, parentUriStr);
return parent;
}