You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2015/12/07 12:06:59 UTC
svn commit: r1718300 - in /chemistry/opencmis/trunk:
chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/
chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/...
Author: fmui
Date: Mon Dec 7 11:06:59 2015
New Revision: 1718300
URL: http://svn.apache.org/viewvc?rev=1718300&view=rev
Log:
CMIS-960: client/server, all bindings: added additional data to exceptions
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisBaseException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConnectionException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConstraintException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisContentAlreadyExistsException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisFilterNotValidException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisInvalidArgumentException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNameConstraintViolationException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNotSupportedException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisObjectNotFoundException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisPermissionDeniedException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisRuntimeException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisServiceUnavailableException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStorageException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStreamNotSupportedException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUpdateConflictException.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisVersioningException.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java Mon Dec 7 11:06:59 2015
@@ -106,6 +106,15 @@ public abstract class AbstractAtomPubSer
protected static final String NAME_RELATIVE_PATH_SEGMENT = "relativePathSegment";
protected static final String NAME_NUM_ITEMS = "numItems";
+ private static final String EXCEPTION_EXCEPTION_BEGIN = "<!--exception-->";
+ private static final String EXCEPTION_EXCEPTION_END = "<!--/exception-->";
+ private static final String EXCEPTION_MESSAGE_BEGIN = "<!--message-->";
+ private static final String EXCEPTION_MESSAGE_END = "<!--/message-->";
+ private static final String EXCEPTION_KEY_BEGIN = "<!--key-->";
+ private static final String EXCEPTION_KEY_END = "<!--/key-->";
+ private static final String EXCEPTION_VALUE_BEGIN = "<!--value-->";
+ private static final String EXCEPTION_VALUE_END = "<!--/value-->";
+
private BindingSession session;
/**
@@ -464,6 +473,7 @@ public abstract class AbstractAtomPubSer
protected CmisBaseException convertStatusCode(int code, String message, String errorContent, Throwable t) {
String exception = extractException(errorContent);
message = extractErrorMessage(message, errorContent);
+ Map<String, String> additionalData = extractAddtionalData(errorContent);
switch (code) {
case 301:
@@ -474,40 +484,40 @@ public abstract class AbstractAtomPubSer
+ message, errorContent, t);
case 400:
if (CmisFilterNotValidException.EXCEPTION_NAME.equals(exception)) {
- return new CmisFilterNotValidException(message, errorContent, t);
+ return new CmisFilterNotValidException(message, errorContent, additionalData, t);
}
- return new CmisInvalidArgumentException(message, errorContent, t);
+ return new CmisInvalidArgumentException(message, errorContent, additionalData, t);
case 401:
- return new CmisUnauthorizedException(message, errorContent, t);
+ return new CmisUnauthorizedException(message, errorContent, additionalData, t);
case 403:
if (CmisStreamNotSupportedException.EXCEPTION_NAME.equals(exception)) {
- return new CmisStreamNotSupportedException(message, errorContent, t);
+ return new CmisStreamNotSupportedException(message, errorContent, additionalData, t);
}
- return new CmisPermissionDeniedException(message, errorContent, t);
+ return new CmisPermissionDeniedException(message, errorContent, additionalData, t);
case 404:
- return new CmisObjectNotFoundException(message, errorContent, t);
+ return new CmisObjectNotFoundException(message, errorContent, additionalData, t);
case 405:
- return new CmisNotSupportedException(message, errorContent, t);
+ return new CmisNotSupportedException(message, errorContent, additionalData, t);
case 407:
- return new CmisProxyAuthenticationException(message, errorContent, t);
+ return new CmisProxyAuthenticationException(message, errorContent, additionalData, t);
case 409:
if (CmisContentAlreadyExistsException.EXCEPTION_NAME.equals(exception)) {
- return new CmisContentAlreadyExistsException(message, errorContent, t);
+ return new CmisContentAlreadyExistsException(message, errorContent, additionalData, t);
} else if (CmisVersioningException.EXCEPTION_NAME.equals(exception)) {
- return new CmisVersioningException(message, errorContent, t);
+ return new CmisVersioningException(message, errorContent, additionalData, t);
} else if (CmisUpdateConflictException.EXCEPTION_NAME.equals(exception)) {
- return new CmisUpdateConflictException(message, errorContent, t);
+ return new CmisUpdateConflictException(message, errorContent, additionalData, t);
} else if (CmisNameConstraintViolationException.EXCEPTION_NAME.equals(exception)) {
- return new CmisNameConstraintViolationException(message, errorContent, t);
+ return new CmisNameConstraintViolationException(message, errorContent, additionalData, t);
}
- return new CmisConstraintException(message, errorContent, t);
+ return new CmisConstraintException(message, errorContent, additionalData, t);
case 503:
- return new CmisServiceUnavailableException(message, errorContent, t);
+ return new CmisServiceUnavailableException(message, errorContent, additionalData, t);
default:
if (CmisStorageException.EXCEPTION_NAME.equals(exception)) {
- return new CmisStorageException(message, errorContent, t);
+ return new CmisStorageException(message, errorContent, additionalData, t);
}
- return new CmisRuntimeException(message, errorContent, t);
+ return new CmisRuntimeException(message, errorContent, additionalData, t);
}
}
@@ -516,14 +526,14 @@ public abstract class AbstractAtomPubSer
return null;
}
- int begin = errorContent.indexOf("<!--exception-->");
- int end = errorContent.indexOf("<!--/exception-->");
+ int begin = errorContent.indexOf(EXCEPTION_EXCEPTION_BEGIN);
+ int end = errorContent.indexOf(EXCEPTION_EXCEPTION_END);
if (begin == -1 || end == -1 || begin > end) {
return null;
}
- return errorContent.substring(begin + "<!--exception-->".length(), end);
+ return errorContent.substring(begin + EXCEPTION_EXCEPTION_BEGIN.length(), end);
}
protected String extractErrorMessage(String message, String errorContent) {
@@ -531,14 +541,53 @@ public abstract class AbstractAtomPubSer
return message;
}
- int begin = errorContent.indexOf("<!--message-->");
- int end = errorContent.indexOf("<!--/message-->");
+ int begin = errorContent.indexOf(EXCEPTION_MESSAGE_BEGIN);
+ int end = errorContent.indexOf(EXCEPTION_MESSAGE_END);
if (begin == -1 || end == -1 || begin > end) {
return message;
}
- return errorContent.substring(begin + "<!--message-->".length(), end);
+ return errorContent.substring(begin + EXCEPTION_MESSAGE_BEGIN.length(), end);
+ }
+
+ protected Map<String, String> extractAddtionalData(String errorContent) {
+ if (errorContent == null) {
+ return null;
+ }
+
+ Map<String, String> result = null;
+
+ int pos = 0;
+
+ while (true) {
+ int keyBegin = errorContent.indexOf(EXCEPTION_KEY_BEGIN, pos);
+ int keyEnd = errorContent.indexOf(EXCEPTION_KEY_END, pos);
+
+ if (keyBegin == -1 || keyEnd == -1 || keyBegin > keyEnd) {
+ break;
+ }
+
+ pos = keyEnd + EXCEPTION_KEY_END.length();
+
+ int valueBegin = errorContent.indexOf(EXCEPTION_VALUE_BEGIN, pos);
+ int valueEnd = errorContent.indexOf(EXCEPTION_VALUE_END, pos);
+
+ if (valueBegin == -1 || valueEnd == -1 || valueBegin > valueEnd) {
+ break;
+ }
+
+ pos = valueEnd + EXCEPTION_VALUE_END.length();
+
+ if (result == null) {
+ result = new HashMap<String, String>();
+ }
+
+ result.put(errorContent.substring(keyBegin + EXCEPTION_KEY_BEGIN.length(), keyEnd),
+ errorContent.substring(valueBegin + EXCEPTION_VALUE_BEGIN.length(), valueEnd));
+ }
+
+ return result;
}
// ---- helpers ----
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java Mon Dec 7 11:06:59 2015
@@ -21,6 +21,7 @@ package org.apache.chemistry.opencmis.cl
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
@@ -264,32 +265,46 @@ public abstract class AbstractBrowserBin
message = jsonMessage.toString();
}
+ Map<String, String> additionalData = null;
+ for (Map.Entry<String, Object> e : json.entrySet()) {
+ if (JSONConstants.ERROR_EXCEPTION.equalsIgnoreCase(e.getKey())
+ || JSONConstants.ERROR_MESSAGE.equalsIgnoreCase(e.getKey())) {
+ continue;
+ }
+
+ if (additionalData == null) {
+ additionalData = new HashMap<String, String>();
+ }
+
+ additionalData.put(e.getKey(), e.getValue() == null ? null : e.getValue().toString());
+ }
+
if (CmisConstraintException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisConstraintException(message, errorContent, t);
+ return new CmisConstraintException(message, errorContent, additionalData, t);
} else if (CmisContentAlreadyExistsException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisContentAlreadyExistsException(message, errorContent, t);
+ return new CmisContentAlreadyExistsException(message, errorContent, additionalData, t);
} else if (CmisFilterNotValidException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisFilterNotValidException(message, errorContent, t);
+ return new CmisFilterNotValidException(message, errorContent, additionalData, t);
} else if (CmisInvalidArgumentException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisInvalidArgumentException(message, errorContent, t);
+ return new CmisInvalidArgumentException(message, errorContent, additionalData, t);
} else if (CmisNameConstraintViolationException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisNameConstraintViolationException(message, errorContent, t);
+ return new CmisNameConstraintViolationException(message, errorContent, additionalData, t);
} else if (CmisNotSupportedException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisNotSupportedException(message, errorContent, t);
+ return new CmisNotSupportedException(message, errorContent, additionalData, t);
} else if (CmisObjectNotFoundException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisObjectNotFoundException(message, errorContent, t);
+ return new CmisObjectNotFoundException(message, errorContent, additionalData, t);
} else if (CmisPermissionDeniedException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisPermissionDeniedException(message, errorContent, t);
+ return new CmisPermissionDeniedException(message, errorContent, additionalData, t);
} else if (CmisStorageException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisStorageException(message, errorContent, t);
+ return new CmisStorageException(message, errorContent, additionalData, t);
} else if (CmisStreamNotSupportedException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisStreamNotSupportedException(message, errorContent, t);
+ return new CmisStreamNotSupportedException(message, errorContent, additionalData, t);
} else if (CmisUpdateConflictException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisUpdateConflictException(message, errorContent, t);
+ return new CmisUpdateConflictException(message, errorContent, additionalData, t);
} else if (CmisVersioningException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
- return new CmisVersioningException(message, errorContent, t);
+ return new CmisVersioningException(message, errorContent, additionalData, t);
} else if (code == 503) {
- return new CmisServiceUnavailableException(message, errorContent, t);
+ return new CmisServiceUnavailableException(message, errorContent, additionalData, t);
}
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java Mon Dec 7 11:06:59 2015
@@ -20,6 +20,8 @@ package org.apache.chemistry.opencmis.cl
import java.io.StringWriter;
import java.math.BigInteger;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
@@ -49,12 +51,15 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* Base class for all Web Services clients.
*/
public abstract class AbstractWebServicesService {
+ private static final String ADDITIONAL_DATA_NS = "http://chemistry.apache.org/opencmis/exception";
+ private static final String ADDITIONAL_DATA_TAG = "additionalData";
private BindingSession session;
/**
@@ -83,12 +88,52 @@ public abstract class AbstractWebService
BigInteger code = ex.getFaultInfo().getCode();
String errorContent = null;
+ Map<String, String> additionalData = null;
if (!ex.getFaultInfo().getAny().isEmpty()) {
StringBuilder sb = new StringBuilder(1024);
+
for (Object o : ex.getFaultInfo().getAny()) {
if (o != null) {
if (o instanceof Node) {
- sb.append(getNodeAsString((Node) o));
+ Node node = (Node) o;
+
+ if (ADDITIONAL_DATA_NS.equals(node.getNamespaceURI())
+ && ADDITIONAL_DATA_TAG.equals(node.getNodeName())) {
+ NodeList entries = node.getChildNodes();
+ int n = entries.getLength();
+ for (int i = 0; i < n; i++) {
+ Node entry = entries.item(i);
+ if (!"entry".equals(entry.getNodeName())) {
+ continue;
+ }
+
+ String key = null;
+ String value = null;
+
+ NodeList keyValueList = entry.getChildNodes();
+ int n2 = keyValueList.getLength();
+ for (int j = 0; j < n2; j++) {
+ Node item = keyValueList.item(j);
+ if ("key".equals(item.getNodeName())) {
+ key = item.getTextContent();
+ } else if ("value".equals(item.getNodeName())) {
+ value = item.getTextContent();
+ }
+ }
+
+ if (key == null || value == null) {
+ continue;
+ }
+
+ if (additionalData == null) {
+ additionalData = new HashMap<String, String>();
+ }
+
+ additionalData.put(key, value);
+ }
+ }
+
+ sb.append(getNodeAsString(node));
} else {
sb.append(o.toString());
}
@@ -100,31 +145,31 @@ public abstract class AbstractWebService
switch (ex.getFaultInfo().getType()) {
case CONSTRAINT:
- return new CmisConstraintException(msg, code, errorContent);
+ return new CmisConstraintException(msg, code, errorContent, additionalData);
case CONTENT_ALREADY_EXISTS:
- return new CmisContentAlreadyExistsException(msg, code, errorContent);
+ return new CmisContentAlreadyExistsException(msg, code, errorContent, additionalData);
case FILTER_NOT_VALID:
- return new CmisFilterNotValidException(msg, code, errorContent);
+ return new CmisFilterNotValidException(msg, code, errorContent, additionalData);
case INVALID_ARGUMENT:
- return new CmisInvalidArgumentException(msg, code, errorContent);
+ return new CmisInvalidArgumentException(msg, code, errorContent, additionalData);
case NAME_CONSTRAINT_VIOLATION:
- return new CmisNameConstraintViolationException(msg, code, errorContent);
+ return new CmisNameConstraintViolationException(msg, code, errorContent, additionalData);
case NOT_SUPPORTED:
- return new CmisNotSupportedException(msg, code, errorContent);
+ return new CmisNotSupportedException(msg, code, errorContent, additionalData);
case OBJECT_NOT_FOUND:
- return new CmisObjectNotFoundException(msg, code, errorContent);
+ return new CmisObjectNotFoundException(msg, code, errorContent, additionalData);
case PERMISSION_DENIED:
- return new CmisPermissionDeniedException(msg, code, errorContent);
+ return new CmisPermissionDeniedException(msg, code, errorContent, additionalData);
case RUNTIME:
- return new CmisRuntimeException(msg, code, errorContent);
+ return new CmisRuntimeException(msg, code, errorContent, additionalData);
case STORAGE:
- return new CmisStorageException(msg, code, errorContent);
+ return new CmisStorageException(msg, code, errorContent, additionalData);
case STREAM_NOT_SUPPORTED:
- return new CmisStreamNotSupportedException(msg, code, errorContent);
+ return new CmisStreamNotSupportedException(msg, code, errorContent, additionalData);
case UPDATE_CONFLICT:
- return new CmisUpdateConflictException(msg, code, errorContent);
+ return new CmisUpdateConflictException(msg, code, errorContent, additionalData);
case VERSIONING:
- return new CmisVersioningException(msg, code, errorContent);
+ return new CmisVersioningException(msg, code, errorContent, additionalData);
default:
}
@@ -137,7 +182,7 @@ public abstract class AbstractWebService
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
// transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- StringWriter sw = new StringWriter();
+ StringWriter sw = new StringWriter(512);
transformer.transform(new DOMSource(node), new StreamResult(sw));
return sw.toString();
} catch (TransformerException e) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisBaseException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisBaseException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisBaseException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisBaseException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* Base exception class for all CMIS exceptions.
@@ -30,9 +31,15 @@ public abstract class CmisBaseException
/** Error code used by the Web Services binding. */
private BigInteger code = BigInteger.ZERO;
- /** Content the of the error page returned by the AtomPub server. */
+ /**
+ * Content the of the error page returned by the AtomPub or Browser Binding
+ * server.
+ */
private String errorContent;
+ /** Additional data of this exception. */
+ private Map<String, String> additionalData;
+
/**
* Default constructor.
*/
@@ -62,12 +69,29 @@ public abstract class CmisBaseException
* error message
* @param errorContent
* error page content
+ * @param additionalData
+ * additional data
* @param cause
* the cause
*/
- protected CmisBaseException(String message, String errorContent, Throwable cause) {
+ protected CmisBaseException(String message, String errorContent, Map<String, String> additionalData, Throwable cause) {
super(message, cause);
this.errorContent = errorContent;
+ this.additionalData = additionalData;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param cause
+ * the cause
+ */
+ protected CmisBaseException(String message, String errorContent, Throwable cause) {
+ this(message, errorContent, null, cause);
}
/**
@@ -104,6 +128,23 @@ public abstract class CmisBaseException
*
* @param message
* error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ protected CmisBaseException(String message, BigInteger code, String errorContent, Map<String, String> additionalData) {
+ this(message, code, errorContent);
+ this.additionalData = additionalData;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
* @param errorContent
* error page content
*/
@@ -156,6 +197,38 @@ public abstract class CmisBaseException
}
/**
+ * Returns additional data, if available.
+ *
+ * @return additional data, can be {@code null}
+ */
+ public Map<String, String> getAdditionalData() {
+ return additionalData;
+ }
+
+ /**
+ * Returns additional data, if available.
+ *
+ * @return additional data, can be {@code null}
+ */
+ public String getAdditionalData(String key) {
+ if (additionalData == null) {
+ return null;
+ }
+
+ return additionalData.get(key);
+ }
+
+ /**
+ * Sets additional data.
+ *
+ * @param data
+ * the data
+ */
+ public void setAdditionalData(Map<String, String> data) {
+ additionalData = data;
+ }
+
+ /**
* Returns the name of the exception as defined in the CMIS specification.
*/
public abstract String getExceptionName();
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConnectionException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConnectionException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConnectionException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConnectionException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS Connection Exception.
@@ -88,6 +89,40 @@ public class CmisConnectionException ext
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisConnectionException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisConnectionException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConstraintException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConstraintException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConstraintException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisConstraintException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS Constraint Exception.
@@ -91,6 +92,40 @@ public class CmisConstraintException ext
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisConstraintException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisConstraintException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisContentAlreadyExistsException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisContentAlreadyExistsException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisContentAlreadyExistsException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisContentAlreadyExistsException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS ContentAlreadyExists Exception.
@@ -92,6 +93,40 @@ public class CmisContentAlreadyExistsExc
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisContentAlreadyExistsException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisContentAlreadyExistsException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisFilterNotValidException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisFilterNotValidException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisFilterNotValidException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisFilterNotValidException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS FilterNotValid Exception.
@@ -93,6 +94,40 @@ public class CmisFilterNotValidException
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisFilterNotValidException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisFilterNotValidException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisInvalidArgumentException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisInvalidArgumentException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisInvalidArgumentException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisInvalidArgumentException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS InvalidArgument Exception.
@@ -91,6 +92,40 @@ public class CmisInvalidArgumentExceptio
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisInvalidArgumentException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisInvalidArgumentException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNameConstraintViolationException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNameConstraintViolationException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNameConstraintViolationException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNameConstraintViolationException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS NameConstraintViolation Exception.
@@ -91,6 +92,40 @@ public class CmisNameConstraintViolation
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisNameConstraintViolationException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisNameConstraintViolationException(String message, String errorContent,
+ Map<String, String> additionalData, Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNotSupportedException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNotSupportedException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNotSupportedException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisNotSupportedException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS NotSupported Exception.
@@ -91,6 +92,40 @@ public class CmisNotSupportedException e
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisNotSupportedException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisNotSupportedException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisObjectNotFoundException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisObjectNotFoundException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisObjectNotFoundException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisObjectNotFoundException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS ObjectNotFound Exception.
@@ -91,6 +92,40 @@ public class CmisObjectNotFoundException
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisObjectNotFoundException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisObjectNotFoundException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisPermissionDeniedException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisPermissionDeniedException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisPermissionDeniedException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisPermissionDeniedException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS PermissionDenied Exception.
@@ -91,6 +92,40 @@ public class CmisPermissionDeniedExcepti
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisPermissionDeniedException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisPermissionDeniedException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisProxyAuthenticationException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* Proxy authentication exception.
@@ -90,6 +91,40 @@ public class CmisProxyAuthenticationExce
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisProxyAuthenticationException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisProxyAuthenticationException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisRuntimeException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisRuntimeException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisRuntimeException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisRuntimeException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS Runtime Exception.
@@ -90,6 +91,39 @@ public class CmisRuntimeException extend
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisRuntimeException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisRuntimeException(String message, String errorContent, Map<String, String> additionalData, Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisServiceUnavailableException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisServiceUnavailableException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisServiceUnavailableException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisServiceUnavailableException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
public class CmisServiceUnavailableException extends CmisRuntimeException {
@@ -84,6 +85,40 @@ public class CmisServiceUnavailableExcep
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisServiceUnavailableException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisServiceUnavailableException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStorageException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStorageException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStorageException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStorageException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS Storage Exception.
@@ -91,6 +92,39 @@ public class CmisStorageException extend
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisStorageException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisStorageException(String message, String errorContent, Map<String, String> additionalData, Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStreamNotSupportedException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStreamNotSupportedException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStreamNotSupportedException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisStreamNotSupportedException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS StreamNotSupported Exception.
@@ -92,6 +93,40 @@ public class CmisStreamNotSupportedExcep
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisStreamNotSupportedException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisStreamNotSupportedException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUnauthorizedException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* Unauthorized exception.
@@ -90,6 +91,40 @@ public class CmisUnauthorizedException e
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisUnauthorizedException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisUnauthorizedException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUpdateConflictException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUpdateConflictException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUpdateConflictException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisUpdateConflictException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS UpdateConflict Exception.
@@ -91,6 +92,40 @@ public class CmisUpdateConflictException
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisUpdateConflictException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisUpdateConflictException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisVersioningException.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisVersioningException.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisVersioningException.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/exceptions/CmisVersioningException.java Mon Dec 7 11:06:59 2015
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.commons.exceptions;
import java.math.BigInteger;
+import java.util.Map;
/**
* CMIS Versioning Exception.
@@ -91,6 +92,40 @@ public class CmisVersioningException ext
}
/**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param code
+ * error code
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ */
+ public CmisVersioningException(String message, BigInteger code, String errorContent,
+ Map<String, String> additionalData) {
+ super(message, code, errorContent, additionalData);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * error message
+ * @param errorContent
+ * error page content
+ * @param additionalData
+ * additional data
+ * @param cause
+ * the cause
+ */
+ public CmisVersioningException(String message, String errorContent, Map<String, String> additionalData,
+ Throwable cause) {
+ super(message, errorContent, additionalData, cause);
+ }
+
+ /**
* Constructor.
*
* @param message
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java Mon Dec 7 11:06:59 2015
@@ -48,6 +48,7 @@ import static org.apache.chemistry.openc
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -362,8 +363,19 @@ public class CmisAtomPubServlet extends
String st = ExceptionHelper.getStacktraceAsString(ex);
if (st != null) {
- pw.print("<hr noshade='noshade'/><!--stacktrace--><pre>\n" + st
- + "\n</pre><!--/stacktrace--><hr noshade='noshade'/>");
+ pw.print("<hr noshade='noshade'/><!--stacktrace--><pre>\n<!--key-->stacktrace<!--/key><!--value-->"
+ + st + "<!--/value-->\n</pre><!--/stacktrace--><hr noshade='noshade'/>");
+ }
+
+ if (ex instanceof CmisBaseException) {
+ Map<String, String> additionalData = ((CmisBaseException) ex).getAdditionalData();
+ if (additionalData != null && !additionalData.isEmpty()) {
+ pw.print("<hr noshade='noshade'/>Additional data:<br><br>");
+ for (Map.Entry<String, String> e : additionalData.entrySet()) {
+ pw.print("<!--key-->" + StringEscapeUtils.escapeHtml(e.getKey()) + "<!--/key--> = <!--value-->"
+ + StringEscapeUtils.escapeHtml(e.getValue()) + "<!--/value--><br>");
+ }
+ }
}
pw.print("</body></html>");
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java Mon Dec 7 11:06:59 2015
@@ -76,6 +76,7 @@ import static org.apache.chemistry.openc
import java.io.IOException;
import java.io.InputStream;
+import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -516,6 +517,7 @@ public class CmisBrowserBindingServlet e
setStatus(request, response, statusCode);
JSONObject jsonResponse = new JSONObject();
+
jsonResponse.put(ERROR_EXCEPTION, exceptionName);
jsonResponse.put(ERROR_MESSAGE, message);
@@ -524,6 +526,19 @@ public class CmisBrowserBindingServlet e
jsonResponse.put(ERROR_STACKTRACE, st);
}
+ if (ex instanceof CmisBaseException) {
+ Map<String, String> additionalData = ((CmisBaseException) ex).getAdditionalData();
+ if (additionalData != null && !additionalData.isEmpty()) {
+ for (Map.Entry<String, String> e : additionalData.entrySet()) {
+ if (ERROR_EXCEPTION.equalsIgnoreCase(e.getKey())
+ || ERROR_MESSAGE.equalsIgnoreCase(e.getKey())) {
+ continue;
+ }
+ jsonResponse.put(e.getKey(), e.getValue());
+ }
+ }
+ }
+
try {
writeJSON(jsonResponse, request, response);
} catch (Exception e) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java Mon Dec 7 11:06:59 2015
@@ -26,6 +26,7 @@ import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
@@ -44,6 +45,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisFaultType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumServiceException;
@@ -60,6 +62,8 @@ import org.apache.chemistry.opencmis.ser
import org.apache.chemistry.opencmis.server.shared.TempStoreOutputStreamFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
@@ -68,6 +72,8 @@ import org.w3c.dom.Node;
public abstract class AbstractService {
private static final Logger LOG = LoggerFactory.getLogger(AbstractService.class);
+ private static final String ADDITIONAL_DATA_NS = "http://chemistry.apache.org/opencmis/exception";
+ private static final String ADDITIONAL_DATA_TAG = "additionalData";
public static final String CALL_CONTEXT_MAP = "org.apache.chemistry.opencmis.callcontext";
@@ -262,6 +268,33 @@ public abstract class AbstractService {
} else {
LOG.error(ex.getMessage(), ex);
}
+
+ Map<String, String> additionalData = ((CmisBaseException) ex).getAdditionalData();
+ if (additionalData != null && !additionalData.isEmpty()) {
+ try {
+ Document doc = XMLUtils.newDomDocument();
+
+ Element root = doc.createElementNS(ADDITIONAL_DATA_NS, ADDITIONAL_DATA_TAG);
+ doc.appendChild(root);
+
+ for (Map.Entry<String, String> e : additionalData.entrySet()) {
+ Element entry = doc.createElement("entry");
+ root.appendChild(entry);
+
+ Element key = doc.createElement("key");
+ key.appendChild(doc.createTextNode(e.getKey()));
+ entry.appendChild(key);
+
+ Element value = doc.createElement("value");
+ value.appendChild(doc.createTextNode(e.getValue()));
+ entry.appendChild(value);
+ }
+
+ fault.getAny().add(root);
+ } catch (ParserConfigurationException e) {
+ LOG.error("Unable to add additional data to exception!", e);
+ }
+ }
} else {
fault.setMessage("An error occurred!");
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java?rev=1718300&r1=1718299&r2=1718300&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java Mon Dec 7 11:06:59 2015
@@ -24,6 +24,7 @@ import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
@@ -52,7 +53,7 @@ public class ExceptionDialog extends JDi
private void createGUI() {
setMinimumSize(new Dimension(WorkbenchScale.scaleInt(600), WorkbenchScale.scaleInt(150)));
- setPreferredSize(new Dimension(WorkbenchScale.scaleInt(600), WorkbenchScale.scaleInt(150)));
+ setPreferredSize(new Dimension(WorkbenchScale.scaleInt(600), WorkbenchScale.scaleInt(200)));
setLayout(new BorderLayout());
@@ -75,6 +76,19 @@ public class ExceptionDialog extends JDi
exceptionText.append("</h3>");
}
if (exception instanceof CmisBaseException) {
+ Map<String, String> additionalData = ((CmisBaseException) exception).getAdditionalData();
+ if (additionalData != null && !additionalData.isEmpty()) {
+ exceptionText.append("<hr><br><b>Additional data:</b><br><table>");
+ for (Map.Entry<String, String> e : additionalData.entrySet()) {
+ exceptionText.append("<tr><td>");
+ ClientHelper.encodeHtml(exceptionText, e.getKey());
+ exceptionText.append(":</td><td>");
+ ClientHelper.encodeHtml(exceptionText, e.getValue());
+ exceptionText.append("</td></tr>");
+ }
+ exceptionText.append("</table>");
+ }
+
String errorContent = ((CmisBaseException) exception).getErrorContent();
if (errorContent != null && errorContent.length() > 0) {
exceptionText.append("<hr><br><b>Error Content:</b><br>");