Package: TomcatResourceFactory

TomcatResourceFactory

nameinstructionbranchcomplexitylinemethod
TomcatResourceFactory()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
create(String, StandardContext)
M: 30 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package org.eclipse.virgo.web.enterprise.openejb.tomcat.factory;
2:
3: import javax.naming.Context;
4: import javax.naming.NamingException;
5:
6: import org.apache.catalina.core.StandardContext;
7:
8: import org.apache.openejb.util.Logger;
9: import org.apache.openejb.util.LogCategory;
10:
11: public class TomcatResourceFactory {
12: private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB.createChild("tr"), TomcatResourceFactory.class);
13:
14: public static Object create(String jndiName, StandardContext standardContext) throws NamingException {
15:• if (standardContext == null) {
16: return null;
17: }
18:
19: Context context = standardContext.getNamingContextListener().getEnvContext();
20: try {
21:•         if (context != null) {
22: return context.lookup(jndiName);
23: } else {
24: return null;
25: }
26: } catch (NamingException e) {
27: LOGGER.error("Error while looking up " + jndiName, e);
28: throw(e);
29: }
30: }
31: }