You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2016/04/04 00:15:19 UTC
[1/3] tomee git commit: Catch any exception,
might not just be a naming exception here
Repository: tomee
Updated Branches:
refs/heads/tomee-1.7.x 4f346a2b1 -> 209378d39
Catch any exception, might not just be a naming exception here
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/c3c5d1a2
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/c3c5d1a2
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/c3c5d1a2
Branch: refs/heads/tomee-1.7.x
Commit: c3c5d1a237eecd6ba2fcb3749d27f22fddf79a44
Parents: 4f346a2
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Thu Mar 31 10:34:58 2016 +0100
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Thu Mar 31 10:34:58 2016 +0100
----------------------------------------------------------------------
.../java/org/apache/openejb/assembler/classic/Assembler.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/c3c5d1a2/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
index b1e69fc..b7093fe 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
@@ -2258,8 +2258,8 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A
try {
object = globalContext.lookup(name);
- } catch (final NamingException e) {
- // if we catch a NamingException, check to see if the resource is a LaztObjectReference that has not been initialized correctly
+ } catch (final Exception e) {
+ // if we catch an Exception, check to see if the resource is a LaztObjectReference that has not been initialized correctly
final String ctx = name.substring(0, name.lastIndexOf("/"));
final String objName = name.substring(ctx.length() + 1);
[3/3] tomee git commit: Check for LazyObjectReference first
Posted by jg...@apache.org.
Check for LazyObjectReference first
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/209378d3
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/209378d3
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/209378d3
Branch: refs/heads/tomee-1.7.x
Commit: 209378d3913bd75076b3cbd5a931e3a27d84ac7d
Parents: 8610ae1
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Fri Apr 1 23:27:04 2016 +0100
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Fri Apr 1 23:27:04 2016 +0100
----------------------------------------------------------------------
.../openejb/assembler/classic/Assembler.java | 47 +++++++++-----------
1 file changed, 21 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/209378d3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
index dd29878..8464957 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
@@ -2253,38 +2253,33 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A
}
private void destroyLookedUpResource(final Context globalContext, final String id, final String name) throws NamingException {
+ // check to see if the resource is a LazyObjectReference that has not been initialized
+ // if it is, we'll remove the LazyObjectReference, rather than do a lookup causing it
+ // to be instantiated
+ final String ctx = name.substring(0, name.lastIndexOf("/"));
+ final String objName = name.substring(ctx.length() + 1);
- Object object = null;
-
- try {
- object = globalContext.lookup(name);
- } catch (final Exception e) {
- // if we catch an Exception, check to see if the resource is a LaztObjectReference that has not been initialized correctly
- final String ctx = name.substring(0, name.lastIndexOf("/"));
- final String objName = name.substring(ctx.length() + 1);
+ final NamingEnumeration<Binding> bindings = globalContext.listBindings(ctx);
+ while (bindings.hasMoreElements()) {
+ final Binding binding = bindings.nextElement();
+ if (!binding.getName().equals(objName)) {
+ continue;
+ }
- final NamingEnumeration<Binding> bindings = globalContext.listBindings(ctx);
- while (bindings.hasMoreElements()) {
- final Binding binding = bindings.nextElement();
- if (!binding.getName().equals(objName)) {
- continue;
- }
-
- if (!LazyObjectReference.class.isInstance(binding.getObject())) {
- continue;
- }
-
- final LazyObjectReference<?> ref = LazyObjectReference.class.cast(binding.getObject());
- if (! ref.isInitialized()) {
- globalContext.unbind(name);
- removeResourceInfo(name);
- return;
- }
+ if (!LazyObjectReference.class.isInstance(binding.getObject())) {
+ continue;
}
- throw new NamingException(e.getMessage());
+ final LazyObjectReference<?> ref = LazyObjectReference.class.cast(binding.getObject());
+ if (! ref.isInitialized()) {
+ globalContext.unbind(name);
+ removeResourceInfo(name);
+ return;
+ }
}
+ // otherwise, look the object up and remove it
+ final Object object = globalContext.lookup(name);
final String clazz;
if (object == null) { // should it be possible?
clazz = "?";
[2/3] tomee git commit: Throw naming exception
Posted by jg...@apache.org.
Throw naming exception
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/8610ae1e
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/8610ae1e
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/8610ae1e
Branch: refs/heads/tomee-1.7.x
Commit: 8610ae1eee4c00fe501084ee248fe824bba6ab18
Parents: c3c5d1a
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Thu Mar 31 10:42:34 2016 +0100
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Thu Mar 31 10:42:34 2016 +0100
----------------------------------------------------------------------
.../main/java/org/apache/openejb/assembler/classic/Assembler.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/8610ae1e/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
index b7093fe..dd29878 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
@@ -2282,7 +2282,7 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A
}
}
- throw e;
+ throw new NamingException(e.getMessage());
}
final String clazz;