jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r374396 - in /incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit: core/ core/nodetype/ core/xml/ name/
Date Thu, 02 Feb 2006 14:19:47 GMT
Author: jukka
Date: Thu Feb  2 06:19:35 2006
New Revision: 374396

URL: http://svn.apache.org/viewcvs?rev=374396&view=rev
Log:
Added a NameException base class for the o.a.j.name exceptions.
Changed code to catch NameException instead of the more general BaseException in catch statements.

Added:
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NameException.java
Modified:
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/IllegalNameException.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/MalformedPathException.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NoPrefixDeclaredException.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/UnknownPrefixException.java

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=374396&r1=374395&r2=374396&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Thu Feb  2 06:19:35 2006
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.core;
 
-import org.apache.jackrabbit.BaseException;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
@@ -43,6 +42,7 @@
 import org.apache.jackrabbit.core.lock.LockManager;
 import org.apache.jackrabbit.name.IllegalNameException;
 import org.apache.jackrabbit.name.MalformedPathException;
+import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
@@ -183,7 +183,7 @@
             } catch (PathNotFoundException pnfe) {
                 return null;
             }
-        } catch (BaseException e) {
+        } catch (NameException e) {
             String msg = "failed to resolve path " + relPath + " relative to " + safeGetJCRPath();
             log.debug(msg);
             throw new RepositoryException(msg, e);
@@ -2639,7 +2639,7 @@
                 Path p = m1.getPrimaryPath().computeRelativePath(getPrimaryPath());
                 // use prefix mappings of srcSession
                 relPath = p.toJCRPath(srcSession.getNamespaceResolver());
-            } catch (BaseException be) {
+            } catch (NameException be) {
                 // should never get here...
                 String msg = "internal error: failed to determine relative path";
                 log.error(msg, be);
@@ -3026,7 +3026,7 @@
                 Path p = m1.getPrimaryPath().computeRelativePath(getPrimaryPath());
                 // use prefix mappings of srcSession
                 relPath = p.toJCRPath(srcSession.getNamespaceResolver());
-            } catch (BaseException be) {
+            } catch (NameException be) {
                 // should never get here...
                 String msg = "internal error: failed to determine relative path";
                 log.error(msg, be);

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=374396&r1=374395&r2=374396&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
Thu Feb  2 06:19:35 2006
@@ -16,9 +16,9 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.BaseException;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.name.IllegalNameException;
+import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
@@ -394,7 +394,7 @@
             EffectiveNodeType.checkSetPropertyValueConstraints(
                     def, new InternalValue[]{internalValue});
             return true;
-        } catch (BaseException be) {
+        } catch (NameException be) {
             // implementation specific exception, fall through
         } catch (RepositoryException re) {
             // fall through
@@ -468,7 +468,7 @@
                     (InternalValue[]) list.toArray(new InternalValue[list.size()]);
             EffectiveNodeType.checkSetPropertyValueConstraints(def, internalValues);
             return true;
-        } catch (BaseException be) {
+        } catch (NameException be) {
             // implementation specific exception, fall through
         } catch (RepositoryException re) {
             // fall through
@@ -483,7 +483,7 @@
         try {
             ent.checkAddNodeConstraints(QName.fromJCRName(childNodeName, nsResolver));
             return true;
-        } catch (BaseException be) {
+        } catch (NameException be) {
             // implementation specific exception, fall through
         } catch (RepositoryException re) {
             // fall through
@@ -498,7 +498,7 @@
         try {
             ent.checkAddNodeConstraints(QName.fromJCRName(childNodeName, nsResolver), QName.fromJCRName(nodeTypeName,
nsResolver));
             return true;
-        } catch (BaseException be) {
+        } catch (NameException be) {
             // implementation specific exception, fall through
         } catch (RepositoryException re) {
             // fall through
@@ -513,7 +513,7 @@
         try {
             ent.checkRemoveItemConstraints(QName.fromJCRName(itemName, nsResolver));
             return true;
-        } catch (BaseException be) {
+        } catch (NameException be) {
             // implementation specific exception, fall through
         } catch (RepositoryException re) {
             // fall through

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java?rev=374396&r1=374395&r2=374396&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
Thu Feb  2 06:19:35 2006
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.BaseException;
+import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.SessionNamespaceResolver;
 import org.apache.jackrabbit.name.NamespaceResolver;
@@ -126,7 +126,7 @@
             jcrRoot = QName.JCR_ROOT.toJCRName(nsResolver);
             jcrXMLText = QName.JCR_XMLTEXT.toJCRName(nsResolver);
             jcrXMLCharacters = QName.JCR_XMLCHARACTERS.toJCRName(nsResolver);
-        } catch (BaseException e) {
+        } catch (NameException e) {
             // should never get here...
             String msg = "internal error: failed to resolve namespace mappings";
             log.error(msg, e);

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java?rev=374396&r1=374395&r2=374396&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
Thu Feb  2 06:19:35 2006
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.BaseException;
+import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.util.ISO9075;
@@ -202,7 +202,7 @@
                     if (attrValue.length() > 0) {
                         try {
                             nodeTypeName = QName.fromJCRName(attrValue, nsContext);
-                        } catch (BaseException be) {
+                        } catch (NameException be) {
                             throw new SAXException("illegal jcr:primaryType value: "
                                     + attrValue, be);
                         }
@@ -213,7 +213,7 @@
                         try {
                             mixinTypes =
                                     new QName[]{QName.fromJCRName(attrValue, nsContext)};
-                        } catch (BaseException be) {
+                        } catch (NameException be) {
                             throw new SAXException("illegal jcr:mixinTypes value: "
                                     + attrValue, be);
                         }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java?rev=374396&r1=374395&r2=374396&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java
Thu Feb  2 06:19:35 2006
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.BaseException;
+import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.jackrabbit.value.ValueHelper;
@@ -71,7 +71,7 @@
     private QName getQName(String rawName) throws RepositoryException {
         try {
             return QName.fromJCRName(rawName, nsResolver);
-        } catch (BaseException e) {
+        } catch (NameException e) {
             // should never get here...
             String msg = "internal error: failed to resolve namespace mappings";
             log.error(msg, e);

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/IllegalNameException.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/IllegalNameException.java?rev=374396&r1=374395&r2=374396&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/IllegalNameException.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/IllegalNameException.java
Thu Feb  2 06:19:35 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.name;
 
-import org.apache.jackrabbit.BaseException;
-
 /**
  * Thrown when an illegal JCR name string is encountered. This exception is
  * thrown when attempting to parse a JCR name string that does not match the
@@ -28,7 +26,7 @@
  * See the section 4.6 of the JCR 1.0 specification for details of the
  * JCR name syntax.
  */
-public class IllegalNameException extends BaseException {
+public class IllegalNameException extends NameException {
 
     /**
      * Creates an IllegalNameException with the given error message.

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/MalformedPathException.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/MalformedPathException.java?rev=374396&r1=374395&r2=374396&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/MalformedPathException.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/MalformedPathException.java
Thu Feb  2 06:19:35 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.name;
 
-import org.apache.jackrabbit.BaseException;
-
 /**
  * Thrown when a malformed JCR path string is encountered. This exception is
  * thrown when attempting to parse a JCR path string that does not match the
@@ -27,7 +25,7 @@
  * See the section 4.6 of the JCR 1.0 specification for details of the
  * JCR path syntax.
  */
-public class MalformedPathException extends BaseException {
+public class MalformedPathException extends NameException {
 
     /**
      * Creates a MalformedPathException with the given error message.

Added: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NameException.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NameException.java?rev=374396&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NameException.java
(added)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NameException.java
Thu Feb  2 06:19:35 2006
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.name;
+
+import org.apache.jackrabbit.BaseException;
+
+/**
+ * Base class for exceptions about malformed or otherwise
+ * invalid JCR names and paths.
+ */
+public class NameException extends BaseException {
+
+    /**
+     * Creates a NameException with the given error message.
+     *
+     * @param message error message
+     */
+    public NameException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a NameException with the given error message and
+     * root cause exception.
+     *
+     * @param message   error message
+     * @param rootCause root cause exception
+     */
+    public NameException(String message, Throwable rootCause) {
+        super(message, rootCause);
+    }
+
+}

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NoPrefixDeclaredException.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NoPrefixDeclaredException.java?rev=374396&r1=374395&r2=374396&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NoPrefixDeclaredException.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/NoPrefixDeclaredException.java
Thu Feb  2 06:19:35 2006
@@ -16,15 +16,13 @@
  */
 package org.apache.jackrabbit.name;
 
-import org.apache.jackrabbit.BaseException;
-
 /**
  * Thrown when the namespace prefix of a qualified name is not found. This
  * exception is thrown when trying to convert a qualified name whose namespace
  * prefix is not found into a JCR name string. The JCR name string can not be
  * created without the namespace prefix.
  */
-public class NoPrefixDeclaredException extends BaseException {
+public class NoPrefixDeclaredException extends NameException {
 
     /**
      * Creates a NoPrefixDeclaredException with the given error message.

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/UnknownPrefixException.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/UnknownPrefixException.java?rev=374396&r1=374395&r2=374396&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/UnknownPrefixException.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/UnknownPrefixException.java
Thu Feb  2 06:19:35 2006
@@ -16,14 +16,12 @@
  */
 package org.apache.jackrabbit.name;
 
-import org.apache.jackrabbit.BaseException;
-
 /**
  * Thrown when a JCR name string with an unknown prefix is encountered.
  * This exception is thrown when attempting to parse a JCR name string
  * whose prefix is not bound to any namespace.
  */
-public class UnknownPrefixException extends BaseException {
+public class UnknownPrefixException extends NameException {
 
     /**
      * Creates an UnknownPrefixException with the given error message.



Mime
View raw message