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 2014/02/10 11:49:04 UTC

svn commit: r1566574 - in /tomee/tomee/trunk: examples/moviefun/pom.xml pom.xml tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java

Author: andygumbrecht
Date: Mon Feb 10 10:49:03 2014
New Revision: 1566574

URL: http://svn.apache.org/r1566574
Log:
Formatting finals and bump up a few versions.

Modified:
    tomee/tomee/trunk/examples/moviefun/pom.xml
    tomee/tomee/trunk/pom.xml
    tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java

Modified: tomee/tomee/trunk/examples/moviefun/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/moviefun/pom.xml?rev=1566574&r1=1566573&r2=1566574&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/moviefun/pom.xml (original)
+++ tomee/tomee/trunk/examples/moviefun/pom.xml Mon Feb 10 10:49:03 2014
@@ -79,7 +79,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.0</version>
+        <version>3.1</version>
         <configuration>
           <source>1.6</source>
           <target>1.6</target>
@@ -87,7 +87,7 @@
       </plugin>
       <plugin>
         <artifactId>maven-eclipse-plugin</artifactId>
-        <version>2.8</version>
+        <version>2.9</version>
         <configuration>
           <configuration>
             <wtpapplicationxml>true</wtpapplicationxml>
@@ -121,7 +121,7 @@
       <dependency>
         <groupId>org.jboss.arquillian</groupId>
         <artifactId>arquillian-bom</artifactId>
-        <version>1.0.3.Final</version>
+        <version>1.1.2.Final</version>
         <scope>import</scope>
         <type>pom</type>
       </dependency>

Modified: tomee/tomee/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/pom.xml?rev=1566574&r1=1566573&r2=1566574&view=diff
==============================================================================
--- tomee/tomee/trunk/pom.xml (original)
+++ tomee/tomee/trunk/pom.xml Mon Feb 10 10:49:03 2014
@@ -149,13 +149,12 @@
     <commons-dbcp.version>1.4</commons-dbcp.version>
     <commons-pool.version>1.5.7</commons-pool.version>
     <commons-collections.version>3.2.1</commons-collections.version>
-    <commons-codec.version>1.7</commons-codec.version>
+    <commons-codec.version>1.9</commons-codec.version>
     <commons-fileupload.version>1.2.2</commons-fileupload.version>
     <commons-discovery.version>0.5</commons-discovery.version>
-    <commons-lang3.version>3.1</commons-lang3.version>
-    <commons-lang.version>2.6</commons-lang.version>
+    <commons-lang3.version>3.2.1</commons-lang3.version>
     <commons-io.version>2.0.1</commons-io.version>
-    <commons-net.version>3.2</commons-net.version>
+    <commons-net.version>3.3</commons-net.version>
 
     <bval.version>0.5</bval.version>
     <org.apache.activemq.version>5.9.0</org.apache.activemq.version>

Modified: tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java?rev=1566574&r1=1566573&r2=1566574&view=diff
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java (original)
+++ tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java Mon Feb 10 10:49:03 2014
@@ -198,11 +198,12 @@ public class TomcatWebAppBuilder impleme
     private static final boolean SKIP_TLD = SystemInstance.get().getOptions().get("tomee.skip-tld", false);
 
     private static Method getNamingContextName = null; // it just sucks but that's private
+
     static {
         try {
             getNamingContextName = StandardContext.class.getDeclaredMethod("getNamingContextName");
             getNamingContextName.setAccessible(true);
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
             throw new OpenEJBRuntimeException("can't find method getNamingContextName", e);
         }
     }
@@ -325,7 +326,7 @@ public class TomcatWebAppBuilder impleme
         try {
             final Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass("javax.websocket.server.ServerEndpointConfig$Configurator");
             final Field f = clazz.getDeclaredField("defaultImpl");
-            boolean acc = f.isAccessible();
+            final boolean acc = f.isAccessible();
             f.setAccessible(true);
             try {
                 f.set(null, new JavaEEDefaultServerEnpointConfigurator(instanceManagers));
@@ -361,8 +362,8 @@ public class TomcatWebAppBuilder impleme
     private void addTomEERealm(final Engine engine) {
         final Realm realm = engine.getRealm();
         if (realm != null && !(realm instanceof TomEERealm)
-            && (engine.getParent() == null
-                    || (engine.getParent() != null && !realm.equals(engine.getParent().getRealm())))) {
+                && (engine.getParent() == null
+                || (engine.getParent() != null && !realm.equals(engine.getParent().getRealm())))) {
             engine.setRealm(tomeeRealm(realm));
         }
     }
@@ -418,7 +419,7 @@ public class TomcatWebAppBuilder impleme
                         mudb.setReadonly(oldRo);
                     }
                 }
