From 246b3602b5aadb7592cff0fd75130bf45ccc95b5 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Wed, 24 May 2023 14:39:39 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-95576=20spring=20framework=20=E9=AB=98?= =?UTF-8?q?=E5=8D=B1=E6=BC=8F=E6=B4=9E=EF=BC=8C=E9=9C=80=E8=A6=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractRemoteSlsbInvokerInterceptor.java | 4 +- .../SimpleRemoteSlsbInvokerInterceptor.java | 40 +++---------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/fine-spring/src/main/java/com/fr/third/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java b/fine-spring/src/main/java/com/fr/third/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java index 21cf6add0..84dec0b06 100644 --- a/fine-spring/src/main/java/com/fr/third/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java +++ b/fine-spring/src/main/java/com/fr/third/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java @@ -22,13 +22,11 @@ import java.rmi.RemoteException; import javax.ejb.EJBHome; import javax.ejb.EJBObject; import javax.naming.NamingException; -import javax.rmi.PortableRemoteObject; import org.aopalliance.intercept.MethodInvocation; import com.fr.third.springframework.remoting.RemoteConnectFailureException; import com.fr.third.springframework.remoting.RemoteLookupFailureException; -import com.fr.third.springframework.remoting.rmi.RmiClientInterceptorUtils; /** * Base class for interceptors proxying remote Stateless Session Beans. @@ -162,7 +160,7 @@ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbI * @see com.fr.third.springframework.remoting.rmi.RmiClientInterceptorUtils#isConnectFailure */ protected boolean isConnectFailure(RemoteException ex) { - return RmiClientInterceptorUtils.isConnectFailure(ex); + throw new UnsupportedOperationException(); } private Object handleRemoteConnectFailure(MethodInvocation invocation, Exception ex) throws Throwable { diff --git a/fine-spring/src/main/java/com/fr/third/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptor.java b/fine-spring/src/main/java/com/fr/third/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptor.java index 58c97eb76..2360b6808 100644 --- a/fine-spring/src/main/java/com/fr/third/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptor.java +++ b/fine-spring/src/main/java/com/fr/third/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptor.java @@ -16,17 +16,12 @@ package com.fr.third.springframework.ejb.access; -import java.lang.reflect.InvocationTargetException; -import java.rmi.RemoteException; -import javax.ejb.CreateException; -import javax.ejb.EJBObject; -import javax.naming.NamingException; - +import com.fr.third.springframework.beans.factory.DisposableBean; import org.aopalliance.intercept.MethodInvocation; -import com.fr.third.springframework.beans.factory.DisposableBean; -import com.fr.third.springframework.remoting.RemoteLookupFailureException; -import com.fr.third.springframework.remoting.rmi.RmiClientInterceptorUtils; +import javax.ejb.EJBObject; +import javax.naming.NamingException; +import java.lang.reflect.InvocationTargetException; /** * Basic invoker for a remote Stateless Session Bean. @@ -92,32 +87,7 @@ public class SimpleRemoteSlsbInvokerInterceptor extends AbstractRemoteSlsbInvoke */ @Override protected Object doInvoke(MethodInvocation invocation) throws Throwable { - Object ejb = null; - try { - ejb = getSessionBeanInstance(); - return RmiClientInterceptorUtils.invokeRemoteMethod(invocation, ejb); - } - catch (NamingException ex) { - throw new RemoteLookupFailureException("Failed to locate remote EJB [" + getJndiName() + "]", ex); - } - catch (InvocationTargetException ex) { - Throwable targetEx = ex.getTargetException(); - if (targetEx instanceof RemoteException) { - RemoteException rex = (RemoteException) targetEx; - throw RmiClientInterceptorUtils.convertRmiAccessException( - invocation.getMethod(), rex, isConnectFailure(rex), getJndiName()); - } - else if (targetEx instanceof CreateException) { - throw RmiClientInterceptorUtils.convertRmiAccessException( - invocation.getMethod(), targetEx, "Could not create remote EJB [" + getJndiName() + "]"); - } - throw targetEx; - } - finally { - if (ejb instanceof EJBObject) { - releaseSessionBeanInstance((EJBObject) ejb); - } - } + throw new UnsupportedOperationException(); } /**