idok-commit AT lists.psi.ch
Subject: Commit emails of the iDok project
List archive
[idok-commit] idok commit r671 - branches/opensource/java/ch/psi/dms/service/common/common/corba
Chronological Thread
- From: "Apache" <apache AT savannah.psi.ch>
- To: idok-commit AT lists.psi.ch
- Subject: [idok-commit] idok commit r671 - branches/opensource/java/ch/psi/dms/service/common/common/corba
- Date: Mon, 7 Jan 2008 14:18:21 +0100
- List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
- List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>
Author: geus AT PSI.CH
Date: Mon Jan 7 14:18:19 2008
New Revision: 671
Log:
Fixed bug that caused potential null fields in ServiceException objects that
would cause CORBA errors
Modified:
branches/opensource/java/ch/psi/dms/service/common/common/corba/Util.java
Modified:
branches/opensource/java/ch/psi/dms/service/common/common/corba/Util.java
==============================================================================
--- branches/opensource/java/ch/psi/dms/service/common/common/corba/Util.java
(original)
+++ branches/opensource/java/ch/psi/dms/service/common/common/corba/Util.java
Mon Jan 7 14:18:19 2008
@@ -66,6 +66,8 @@
/**
* Convert any exception into a ServiceException.
+ *
+ * The ServiceException object may have no null fields.
*/
static public ServiceException toServiceException(Throwable e)
throws ServiceException {
@@ -73,34 +75,41 @@
return (ServiceException) e;
else if (e instanceof DmsException)
return dmsToServiceException((DmsException) e);
- else if (e instanceof FileNotFoundException) {
- ExceptionType etype = ExceptionType.FILE_NOT_FOUND;
- return new ServiceException(etype, e.getMessage(), "",
- stackTraceToString(e));
- } else if (e instanceof WrongPolicy) {
- ExceptionType etype = ExceptionType.CORBA;
- return new ServiceException(etype, e.getMessage(), "",
- stackTraceToString(e));
- } else if (e instanceof ServantNotActive) {
- ExceptionType etype = ExceptionType.CORBA;
- return new ServiceException(etype, e.getMessage(), "",
- stackTraceToString(e));
- } else {
- // TODO generate more meaningful errortype and message from type
of
- // e
- ExceptionType etype = ExceptionType.INTERNAL;
- return new ServiceException(etype, e.getMessage(), "",
- stackTraceToString(e));
+ else {
+ String userMessage = e.getMessage();
+ if (userMessage == null)
+ userMessage = "Unspecified error detected";
+ String detailedMessage = "";
+
+ if (e instanceof FileNotFoundException) {
+ ExceptionType etype = ExceptionType.FILE_NOT_FOUND;
+ return new ServiceException(etype, userMessage,
+ detailedMessage, stackTraceToString(e));
+ } else if (e instanceof WrongPolicy) {
+ ExceptionType etype = ExceptionType.CORBA;
+ return new ServiceException(etype, userMessage,
+ detailedMessage, stackTraceToString(e));
+ } else if (e instanceof ServantNotActive) {
+ ExceptionType etype = ExceptionType.CORBA;
+ return new ServiceException(etype, userMessage,
+ detailedMessage, stackTraceToString(e));
+ } else {
+ // TODO generate more meaningful errortype and message from
type
+ // of e
+ ExceptionType etype = ExceptionType.INTERNAL;
+ return new ServiceException(etype, userMessage,
+ detailedMessage, stackTraceToString(e));
+ }
}
}
/**
- * @brief Convert a Corba ServiceException to a DmsException.
+ * @brief Convert a CORBA ServiceException to a DmsException.
*
* @param orig
* Originator of the returned DmsException.
* @param ex
- * The Corba ServiceException to be converted.
+ * The CORBA ServiceException to be converted.
* @return The DmsException corresponding to ex.
*/
public static DmsException toDmsException(Object orig,
- [idok-commit] idok commit r671 - branches/opensource/java/ch/psi/dms/service/common/common/corba, Apache, 01/07/2008
Archive powered by MHonArc 2.6.19.