Package org.apache.jackrabbit.spi2dav
Class ExceptionConverter
- java.lang.Object
-
- org.apache.jackrabbit.spi2dav.ExceptionConverter
-
public class ExceptionConverter extends Object
Converter utility for mapping WebDAV protocol errors (DavException) into corresponding JCR API exceptions (RepositoryException).This class translates WebDAV server responses back into native JCR exception types so that remote repository client operations maintain standard JCR API error behaviors.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RepositoryExceptiongenerate(DavException davExc)static RepositoryExceptiongenerate(DavException davExc, int methodCode, String name)Generates a JCRRepositoryExceptionfrom aDavException, HTTP method code, and method name string.static RepositoryExceptiongenerate(DavException davExc, HttpRequestBase request)
-
-
-
Method Detail
-
generate
public static RepositoryException generate(DavException davExc)
- Parameters:
davExc- the WebDAV exception to convert- Returns:
- the mapped JCR
RepositoryException - See Also:
generate(DavException, HttpRequestBase)
-
generate
public static RepositoryException generate(DavException davExc, HttpRequestBase request)
- Parameters:
davExc- the WebDAV exception to convertrequest- the HTTP request that triggered the WebDAV exception, ornullif unavailable- Returns:
- the mapped JCR
RepositoryException - See Also:
generate(DavException, int, String)
-
generate
public static RepositoryException generate(DavException davExc, int methodCode, String name)
Generates a JCRRepositoryExceptionfrom aDavException, HTTP method code, and method name string.The method first attempts to extract explicit exception information (class name and message) from the WebDAV XML error response. If the class name matches an entry in
SAFE_EXCEPTION_NAMES, it reflectively instantiates that specific JCR exception.If no XML error details exist or the exception class is not in the allow-list, it converts the HTTP status code (and method context where appropriate) into a standard JCR exception type such as
ItemNotFoundException,LockException, orConstraintViolationException.- Parameters:
davExc- the WebDAV exception to convertmethodCode- the numeric code of the WebDAV HTTP method (fromDavMethods)name- the HTTP method name string (e.g., "GET", "POST", "MKCOL")- Returns:
- the resulting JCR
RepositoryException
-
-