jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1336186 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/ oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/main/java/org/apache...
Date Wed, 09 May 2012 13:21:33 GMT
Author: jukka
Date: Wed May  9 13:21:32 2012
New Revision: 1336186

URL: http://svn.apache.org/viewvc?rev=1336186&view=rev
Log:
OAK-89: Improve exception handling

Improvements by Michael Dürig

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrNameParser.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrPathParser.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrNameParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrNameParser.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrNameParser.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrNameParser.java
Wed May  9 13:21:32 2012
@@ -52,9 +52,9 @@ public class JcrNameParser {
          * Informs this listener about the result of {@link JcrNameParser#parse(String, org.apache.jackrabbit.oak.namepath.JcrNameParser.Listener)}
          *
          * @param name The resulting name upon successful completion of
-         * {@link JcrNameParser#parse(String, org.apache.jackrabbit.oak.namepath.JcrNameParser.Listener)}
+         * {@link org.apache.jackrabbit.oak.namepath.JcrNameParser#parse(String, org.apache.jackrabbit.oak.namepath.JcrNameParser.Listener)}
          */
-        void name(String name);
+        boolean name(String name);
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrPathParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrPathParser.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrPathParser.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/JcrPathParser.java
Wed May  9 13:21:32 2012
@@ -35,13 +35,13 @@ public class JcrPathParser {
 
     private JcrPathParser() {
     }
-    
+
     interface Listener extends JcrNameParser.Listener {
-        void root();
-        void identifier(String identifier);
-        void current();
-        void parent();
-        void index(int index);
+        boolean root();
+        boolean identifier(String identifier);
+        boolean current();
+        boolean parent();
+        boolean index(int index);
     }
 
     public static void parse(String jcrPath, Listener listener) {
@@ -62,7 +62,9 @@ public class JcrPathParser {
         // check if absolute path
         int pos = 0;
         if (jcrPath.charAt(0) == '/') {
-            listener.root();
+            if (!listener.root()) {
+                return;
+            }
             pos++;
         }
 
@@ -113,7 +115,9 @@ public class JcrPathParser {
                         }
 
                         JcrNameParser.parse(name, listener);
-                        listener.index(index);
+                        if (!listener.index(index)) {
+                            return;
+                        }
                         state = STATE_PREFIX_START;
                         lastPos = pos;
                         name = null;
@@ -127,16 +131,22 @@ public class JcrPathParser {
                                 return;
                             }
                             String identifier = jcrPath.substring(lastPos, pos - 2);
-                            listener.identifier(identifier);
+                            if (!listener.identifier(identifier)) {
+                                return;
+                            }
                             state = STATE_PREFIX_START;
                             lastPos = pos;
                         }
                     } else if (state == STATE_DOT) {
-                        listener.current();
+                        if (!listener.current()) {
+                            return;
+                        }
                         lastPos = pos;
                         state = STATE_PREFIX_START;
                     } else if (state == STATE_DOTDOT) {
-                        listener.parent();
+                        if (!listener.parent()) {
+                            return;
+                        }
                         lastPos = pos;
                         state = STATE_PREFIX_START;
                     } else if (state != STATE_URI

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
Wed May  9 13:21:32 2012
@@ -53,6 +53,7 @@ public class NamePathMapperImpl implemen
     @Override
     public String getOakPath(String jcrPath) {
         final List<String> elements = new ArrayList<String>();
+        final StringBuilder parseErrors = new StringBuilder();
 
         if ("/".equals(jcrPath)) {
             // avoid the need to special case the root path later on
@@ -61,64 +62,73 @@ public class NamePathMapperImpl implemen
 
         JcrPathParser.Listener listener = new JcrPathParser.Listener() {
 
-            // TODO: replace RuntimeException by something that oak-jcr can deal with (e.g.
ValueFactory)
-
             @Override
-            public void root() {
+            public boolean root() {
                 if (!elements.isEmpty()) {
-                    throw new RuntimeException("/ on non-empty path");
+                    parseErrors.append("/ on non-empty path");
+                    return false;
                 }
                 elements.add("");
+                return true;
             }
 
             @Override
-            public void identifier(String identifier) {
+            public boolean identifier(String identifier) {
                 if (!elements.isEmpty()) {
-                    throw new RuntimeException("[identifier] on non-empty path");
+                    parseErrors.append("[identifier] on non-empty path");
+                    return false;
                 }
                 elements.add(identifier);  // todo resolve identifier
-                // todo seal
+                // todo seal elements
+                return true;
             }
 
             @Override
-            public void current() {
+            public boolean current() {
                 // nothing to do here
+                return true;
             }
 
             @Override
-            public void parent() {
+            public boolean parent() {
                 if (elements.isEmpty()) {
-                    throw new RuntimeException(".. of empty path");
+                    parseErrors.append(".. of empty path");
+                    return false;
                 }
                 elements.remove(elements.size() - 1);
+                return true;
             }
 
             @Override
-            public void index(int index) {
+            public boolean index(int index) {
                 if (index > 1) {
-                    throw new RuntimeException("index > 1");
+                    parseErrors.append("index > 1");
+                    return false;
                 }
+                return true;
             }
 
             @Override
             public void error(String message) {
-                throw new RuntimeException(message);
+                parseErrors.append(message);
             }
 
             @Override
-            public void name(String name) {
+            public boolean name(String name) {
                 String p = nameMapper.getOakName(name);
                 if (p == null) {
-                    error("Invalid name: " + name);
+                    parseErrors.append("Invalid name: ").append(name);
+                    return false;
                 }
                 elements.add(p);
+                return true;
             }
         };
 
-        try {
-            JcrPathParser.parse(jcrPath, listener);
-        } catch (RuntimeException e) {
-            return null; // TODO Avoid exceptions for control flow
+        JcrPathParser.parse(jcrPath, listener);
+        if (parseErrors.length() != 0) {
+            log.debug("Could not parser path " + jcrPath + ": " + parseErrors.toString());
+            return null;
         }
 
         StringBuilder oakPath = new StringBuilder();
@@ -150,51 +160,57 @@ public class NamePathMapperImpl implemen
 
         JcrPathParser.Listener listener = new JcrPathParser.Listener() {
             @Override
-            public void root() {
+            public boolean root() {
                 if (!elements.isEmpty()) {
-                    throw new RuntimeException("/ on non-empty path");
+                    throw new IllegalArgumentException("/ on non-empty path");
                 }
                 elements.add("");
+                return true;
             }
 
             @Override
-            public void identifier(String identifier) {
+            public boolean identifier(String identifier) {
                 if (!elements.isEmpty()) {
-                    throw new RuntimeException("[identifier] on non-empty path");
+                    throw new IllegalArgumentException("[identifier] on non-empty path");
                 }
                 elements.add(identifier);  // todo resolve identifier
-                // todo seal
+                // todo seal elements
+                return true;
             }
 
             @Override
-            public void current() {
+            public boolean current() {
                 // nothing to do here
+                return false;
             }
 
             @Override
-            public void parent() {
+            public boolean parent() {
                 if (elements.isEmpty()) {
-                    throw new RuntimeException(".. of empty path");
+                    throw new IllegalArgumentException(".. of empty path");
                 }
                 elements.remove(elements.size() - 1);
+                return true;
             }
 
             @Override
-            public void index(int index) {
+            public boolean index(int index) {
                 if (index > 1) {
-                    throw new RuntimeException("index > 1");
+                    throw new IllegalArgumentException("index > 1");
                 }
+                return true;
             }
 
             @Override
             public void error(String message) {
-                throw new RuntimeException(message);
+                throw new IllegalArgumentException(message);
             }
 
             @Override
-            public void name(String name) {
+            public boolean name(String name) {
                 String p = nameMapper.getJcrName(name);
                 elements.add(p);
+                return true;
             }
         };
 
@@ -215,4 +231,4 @@ public class NamePathMapperImpl implemen
         jcrPath.deleteCharAt(jcrPath.length() - 1);
         return jcrPath.toString();
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
Wed May  9 13:21:32 2012
@@ -121,4 +121,4 @@ public class NamePathMapperImplTest {
         }
 
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
Wed May  9 13:21:32 2012
@@ -175,4 +175,4 @@ abstract class ItemImpl extends Abstract
     String toJcrPath(String oakPath) {
         return sessionDelegate.getNamePathMapper().getJcrPath(oakPath);
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Wed May  9 13:21:32 2012
@@ -25,7 +25,6 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.jcr.util.LogUtil;
 import org.apache.jackrabbit.oak.jcr.value.ValueConverter;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
-import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.util.Function1;
 import org.apache.jackrabbit.oak.util.Iterators;
 import org.apache.jackrabbit.oak.util.Predicate;
@@ -150,7 +149,7 @@ public class NodeImpl extends ItemImpl i
     public Node addNode(String relPath, String primaryNodeTypeName) throws RepositoryException
{
         checkStatus();
 
-        String oakPath = sessionDelegate.getOakPathOrThrow(relPath);
+        String oakPath = sessionDelegate.getOakPathOrThrow(relPath, new RepositoryException());
         String oakName = PathUtils.getName(oakPath);
         NodeDelegate parent = dlg.getChild(PathUtils.getParentPath(oakPath));
         if (parent == null) {
@@ -213,7 +212,7 @@ public class NodeImpl extends ItemImpl i
             p.remove();
             return p;
         } else {
-            String oakName = sessionDelegate.getOakPathOrThrow(jcrName);
+            String oakName = sessionDelegate.getOakPathOrThrow(jcrName, new RepositoryException());
             CoreValue oakValue = ValueConverter.toCoreValue(targetValue, sessionDelegate);
             return new PropertyImpl(dlg.setProperty(oakName, oakValue));
         }
@@ -244,7 +243,7 @@ public class NodeImpl extends ItemImpl i
             p.remove();
             return p;
         } else {
-            String oakName = sessionDelegate.getOakPathOrThrow(jcrName);
+            String oakName = sessionDelegate.getOakPathOrThrow(jcrName, new RepositoryException());
             List<CoreValue> oakValue = ValueConverter.toCoreValues(targetValues, sessionDelegate);
             return new PropertyImpl(dlg.setProperty(oakName, oakValue));
         }
@@ -365,7 +364,7 @@ public class NodeImpl extends ItemImpl i
     public Node getNode(String relPath) throws RepositoryException {
         checkStatus();
 
-        String oakPath = sessionDelegate.getOakPathOrThrowNotFound(relPath);
+        String oakPath = sessionDelegate.getOakPathOrThrow(relPath, new PathNotFoundException(relPath));
         NodeDelegate nd = dlg.getChild(oakPath);
         if (nd == null) {
             throw new PathNotFoundException(relPath);
@@ -419,7 +418,7 @@ public class NodeImpl extends ItemImpl i
     public Property getProperty(String relPath) throws RepositoryException {
         checkStatus();
 
-        String oakPath = sessionDelegate.getOakPathOrThrowNotFound(relPath);
+        String oakPath = sessionDelegate.getOakPathOrThrow(relPath, new PathNotFoundException());
         PropertyDelegate pd = dlg.getProperty(oakPath);
         if (pd == null) {
             throw new PathNotFoundException(relPath + " not found on " + getPath());
@@ -551,7 +550,7 @@ public class NodeImpl extends ItemImpl i
     public boolean hasNode(String relPath) throws RepositoryException {
         checkStatus();
 
-        String oakPath = sessionDelegate.getOakPathOrNull(relPath);
+        String oakPath = sessionDelegate.getOakPathOrThrow(relPath, new RepositoryException());
         return oakPath != null && dlg.getChild(oakPath) != null;
     }
 
@@ -559,7 +558,7 @@ public class NodeImpl extends ItemImpl i
     public boolean hasProperty(String relPath) throws RepositoryException {
         checkStatus();
 
-        String oakPath = sessionDelegate.getOakPathOrNull(relPath);
+        String oakPath = sessionDelegate.getOakPathOrThrow(relPath, new RepositoryException());
         return oakPath != null && dlg.getProperty(oakPath) != null;
     }
 
@@ -657,7 +656,7 @@ public class NodeImpl extends ItemImpl i
         // TODO: END
 
         String jcrPrimaryType =
-                sessionDelegate.getOakPathOrThrow(Property.JCR_PRIMARY_TYPE);
+                sessionDelegate.getOakPathOrThrow(Property.JCR_PRIMARY_TYPE, new RepositoryException());
         CoreValue cv = ValueConverter.toCoreValue(nodeTypeName, PropertyType.NAME, sessionDelegate);
         dlg.setProperty(jcrPrimaryType, cv);
     }
@@ -999,4 +998,4 @@ public class NodeImpl extends ItemImpl i
             return getTargetType(values[0], type);
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Wed May  9 13:21:32 2012
@@ -142,52 +142,18 @@ public class SessionDelegate {
         }
     }
 
-    /**
-     * Shortcut for {@code SessionDelegate.getNamePathMapper().getOakPath(jcrPath)}.
-     *
-     * @param jcrPath JCR path
-     * @return Oak path, or {@code null}
-     */
-    public String getOakPathOrNull(String jcrPath) {
-        return getNamePathMapper().getOakPath(jcrPath);
-    }
-
-    /**
-     * Returns the Oak path for the given JCR path, or throws a
-     * {@link PathNotFoundException} if the path can not be mapped.
-     *
-     * @param jcrPath JCR path
-     * @return Oak path
-     * @throws PathNotFoundException if the path can not be mapped
-     */
-    public String getOakPathOrThrowNotFound(String jcrPath)
-            throws PathNotFoundException {
+    public <T extends Throwable> String getOakPathOrThrow(String jcrPath, T t) throws
T {
         String oakPath = getOakPathOrNull(jcrPath);
-        if (oakPath != null) {
+        if (oakPath != null || t == null) {
             return oakPath;
         } else {
-            throw new PathNotFoundException(jcrPath);
+            throw t;
         }
     }
 
-    /**
-     * Returns the Oak path for the given JCR path, or throws a
-     * {@link RepositoryException} if the path can not be mapped.
-     *
-     * @param jcrPath JCR path
-     * @return Oak path
-     * @throws RepositoryException if the path can not be mapped
-     */
-    public String getOakPathOrThrow(String jcrPath)
-            throws RepositoryException {
-        String oakPath = getOakPathOrNull(jcrPath);
-        if (oakPath != null) {
-            return oakPath;
-        } else {
-            throw new RepositoryException("Invalid path: " + jcrPath);
-        }
+    public String getOakPathOrNull(String jcrPath) {
+        return getNamePathMapper().getOakPath(jcrPath);
     }
-
     //----------------------------------------------------------< Workspace >---
 
     public Workspace getWorkspace() {
@@ -307,7 +273,7 @@ public class SessionDelegate {
                 String ns = nsRegistry.getURI(oakPrefix);
                 return session.getNamespacePrefix(ns);
             } catch (RepositoryException e) {
-                // TODO
+                log.debug("Could not get JCR prefix for OAK prefix " + oakPrefix);
                 return null;
             }
         }
@@ -318,7 +284,7 @@ public class SessionDelegate {
                 String ns = getSession().getNamespaceURI(jcrPrefix);
                 return nsRegistry.getPrefix(ns);
             } catch (RepositoryException e) {
-                // TODO
+                log.debug("Could not get OAK prefix for JCR prefix " + jcrPrefix);
                 return null;
             }
         }
@@ -328,7 +294,7 @@ public class SessionDelegate {
             try {
                 return nsRegistry.getPrefix(uri);
             } catch (RepositoryException e) {
-                // TODO
+                log.debug("Could not get OAK prefix for URI " + uri);
                 return null;
             }
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Wed May  9 13:21:32 2012
@@ -122,8 +122,8 @@ public class SessionImpl extends Abstrac
     public void move(String srcAbsPath, String destAbsPath) throws RepositoryException {
         ensureIsAlive();
         dlg.move(
-                dlg.getOakPathOrThrowNotFound(srcAbsPath),
-                dlg.getOakPathOrThrowNotFound(destAbsPath),
+                dlg.getOakPathOrThrow(srcAbsPath, new PathNotFoundException(srcAbsPath)),
+                dlg.getOakPathOrThrow(destAbsPath, new PathNotFoundException(destAbsPath)),
                 true);
     }
 
@@ -161,7 +161,7 @@ public class SessionImpl extends Abstrac
         ensureIsAlive();
 
         @SuppressWarnings("unused")
-        String oakPath = dlg.getOakPathOrThrowNotFound(parentAbsPath);
+        String oakPath = dlg.getOakPathOrThrow(parentAbsPath, new PathNotFoundException(parentAbsPath));
 
         throw new UnsupportedRepositoryOperationException("TODO: Session.getImportContentHandler");
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Wed May  9 13:21:32 2012
@@ -27,6 +27,7 @@ import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 
 import javax.jcr.NamespaceRegistry;
+import javax.jcr.PathNotFoundException;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -91,8 +92,8 @@ public class WorkspaceImpl implements Ja
         }
 
         sessionDelegate.copy(
-                sessionDelegate.getOakPathOrThrowNotFound(srcAbsPath),
-                sessionDelegate.getOakPathOrThrowNotFound(destAbsPath));
+                sessionDelegate.getOakPathOrThrow(srcAbsPath, new PathNotFoundException(srcAbsPath)),
+                sessionDelegate.getOakPathOrThrow(destAbsPath, new PathNotFoundException(srcAbsPath)));
     }
 
     @SuppressWarnings("deprecation")
@@ -111,8 +112,8 @@ public class WorkspaceImpl implements Ja
         ensureIsAlive();
 
         sessionDelegate.move(
-                sessionDelegate.getOakPathOrThrowNotFound(srcAbsPath),
-                sessionDelegate.getOakPathOrThrowNotFound(destAbsPath),
+                sessionDelegate.getOakPathOrThrow(srcAbsPath, new PathNotFoundException(srcAbsPath)),
+                sessionDelegate.getOakPathOrThrow(destAbsPath, new PathNotFoundException(destAbsPath)),
                 false);
     }
 
@@ -323,4 +324,4 @@ public class WorkspaceImpl implements Ja
             throw new UnsupportedRepositoryOperationException(option + " is not supported
by this repository.");
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
Wed May  9 13:21:32 2012
@@ -16,27 +16,6 @@
  */
 package org.apache.jackrabbit.oak.jcr.nodetype;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.nodetype.NodeDefinitionTemplate;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeDefinition;
-import javax.jcr.nodetype.NodeTypeIterator;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.nodetype.NodeTypeTemplate;
-import javax.jcr.nodetype.PropertyDefinitionTemplate;
-
 import org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader;
 import org.apache.jackrabbit.commons.cnd.DefinitionBuilderFactory;
 import org.apache.jackrabbit.commons.cnd.DefinitionBuilderFactory.AbstractNodeDefinitionBuilder;
@@ -49,6 +28,26 @@ import org.apache.jackrabbit.oak.api.Cor
 import org.apache.jackrabbit.oak.jcr.value.ValueFactoryImpl;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeDefinitionTemplate;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeDefinition;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.NodeTypeTemplate;
+import javax.jcr.nodetype.PropertyDefinitionTemplate;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 public class NodeTypeManagerImpl implements NodeTypeManager {
 
     private final ValueFactoryImpl vf;

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
Wed May  9 13:21:32 2012
@@ -388,7 +388,7 @@ public class UserManagerImpl implements 
     }
 
     private String getInternalPath(Node node) throws RepositoryException {
-        return sessionDelegate.getOakPathOrThrow(node.getPath());
+        return sessionDelegate.getOakPathOrThrow(node.getPath(), new RepositoryException());
     }
 
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java?rev=1336186&r1=1336185&r2=1336186&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
Wed May  9 13:21:32 2012
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.jcr.va
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
-import org.apache.jackrabbit.oak.jcr.SessionDelegate;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.util.ISO8601;
 import org.slf4j.Logger;
@@ -202,4 +201,4 @@ public class ValueFactoryImpl implements
         CoreValue cv = factory.createValue(value.getUUID(), weak ? PropertyType.WEAKREFERENCE
: PropertyType.REFERENCE);
         return new ValueImpl(cv, namePathMapper);
     }
-}
\ No newline at end of file
+}



Mime
View raw message