1 package org.collectionspace.services.nuxeo.client.java;
3 import org.collectionspace.services.common.CSWebApplicationException;
4 import org.collectionspace.services.common.document.DocumentException;
5 import org.nuxeo.ecm.core.api.WrappedException;
7 public class NuxeoDocumentException extends DocumentException {
12 private static final long serialVersionUID = 1L;
14 public NuxeoDocumentException() {
18 public NuxeoDocumentException(String msg) {
20 // TODO Auto-generated constructor stub
23 public NuxeoDocumentException(int errorCode) {
25 // TODO Auto-generated constructor stub
28 public NuxeoDocumentException(int errorCode, String errorReason) {
29 super(errorCode, errorReason);
30 // TODO Auto-generated constructor stub
33 public NuxeoDocumentException(String message, Throwable cause) {
34 super(message, cause);
35 // TODO Auto-generated constructor stub
38 public NuxeoDocumentException(Throwable cause) {
40 // TODO Auto-generated constructor stub
43 private static String getExceptionClassName(Throwable exception) {
46 if (exception != null) {
47 result = exception.getClass().getCanonicalName();
48 if (exception instanceof WrappedException) {
49 result = ((WrappedException)exception).getClassName(); // Nuxeo wraps the original exception, so we need to get the name of it.
57 public boolean exceptionChainContainsNetworkError() {
58 boolean result = false;
60 Throwable cause = this;
61 while (cause != null) {
62 String exceptionClassName = getExceptionClassName(cause);
63 if (CSWebApplicationException.isExceptionNetworkRelated(exceptionClassName) == true) {
68 cause = cause.getCause();