jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r915367 - /jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java
Date Tue, 23 Feb 2010 15:01:58 GMT
Author: angela
Date: Tue Feb 23 15:01:58 2010
New Revision: 915367

URL: http://svn.apache.org/viewvc?rev=915367&view=rev
Log:
JCR-2463: Minor spi2dav ExceptionConverter improvements

Modified:
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java?rev=915367&r1=915366&r2=915367&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java
Tue Feb 23 15:01:58 2010
@@ -24,13 +24,12 @@
 import org.apache.jackrabbit.webdav.client.methods.MkColMethod;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.commons.httpclient.methods.PutMethod;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
 import org.w3c.dom.Element;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.InvalidItemStateException;
+import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.lock.LockException;
 import java.lang.reflect.Constructor;
@@ -40,16 +39,14 @@
  */
 public class ExceptionConverter {
 
-    private static Logger log = LoggerFactory.getLogger(ExceptionConverter.class);
-
     // avoid instantiation
     private ExceptionConverter() {}
 
-    public static RepositoryException generate(DavException davExc) throws RepositoryException
{
+    public static RepositoryException generate(DavException davExc) {
         return generate(davExc, null);
     }
 
-    public static RepositoryException generate(DavException davExc, DavMethod method) throws
RepositoryException {
+    public static RepositoryException generate(DavException davExc, DavMethod method) {
         String msg = davExc.getMessage();
         if (davExc.hasErrorCondition()) {
             try {
@@ -64,7 +61,7 @@
                             Class<?> cl = Class.forName(DomUtil.getChildText(exc, "class",
null));
                             Constructor<?> excConstr = cl.getConstructor(String.class);
                             if (excConstr != null) {
-                                Object o = excConstr.newInstance(new String[]{msg});
+                                Object o = excConstr.newInstance(msg);
                                 if (o instanceof RepositoryException) {
                                     return (RepositoryException) o;
                                 } else if (o instanceof Exception) {
@@ -75,7 +72,7 @@
                     }
                 }
             } catch (Exception e) {
-                throw new RepositoryException(e);
+                return new RepositoryException(e);
             }
         }
 
@@ -88,7 +85,7 @@
                                        method instanceof PutMethod)) {
                     // target item has probably while transient changes have
                     // been made.
-                    throw new InvalidItemStateException(msg, davExc);
+                    return new InvalidItemStateException(msg, davExc);
                 } else {
                     return new ItemNotFoundException(msg, davExc);
                 }
@@ -102,11 +99,11 @@
                 return new LockException(msg, davExc);
             case DavServletResponse.SC_NOT_IMPLEMENTED:
                 if (method != null) {
-                    throw new UnsupportedOperationException(
+                    return new UnsupportedRepositoryOperationException(
                             "Missing implementation: Method "
                             + method + " could not be executed", davExc);
                 } else {
-                    throw new UnsupportedOperationException(
+                    return new UnsupportedRepositoryOperationException(
                             "Missing implementation", davExc);
                 }
             default:



Mime
View raw message