if (jsonMessage != null) {
message = jsonMessage.toString();
}
if (CmisConstraintException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisConstraintException(message, errorContent, t);
} else if (CmisContentAlreadyExistsException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisContentAlreadyExistsException(message, errorContent, t);
} else if (CmisFilterNotValidException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisFilterNotValidException(message, errorContent, t);
} else if (CmisInvalidArgumentException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisInvalidArgumentException(message, errorContent, t);
} else if (CmisNameConstraintViolationException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisNameConstraintViolationException(message, errorContent, t);
} else if (CmisNotSupportedException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisNotSupportedException(message, errorContent, t);
} else if (CmisObjectNotFoundException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisObjectNotFoundException(message, errorContent, t);
} else if (CmisPermissionDeniedException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisPermissionDeniedException(message, errorContent, t);
} else if (CmisStorageException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisStorageException(message, errorContent, t);
} else if (CmisStreamNotSupportedException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisStreamNotSupportedException(message, errorContent, t);
} else if (CmisUpdateConflictException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisUpdateConflictException(message, errorContent, t);
} else if (CmisVersioningException.EXCEPTION_NAME.equalsIgnoreCase((String) jsonError)) {
return new CmisVersioningException(message, errorContent, t);
}
}
}
// fall back to status code
switch (code) {
case 400:
return new CmisInvalidArgumentException(message, errorContent, t);
case 401:
return new CmisUnauthorizedException(message, errorContent, t);
case 403:
return new CmisPermissionDeniedException(message, errorContent, t);
case 404:
return new CmisObjectNotFoundException(message, errorContent, t);
case 405:
return new CmisNotSupportedException(message, errorContent, t);
case 407:
return new CmisProxyAuthenticationException(message, errorContent, t);
case 409:
return new CmisConstraintException(message, errorContent, t);
default:
return new CmisRuntimeException(message, errorContent, t);
}
}