Update of /cvsroot/openamf/openamf/src/java/org/openamf/invoker
In directory sc8-pr-cvs1:/tmp/cvs-serv27324/src/java/org/openamf/invoker
Modified Files:
ServiceInvocationException.java
Log Message:
rewrote getRootCause() so that it will work with 1.3
Index: ServiceInvocationException.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/invoker/ServiceInvocationException.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ServiceInvocationException.java 5 Aug 2003 20:49:28 -0000 1.12
--- ServiceInvocationException.java 5 Aug 2003 20:56:40 -0000 1.13
***************
*** 4,8 ****
import org.apache.commons.lang.exception.NestableException;
- import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
--- 4,7 ----
***************
*** 16,21 ****
--- 15,24 ----
*/
public class ServiceInvocationException extends NestableException {
+
+ private static final Log log = LogFactory.getLog(ServiceInvocationException.class);
+
protected AMFBody requestBody;
protected ServiceRequest request;
+ protected Throwable cause;
public ServiceInvocationException(
***************
*** 24,27 ****
--- 27,32 ----
super(cause);
+
+ this.cause = cause;
this.requestBody = requestBody;
}
***************
*** 32,51 ****
super(cause);
this.request = request;
}
public AMFError getAMFError() {
AMFError amfError = new AMFError();
! Throwable rootCause = getCause();
amfError.setCode(getErrorValue(rootCause, "getCode", "SERVER.PROCESSING"));
amfError.setLevel(getErrorValue(rootCause, "getError", "error"));
amfError.setType(rootCause.getClass().toString());
! amfError.setDetails(ExceptionUtils.getStackTrace(rootCause));
amfError.setDescription(getErrorValue(rootCause, "getDescription", rootCause.getMessage()));
return amfError;
}
!
private String getErrorValue(Throwable cause, String methodName, String defaultValue) {
String value = null;
try {
Method method = cause.getClass().getMethod(methodName, new Class[0]);
--- 37,84 ----
super(cause);
+
+ this.cause = cause;
this.request = request;
}
public AMFError getAMFError() {
+
AMFError amfError = new AMFError();
!
! Throwable rootCause = getRootCause();
! StackTraceElement[] stackTrace = rootCause.getStackTrace();
! StringBuffer stackTraceBuffer = new StringBuffer();
! for (int i = 0; i < stackTrace.length; i++) {
! StackTraceElement element = stackTrace[i];
! stackTraceBuffer.append(element.toString());
! stackTraceBuffer.append('\n');
! }
!
amfError.setCode(getErrorValue(rootCause, "getCode", "SERVER.PROCESSING"));
amfError.setLevel(getErrorValue(rootCause, "getError", "error"));
amfError.setType(rootCause.getClass().toString());
! amfError.setDetails(stackTraceBuffer.toString());
amfError.setDescription(getErrorValue(rootCause, "getDescription", rootCause.getMessage()));
+
return amfError;
+
}
!
! public Throwable getRootCause() {
!
! Throwable rootCause = null;
!
! Throwable[] throwables = getThrowables();
!
! rootCause = throwables[getThrowableCount()-1];
!
! return rootCause;
!
! }
!
private String getErrorValue(Throwable cause, String methodName, String defaultValue) {
+
String value = null;
+
try {
Method method = cause.getClass().getMethod(methodName, new Class[0]);
***************
*** 56,60 ****
--- 89,95 ----
value = defaultValue;
}
+
return value;
}
+
}
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.