openamf/src/java/org/openamf/invoker ServiceInvocationException.java,1.18,1.19
[email protected] Sat, 16 Aug 2003 06:11:18 -0700
| Newsgroups | gmane.comp.java.openamf.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/openamf/openamf/src/java/org/openamf/invoker
In directory sc8-pr-cvs1:/tmp/cvs-serv26881/java/org/openamf/invoker
Modified Files:
ServiceInvocationException.java
Log Message:
Serializer/Deserializer cleanup
Index: ServiceInvocationException.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/invoker/ServiceInvocationException.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** ServiceInvocationException.java 15 Aug 2003 22:50:59 -0000 1.18
--- ServiceInvocationException.java 16 Aug 2003 13:11:16 -0000 1.19
***************
*** 22,70 ****
*/
public class ServiceInvocationException extends NestableException {
! protected AMFBody requestBody;
! protected ServiceRequest request;
!
! public ServiceInvocationException(AMFBody requestBody, Throwable cause) {
! super(cause);
! this.requestBody = requestBody;
! }
! public ServiceInvocationException(
! ServiceRequest request,
! Throwable cause) {
! 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]);
! value = (String) method.invoke(cause, new Object[0]);
! } catch (Exception e) {
! }
! if (value == null) {
! value = defaultValue;
! }
! return value;
! }
}
--- 22,61 ----
*/
public class ServiceInvocationException extends NestableException {
! protected AMFBody requestBody;
! protected ServiceRequest request;
! public ServiceInvocationException(AMFBody requestBody, Throwable cause) {
! super(cause);
! this.requestBody = requestBody;
! }
! public ServiceInvocationException(ServiceRequest request, Throwable cause) {
! super(cause);
! this.request = request;
! }
! public AMFError getAMFError() {
! AMFError amfError = new AMFError();
! Throwable rootCause = getCause();
! amfError.setCode(getErrorValue(rootCause, "getCode", AMFError.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]);
! value = (String) method.invoke(cause, new Object[0]);
! } catch (Exception e) {
! }
+ if (value == null) {
+ 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