dblevins 2005/08/25 00:46:49
Modified: modules/core/src/java/org/openejb/core/ivm
BaseEjbProxyHandler.java EjbHomeProxyHandler.java
Log:
Fixed some exception handling for local interfaces.
Revision Changes Path
1.5 +10 -4
openejb1/modules/core/src/java/org/openejb/core/ivm/BaseEjbProxyHandler.java
Index: BaseEjbProxyHandler.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/core/ivm/BaseEjbProxyHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BaseEjbProxyHandler.java 23 Aug 2005 04:18:58 -0000 1.4
+++ BaseEjbProxyHandler.java 25 Aug 2005 04:46:49 -0000 1.5
@@ -279,7 +279,7 @@
}
String jndiEnc =
System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
-
System.setProperty(javax.naming.Context.URL_PKG_PREFIXES,"org.openejb.core.ivm.naming");
+//
System.setProperty(javax.naming.Context.URL_PKG_PREFIXES,"org.openejb.core.ivm.naming");
// the four operations on IntraVmCopyMonitor are quite expensive,
because
// all of them require a Thread.currentThread() operation, which is
native code
try{
@@ -314,6 +314,12 @@
*/
return _invoke(proxy,method,args);
+ } catch (RemoteException e) {
+ if (this.isLocal()){
+ throw new
EJBException(e.getMessage()).initCause(e.getCause());
+ } else {
+ throw e;
+ }
} catch (Throwable t) {
t.printStackTrace();
Class[] etypes =
method.getExceptionTypes();
@@ -325,14 +331,14 @@
}
// Exception is undeclared
// Try and find a runtime exception in
there
- while (!(t instanceof
RuntimeException)){
+ while (t.getCause() != null && !(t
instanceof RuntimeException)){
t = t.getCause();
}
throw t;
}
}
} finally {
- System.setProperty(javax.naming.Context.URL_PKG_PREFIXES,
jndiEnc);
+// System.setProperty(javax.naming.Context.URL_PKG_PREFIXES,
jndiEnc);
// restore the context
if(cntextValid){
cntext.set(depInfo, prmryKey, scrtyIdentity);
1.5 +26 -5
openejb1/modules/core/src/java/org/openejb/core/ivm/EjbHomeProxyHandler.java
Index: EjbHomeProxyHandler.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/core/ivm/EjbHomeProxyHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EjbHomeProxyHandler.java 19 Jun 2005 22:40:31 -0000 1.4
+++ EjbHomeProxyHandler.java 25 Aug 2005 04:46:49 -0000 1.5
@@ -51,6 +51,7 @@
import java.rmi.RemoteException;
import javax.ejb.EJBHome;
+import javax.ejb.EJBException;
import org.openejb.ProxyInfo;
import org.openejb.RpcContainer;
@@ -184,8 +185,20 @@
* The ire is thrown by the container system and propagated by
* the server to the stub.
*/
- }catch ( org.openejb.InvalidateReferenceException ire ) {
- throw ire.getRootCause();
+ } catch (RemoteException re) {
+ if (isLocal()){
+ throw new EJBException(re.getMessage(),(Exception)re.detail);
+ } else {
+ throw re;
+ }
+
+ } catch ( org.openejb.InvalidateReferenceException ire ) {
+ Throwable cause = ire.getRootCause();
+ if (cause instanceof RemoteException && isLocal()){
+ RemoteException re = (RemoteException)cause;
+ cause = new
EJBException(re.getMessage(),(Exception)re.detail);
+ }
+ throw cause;
/*
* Application exceptions must be reported dirctly to the client.
They
* do not impact the viability of the proxy.
@@ -197,9 +210,17 @@
* problem with the container system.
*/
} catch ( org.openejb.SystemException se ) {
- throw new RemoteException("Container has suffered a
SystemException",se.getRootCause());
+ if (isLocal()){
+ throw new EJBException("Container has suffered a
SystemException", (Exception)se.getRootCause());
+ } else {
+ throw new RemoteException("Container has suffered a
SystemException",se.getRootCause());
+ }
} catch ( org.openejb.OpenEJBException oe ) {
- throw new RemoteException("Unknown Container
Exception",oe.getRootCause());
+ if (isLocal()){
+ throw new EJBException("Unknown Container Exception",
(Exception)oe.getRootCause());
+ } else {
+ throw new RemoteException("Unknown Container
Exception",oe.getRootCause());
+ }
} catch(Throwable t) {
logger.info("finished invoking method "+method.getName()+" with
exception:"+t, t);
throw t;