-            } catch (Throwable t) {
+            } catch (final Throwable t) {
                 // no-op
             }
         }
@@ -491,7 +492,7 @@ public class TomcatWebAppBuilder impleme
                     try {
                         standardContext = (StandardContext) CONTEXT_DIGESTER.parse(contextXml);
                         standardContext.setConfigFile(contextXmlUrl);
-                    } catch (Exception e) {
+                    } catch (final Exception e) {
                         logger.error("can't parse context xml for webapp " + webApp.path, e);
                         standardContext = new StandardContext();
                     } finally {
@@ -624,7 +625,7 @@ public class TomcatWebAppBuilder impleme
     }
 
     public synchronized ContextInfo standaAloneWebAppInfo(final File file) {
-        for (ContextInfo info : infos.values()) {
+        for (final ContextInfo info : infos.values()) {
             if (info.appInfo != null && info.appInfo.webAppAlone
                     && ((file.equals(new File(info.appInfo.path)) || file.equals(new File(info.appInfo.path + ".war"))))) {
                 return info;
@@ -636,7 +637,7 @@ public class TomcatWebAppBuilder impleme
 
         // still not found - trying another algorithm - weird but it seems to happen
         final String path = file.getAbsolutePath();
-        for (ContextInfo info : infos.values()) {
+        for (final ContextInfo info : infos.values()) {
             if (info.appInfo != null && info.appInfo.webAppAlone
                     && (info.appInfo.path.endsWith(path) || (info.appInfo.path + ".war").endsWith(path))) {
                 return info;
@@ -648,7 +649,7 @@ public class TomcatWebAppBuilder impleme
 
     public synchronized Collection<String> availableApps() {
         final Collection<String> apps = new ArrayList<String>();
-        for (ContextInfo info : infos.values()) {
+        for (final ContextInfo info : infos.values()) {
             if (info.appInfo != null) {
                 apps.add(info.appInfo.path);
             } else if (info.standardContext != null) {
@@ -664,7 +665,7 @@ public class TomcatWebAppBuilder impleme
     static {
         try { // do it only once
             HOST_CONFIG_HOST = HostConfig.class.getDeclaredField("host");
-        } catch (NoSuchFieldException e) {
+        } catch (final NoSuchFieldException e) {
             // no-op
         }
     }
@@ -673,7 +674,7 @@ public class TomcatWebAppBuilder impleme
         if (deployer != null && HOST_CONFIG_HOST != null) {
             try {
                 return HOST_CONFIG_HOST.get(deployer) != null;
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 // no-op
             }
         }
@@ -690,7 +691,7 @@ public class TomcatWebAppBuilder impleme
             if (classLoader != null) {
                 try { // if myfaces is not here we doesn't need any trick
                     classLoader.loadClass("org.apache.myfaces.shared.config.MyfacesConfig");
-                } catch (ClassNotFoundException cnfe) {
+                } catch (final ClassNotFoundException cnfe) {
                     return;
                 }
             }
@@ -788,7 +789,7 @@ public class TomcatWebAppBuilder impleme
         if (!warFile.isDirectory()) {
             try {
                 warFile = DeploymentLoader.unpack(warFile);
-            } catch (OpenEJBException e) {
+            } catch (final OpenEJBException e) {
                 logger.error("can't unpack '" + warFile.getAbsolutePath() + "'");
             }
         }
@@ -804,7 +805,7 @@ public class TomcatWebAppBuilder impleme
             if (sessionManagerClass == null) {
                 try { // the manager should be in standardclassloader
                     sessionManagerClass = TomcatHelper.getServer().getParentClassLoader().loadClass(sessionManager);
-                } catch (ClassNotFoundException e) {
+                } catch (final ClassNotFoundException e) {
                     logger.error("can't find '" + sessionManager + "', StandardManager will be used", e);
                     sessionManagerClass = StandardManager.class;
                 }
@@ -813,7 +814,7 @@ public class TomcatWebAppBuilder impleme
             try {
                 final Manager mgr = (Manager) sessionManagerClass.newInstance();
                 standardContext.setManager(mgr);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 logger.error("can't instantiate '" + sessionManager + "', StandardManager will be used", e);
             }
         } else if (standardContext.getCluster() == null) { // else let it use the cluster to create the manager
@@ -841,7 +842,7 @@ public class TomcatWebAppBuilder impleme
         final NamingContextListener ncl = new NamingContextListener();
         try {
             ncl.setName((String) getNamingContextName.invoke(standardContext));
-        } catch (Exception e) {
+        } catch (final Exception e) {
             ncl.setName(getId(standardContext));
         }
         ncl.setExceptionOnFailedWrite(standardContext.getJndiExceptionOnFailedWrite());
@@ -886,7 +887,7 @@ public class TomcatWebAppBuilder impleme
 
     public ContextInfo getContextInfo(final String appName) {
         ContextInfo info = null;
-        for (Map.Entry<String, ContextInfo> current : infos.entrySet()) {
+        for (final Map.Entry<String, ContextInfo> current : infos.entrySet()) {
             final String key = current.getKey();
             if (key.equals(appName)) {
                 info = current.getValue();
@@ -965,7 +966,7 @@ public class TomcatWebAppBuilder impleme
 
             return "StandardContextInfo{" +
                     "standardContext=" + standardContext +
-                '}';
+                    '}';
         }
     }
 
@@ -1010,9 +1011,9 @@ public class TomcatWebAppBuilder impleme
         final Loader standardContextLoader = standardContext.getLoader();
         if (standardContextLoader != null
                 && (
-                       (!VirtualWebappLoader.class.equals(standardContextLoader.getClass()) && !WebappLoader.class.equals(standardContextLoader.getClass()))
-                    || (WebappLoader.class.equals(standardContextLoader.getClass()) && !WebappLoader.class.cast(standardContextLoader).getLoaderClass().startsWith("org.apache.tom")))
-            ) {
+                (!VirtualWebappLoader.class.equals(standardContextLoader.getClass()) && !WebappLoader.class.equals(standardContextLoader.getClass()))
+                        || (WebappLoader.class.equals(standardContextLoader.getClass()) && !WebappLoader.class.cast(standardContextLoader).getLoaderClass().startsWith("org.apache.tom")))
+                ) {
             // custom loader, we don't know it
             // and since we don't have a full delegate pattern for our lazy stop loader
             // simply skip lazy stop loader - normally sides effect will be an early shutdown for ears and some particular features
@@ -1096,7 +1097,7 @@ public class TomcatWebAppBuilder impleme
 
                 // add them to the app as resource
                 final OpenEJBNamingResource nr = (OpenEJBNamingResource) standardContext.getNamingResources();
-                for (ResourceBase resource : nr.getTomcatResources()) {
+                for (final ResourceBase resource : nr.getTomcatResources()) {
                     final String name = resource.getName();
                     if (!importedNames.contains(name)) {
                         importedNames.add(name);
@@ -1105,7 +1106,7 @@ public class TomcatWebAppBuilder impleme
                     }
 
                     boolean found = false;
-                    for (ResourceInfo r : SystemInstance.get().getComponent(OpenEjbConfiguration.class).facilities.resources) {
+                    for (final ResourceInfo r : SystemInstance.get().getComponent(OpenEjbConfiguration.class).facilities.resources) {
                         if (r.id.equals(name)) {
                             nr.removeResource(name);
                             found = true;
@@ -1175,12 +1176,12 @@ public class TomcatWebAppBuilder impleme
                     DeployerEjb.AUTO_DEPLOY.remove();
 
                     if (!appModule.isWebapp()) {
-                    	classLoader = appModule.getClassLoader();
+                        classLoader = appModule.getClassLoader();
                     } else {
                         final ClassLoader loader = standardContext.getLoader().getClassLoader();
                         if (loader instanceof LazyStopWebappClassLoader) {
                             final LazyStopWebappClassLoader lazyStopWebappClassLoader = (LazyStopWebappClassLoader) loader;
-                            for (URL url : appModule.getWebModules().iterator().next().getAddedUrls()) {
+                            for (final URL url : appModule.getWebModules().iterator().next().getAddedUrls()) {
                                 lazyStopWebappClassLoader.addURL(url);
                             }
                         }
@@ -1207,7 +1208,7 @@ public class TomcatWebAppBuilder impleme
                     // todo add watched resources to context
 
                     eagerInitOfLocalBeanProxies(appContext.getBeanContexts(), classLoader);
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     logger.error("Unable to deploy collapsed ear in war " + standardContext, e);
                     undeploy(standardContext, contextInfo);
                     // just to force tomee to start without EE part
@@ -1286,15 +1287,15 @@ public class TomcatWebAppBuilder impleme
                 }
 
                 // create EMF included in this webapp when nested in an ear
-                for (PersistenceUnitInfo unitInfo : contextInfo.appInfo.persistenceUnits) {
+                for (final PersistenceUnitInfo unitInfo : contextInfo.appInfo.persistenceUnits) {
                     if (unitInfo.webappName != null && unitInfo.webappName.equals(webAppInfo.moduleId)) {
                         try {
                             final ReloadableEntityManagerFactory remf =
-                                (ReloadableEntityManagerFactory) SystemInstance.get().getComponent(ContainerSystem.class)
-                                        .getJNDIContext().lookup(Assembler.PERSISTENCE_UNIT_NAMING_CONTEXT + unitInfo.id);
+                                    (ReloadableEntityManagerFactory) SystemInstance.get().getComponent(ContainerSystem.class)
+                                            .getJNDIContext().lookup(Assembler.PERSISTENCE_UNIT_NAMING_CONTEXT + unitInfo.id);
                             remf.overrideClassLoader(classLoader);
                             remf.createDelegate();
-                        } catch (NameNotFoundException nnfe) {
+                        } catch (final NameNotFoundException nnfe) {
                             logger.warning("Can't find " + unitInfo.id + " persistence unit");
                         }
                     }
@@ -1336,7 +1337,7 @@ public class TomcatWebAppBuilder impleme
                 instanceManagers.put(classLoader, instanceManager);
                 standardContext.getServletContext().setAttribute(InstanceManager.class.getName(), standardContext.getInstanceManager());
 
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 logger.error("Error merging Java EE JNDI entries in to war " + standardContext.getPath() + ": Exception: " + e.getMessage(), e);
             }
 
@@ -1407,9 +1408,9 @@ public class TomcatWebAppBuilder impleme
 
         final Iterator<String> params = resource.listProperties();
         while (params.hasNext()) {
-            String paramName = params.next();
-            String paramValue = (String) resource.getProperty(paramName);
-            StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
+            final String paramName = params.next();
+            final String paramValue = (String) resource.getProperty(paramName);
+            final StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
             ref.add(refAddr);
         }
 
@@ -1430,7 +1431,7 @@ public class TomcatWebAppBuilder impleme
                     } else {
                         injection.setTarget(target);
                     }
-                } catch (ClassNotFoundException cnfe) {
+                } catch (final ClassNotFoundException cnfe) {
                     // ignored
                 }
             }
@@ -1568,7 +1569,7 @@ public class TomcatWebAppBuilder impleme
                 try {
                     // Bean Validation
                     standardContext.getServletContext().setAttribute("javax.faces.validator.beanValidator.ValidatorFactory", openejbContext.lookup(Assembler.VALIDATOR_FACTORY_NAMING_CONTEXT.replaceFirst("openejb", "") + currentWebAppInfo.uniqueId));
-                } catch (NamingException ne) {
+                } catch (final NamingException ne) {
                     logger.warning("no validator factory found for webapp " + currentWebAppInfo.moduleId);
                 }
             }
@@ -1615,7 +1616,7 @@ public class TomcatWebAppBuilder impleme
                         wrapper.addInstanceListener(new ProcessAnnotatedServletsListener(annotationProcessor));
                     }
                 }
-            } catch (NamingException e) {
+            } catch (final NamingException e) {
                 // no-op
             }
         }
@@ -1686,7 +1687,7 @@ public class TomcatWebAppBuilder impleme
                     final Valve valve = (Valve) clazz.newInstance();
                     pipeline.addValve(valve);
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 logger.error("can't add the valve " + className, e);
             }
         }
@@ -1828,7 +1829,7 @@ public class TomcatWebAppBuilder impleme
         if (isUnDeployable(contextInfo)) {
             try {
                 getAssembler().destroyApplication(contextInfo.appInfo.path);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 logger.error("Unable to stop web application " + standardContext.getPath() + ": Exception: " + e.getMessage(), e);
             }
         }
@@ -1838,7 +1839,7 @@ public class TomcatWebAppBuilder impleme
         if (old != null) {
             try {
                 old.internalStop();
-            } catch (LifecycleException e) {
+            } catch (final LifecycleException e) {
                 logger.error("error stopping classloader of webapp " + standardContext.getName(), e);
             }
             ClassLoaderUtil.cleanOpenJPACache(old);
@@ -1888,14 +1889,14 @@ public class TomcatWebAppBuilder impleme
     public synchronized void checkHost(final StandardHost standardHost) {
         if (standardHost.getAutoDeploy()) {
             // Undeploy any modified application
-            for (Iterator<Map.Entry<String, DeployedApplication>> iterator = deployedApps.entrySet().iterator(); iterator.hasNext(); ) {
+            for (final Iterator<Map.Entry<String, DeployedApplication>> iterator = deployedApps.entrySet().iterator(); iterator.hasNext(); ) {
                 final Map.Entry<String, DeployedApplication> entry = iterator.next();
                 final DeployedApplication deployedApplication = entry.getValue();
                 if (deployedApplication.isModified()) { // TODO: for war use StandardContext.redeploy()
                     if (deployedApplication.appInfo != null) { // can happen with badly formed config
                         try {
                             getAssembler().destroyApplication(deployedApplication.appInfo.path);
-                        } catch (Exception e) {
+                        } catch (final Exception e) {
                             logger.error("Unable to application " + deployedApplication.appInfo.path, e);
                         }
                     } else {
@@ -1960,12 +1961,12 @@ public class TomcatWebAppBuilder impleme
                             if (context != null) {
                                 try {
                                     standardHost.removeChild(context);
-                                } catch (Throwable t) {
+                                } catch (final Throwable t) {
                                     logger.warning("Error undeploying wep application from Tomcat  " + name, t);
                                 }
                                 try {
                                     context.destroy();
-                                } catch (Throwable t) {
+                                } catch (final Throwable t) {
                                     logger.warning("Error destroying Tomcat web context " + name, t);
                                 }
                             }
@@ -1974,7 +1975,7 @@ public class TomcatWebAppBuilder impleme
                         getAssembler().createApplication(appInfo);
 
                         deployedApps.put(file.getAbsolutePath(), new DeployedApplication(file, appInfo));
-                    } catch (Throwable e) {
+                    } catch (final Throwable e) {
                         logger.warning("Error deploying application " + file.getAbsolutePath(), e);
                     }
                 }
@@ -2020,8 +2021,8 @@ public class TomcatWebAppBuilder impleme
         }
         try {
             file = file.getCanonicalFile();
-        } catch (IOException e) {
-            logger.debug(e.getMessage(),e);
+        } catch (final IOException e) {
+            logger.debug(e.getMessage(), e);
         }
         return file;
     }
@@ -2046,7 +2047,7 @@ public class TomcatWebAppBuilder impleme
         final AppModule appModule;
         try {
             appModule = tomcatDeploymentLoader.load(Contexts.warPath(standardContext));
-        } catch (OpenEJBException e) {
+        } catch (final OpenEJBException e) {
             throw new TomEERuntimeException(e);
         }
 
@@ -2131,10 +2132,10 @@ public class TomcatWebAppBuilder impleme
         try {
             comp.lookup(name);
             logger.debug(name + " already bound, ignoring");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             try {
                 comp.bind(name, value);
-            } catch (NamingException ne) {
+            } catch (final NamingException ne) {
                 logger.error("Error in safeBind method", e);
             }
         }
@@ -2278,7 +2279,7 @@ public class TomcatWebAppBuilder impleme
                     + "appInfo = " + appInfo + ", "
                     + "deployer = " + deployer + ", "
                     + "host = " + host
-                + "}";
+                    + "}";
         }
     }