You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/04/03 16:33:57 UTC
svn commit: r761695 -
/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
Author: jukka
Date: Fri Apr 3 14:33:57 2009
New Revision: 761695
URL: http://svn.apache.org/viewvc?rev=761695&view=rev
Log:
JCRRMI-15: Property.getNode() should throw ValueFormatException on non-UUID values
This fixes 6 TCK test failures.
Modified:
jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java?rev=761695&r1=761694&r2=761695&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java Fri Apr 3 14:33:57 2009
@@ -20,12 +20,15 @@
import java.rmi.RemoteException;
import java.util.Calendar;
+import javax.jcr.ItemNotFoundException;
import javax.jcr.ItemVisitor;
import javax.jcr.Node;
import javax.jcr.Property;
+import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
import javax.jcr.nodetype.PropertyDefinition;
import org.apache.jackrabbit.rmi.remote.RemoteProperty;
@@ -286,7 +289,18 @@
* {@inheritDoc}
*/
public Node getNode() throws RepositoryException {
- return getSession().getNodeByUUID(getString());
+ String uuid = getString();
+ try {
+ return getSession().getNodeByUUID(uuid);
+ } catch (RepositoryException e) {
+ // JCRRMI-15: Throw ValueFormatException where appropriate
+ if (e instanceof ItemNotFoundException
+ || getType() == PropertyType.REFERENCE) {
+ throw e;
+ } else {
+ throw new ValueFormatException("Invalid UUID: " + uuid, e);
+ }
+ }
}
/** {@inheritDoc} */