openamf/src/java/org/openamf/invoker JavaServiceInvoker.java,1.19,1.20 ServiceInvocationException.java,1.11,1.12

[email protected]
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-serv26012/src/java/org/openamf/invoker

Modified Files:
	JavaServiceInvoker.java ServiceInvocationException.java 
Log Message:
fix compilation problems with java 1.3

Index: JavaServiceInvoker.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/invoker/JavaServiceInvoker.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** JavaServiceInvoker.java	5 Aug 2003 07:41:52 -0000	1.19
--- JavaServiceInvoker.java	5 Aug 2003 20:49:28 -0000	1.20
***************
*** 54,58 ****
  			//use the cause since the exception is thrown when 
  			//the service method throws an exception
! 			throw new ServiceInvocationException(request, e.getCause());
  		} catch (Exception e) {
  			throw new ServiceInvocationException(request, e);
--- 54,58 ----
  			//use the cause since the exception is thrown when 
  			//the service method throws an exception
! 			throw new ServiceInvocationException(request, e.getTargetException());
  		} catch (Exception e) {
  			throw new ServiceInvocationException(request, e);

Index: ServiceInvocationException.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/invoker/ServiceInvocationException.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ServiceInvocationException.java	5 Aug 2003 19:04:25 -0000	1.11
--- ServiceInvocationException.java	5 Aug 2003 20:49:28 -0000	1.12
***************
*** 4,7 ****
--- 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;
***************
*** 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(
--- 16,21 ----
***************
*** 27,32 ****
  
  		super(cause);
- 
- 		this.cause = cause;
  		this.requestBody = requestBody;
  	}
--- 24,27 ----
***************
*** 37,86 ****
  
  		super(cause);
- 
- 		this.cause = cause;
  		this.request = request;
  	}
  	
  	public AMFError getAMFError() {
- 		
  		AMFError amfError = new AMFError();
! 		
! 		Throwable rootCause = getRootCause(cause);
! 		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() {
- 		return getRootCause(cause);
  	}
  
- 	private Throwable getRootCause(Throwable cause) {
- 		
- 		if (cause.getCause() == null) {
- 			return cause;
- 		} else {
- 			return getRootCause(cause.getCause());
- 		}
- 		
- 	}
- 	
  	private String getErrorValue(Throwable cause, String methodName, String defaultValue) {
- 		
  		String value = null;
- 		
  		try {
  			Method method = cause.getClass().getMethod(methodName, new Class[0]);
--- 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]);
***************
*** 91,97 ****
  			value = defaultValue;
  		}
- 		
  		return value;
  	}
- 
  }
--- 56,60 ----




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