openamf/src/java/org/openamf/invoker ServiceInvocationException.java,1.17,1.18

[email protected] Fri, 15 Aug 2003 15:51:01 -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-serv22977/src/java/org/openamf/invoker

Modified Files:
	ServiceInvocationException.java 
Log Message:
removed unused imports

Index: ServiceInvocationException.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/invoker/ServiceInvocationException.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** ServiceInvocationException.java	15 Aug 2003 22:03:42 -0000	1.17
--- ServiceInvocationException.java	15 Aug 2003 22:50:59 -0000	1.18
***************
*** 12,20 ****
  import org.apache.commons.lang.exception.ExceptionUtils;
  import org.apache.commons.lang.exception.NestableException;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
  import org.openamf.AMFBody;
- import org.openamf.ServiceRequest;
  import org.openamf.AMFError;
  
  /**
--- 12,18 ----
  import org.apache.commons.lang.exception.ExceptionUtils;
  import org.apache.commons.lang.exception.NestableException;
  import org.openamf.AMFBody;
  import org.openamf.AMFError;
+ import org.openamf.ServiceRequest;
  
  /**
***************
*** 27,58 ****
  	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;
--- 25,65 ----
  	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;




-------------------------------------------------------
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