You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2016/02/19 17:13:17 UTC
[3/5] tomee git commit: Check for null & do not mask error
Check for null & do not mask error
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/1e1ad4d2
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/1e1ad4d2
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/1e1ad4d2
Branch: refs/heads/tomee-1.7.x
Commit: 1e1ad4d273c5277f60be2a215cee564185ea1552
Parents: c6304d4
Author: AndyGee <an...@gmx.de>
Authored: Fri Feb 19 16:25:42 2016 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Fri Feb 19 16:25:42 2016 +0100
----------------------------------------------------------------------
.../openejb/core/ivm/BaseEjbProxyHandler.java | 22 ++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/1e1ad4d2/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java
index e3dddbc..5067f2b 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java
@@ -285,6 +285,9 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ
try {
if (callContext == null && localClientIdentity != null) {
final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
+ if(null == securityService){
+ throw new RuntimeException("SecurityService has not been initialized");
+ }
securityService.associate(localClientIdentity);
}
if (strategy == CLASSLOADER_COPY || getBeanContext().getInterfaceType(interfce) == InterfaceType.BUSINESS_REMOTE) {
@@ -301,7 +304,7 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ
IntraVmCopyMonitor.post();
}
- } else if (strategy == COPY && args != null && args.length > 0) {
+ } else if (strategy == COPY && args.length > 0) {
IntraVmCopyMonitor.pre(strategy);
try {
@@ -330,7 +333,9 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ
if (callContext == null && localClientIdentity != null) {
final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
- securityService.disassociate();
+ if(null != securityService){
+ securityService.disassociate();
+ }
}
}
}
@@ -521,7 +526,7 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ
protected Object[] copyArgs(final Object[] objects) throws IOException, ClassNotFoundException {
if (objects == null) {
- return objects;
+ return null;
}
/*
while copying the arguments is necessary. Its not necessary to copy the array itself,
@@ -631,7 +636,11 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ
public BeanContext getBeanContext() {
final BeanContext beanContext = beanContextRef.get();
if (beanContext == null || beanContext.isDestroyed()) {
- invalidateReference();
+ try {
+ invalidateReference();
+ } catch (final IllegalStateException e) {
+ //no-op, as we are about to throw a better reason
+ }
throw new IllegalStateException("Bean '" + deploymentID + "' has been undeployed.");
}
return beanContext;
@@ -663,6 +672,11 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ
in.defaultReadObject();
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
+
+ if(null == containerSystem){
+ throw new RuntimeException("ContainerSystem has not been initialized");
+ }
+
setBeanContext(containerSystem.getBeanContext(deploymentID));
container = (RpcContainer) getBeanContext().getContainer();