Author: rmannibucau Date: Fri Jul 25 17:24:36 2014 New Revision: 1613479 URL: http://svn.apache.org/r1613479 Log: style, dependency name and avoiding warning cause of tomcat implicit classloader contract
Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/pom.xml tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/remote/TomEERemoteWebapp.java tomee/tomee/trunk/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/NoopLogger.java tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java tomee/tomee/trunk/utils/openejb-core-hibernate/pom.xml Modified: tomee/tomee/trunk/examples/deltaspike-fullstack/pom.xml URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/deltaspike-fullstack/pom.xml?rev=1613479&r1=1613478&r2=1613479&view=diff ============================================================================== --- tomee/tomee/trunk/examples/deltaspike-fullstack/pom.xml (original) +++ tomee/tomee/trunk/examples/deltaspike-fullstack/pom.xml Fri Jul 25 17:24:36 2014 @@ -91,16 +91,16 @@ <repositories> <repository> + <id>apache-m2-snapshot</id> + <name>Apache Snapshot Repository</name> + <url>http://repository.apache.org/snapshots</url> + </repository> + <repository> <id>prime-repo</id> <name>Prime Technology Maven Repository</name> <url>http://repository.primefaces.org/</url> <layout>default</layout> </repository> - <repository> - <id>apache-m2-snapshot</id> - <name>Apache Snapshot Repository</name> - <url>http://repository.apache.org/snapshots</url> - </repository> </repositories> <dependencies> Modified: tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/remote/TomEERemoteWebapp.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/remote/TomEERemoteWebapp.java?rev=1613479&r1=1613478&r2=1613479&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/remote/TomEERemoteWebapp.java (original) +++ tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/remote/TomEERemoteWebapp.java Fri Jul 25 17:24:36 2014 @@ -27,6 +27,8 @@ import org.apache.tomee.catalina.Ignored import org.apache.tomee.catalina.OpenEJBValve; import java.beans.PropertyChangeListener; +import java.net.URL; +import java.net.URLClassLoader; public class TomEERemoteWebapp extends IgnoredStandardContext { private static final String CONTEXT_NAME = SystemInstance.get().getProperty("tomee.remote.support.context", "/tomee"); @@ -54,9 +56,11 @@ public class TomEERemoteWebapp extends I private static class ServerClassLoaderLoader implements Loader { private final TomEERemoteWebapp container; + private final FakeWebAppLoader classloader; public ServerClassLoaderLoader(final TomEERemoteWebapp tomEERemoteWebapp) { container = tomEERemoteWebapp; + classloader = new FakeWebAppLoader(OpenEJB.class.getClassLoader()); } @Override @@ -66,7 +70,7 @@ public class TomEERemoteWebapp extends I @Override public ClassLoader getClassLoader() { - return OpenEJB.class.getClassLoader(); + return classloader; } @Override @@ -114,4 +118,36 @@ public class TomEERemoteWebapp extends I // no-op } } + + // mainly for StandardContext.setClassLoaderProperty() otherwise OpenEJB.class.getClassLoader() would be fine + public static class FakeWebAppLoader extends URLClassLoader { + private final ClassLoader delegate; + + // ignored but validated by tomcat, avoid warnings + private boolean clearReferencesHttpClientKeepAliveThread; + private boolean clearReferencesStopThreads; + private boolean clearReferencesStopTimerThreads; + private boolean clearReferencesStatic; + + public FakeWebAppLoader(final ClassLoader classLoader) { + super(new URL[0], classLoader); + delegate = classLoader; + } + + public void setClearReferencesHttpClientKeepAliveThread(final boolean ignored) { + // no-op + } + + public void setClearReferencesStopThreads(final boolean ignored) { + // no-op + } + + public void setClearReferencesStopTimerThreads(final boolean ignored) { + // no-op + } + + public void setClearReferencesStatic(final boolean ignored) { + // no-op + } + } } Modified: tomee/tomee/trunk/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java?rev=1613479&r1=1613478&r2=1613479&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java (original) +++ tomee/tomee/trunk/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java Fri Jul 25 17:24:36 2014 @@ -17,19 +17,13 @@ */ package org.apache.tomee.installer; -import org.apache.openejb.loader.IO; import org.apache.openejb.loader.Options; import org.apache.openejb.loader.SystemInstance; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileWriter; import java.io.IOException; -import java.util.List; import java.util.jar.JarFile; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; public class Installer implements InstallerInterface { private final Alerts alerts = new Alerts(); @@ -285,7 +279,7 @@ public class Installer implements Instal } } } - */ + private void copyClasses(final File javaEEAPIJar, final File sourceJar, final File destinationJar, final String pattern, final List<String> exceptions) { @@ -340,6 +334,7 @@ public class Installer implements Instal alerts.addError(e.getMessage()); } } + */ private void removeJar(final File jar) { if (jar.exists()) { Modified: tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java?rev=1613479&r1=1613478&r2=1613479&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java (original) +++ tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java Fri Jul 25 17:24:36 2014 @@ -33,20 +33,21 @@ public class JULLogger implements Log { private static final String FORMATTER="org.apache.juli.formatter"; static { - if( System.getProperty("java.util.logging.config.class") == null && - System.getProperty("java.util.logging.config.file") == null ) { + if (System.getProperty("java.util.logging.config.class") == null && + System.getProperty("java.util.logging.config.file") == null) { // default configuration - it sucks. Let's override at least the // formatter for the console try { Class.forName(SIMPLE_CFG).newInstance(); - } catch( Throwable t ) { + } catch(final Throwable t) { + // no-op } try { - Formatter fmt=(Formatter)Class.forName(System.getProperty(FORMATTER, SIMPLE_FMT)).newInstance(); + final Formatter fmt=(Formatter)Class.forName(System.getProperty(FORMATTER, SIMPLE_FMT)).newInstance(); // it is also possible that the user modified jre/lib/logging.properties - // but that's really stupid in most cases - Logger root=Logger.getLogger(""); - Handler handlers[]=root.getHandlers(); + final Logger root=Logger.getLogger(""); + final Handler handlers[]=root.getHandlers(); for( int i=0; i< handlers.length; i++ ) { // I only care about console - that's what's used in default config anyway if( handlers[i] instanceof ConsoleHandler) { @@ -54,9 +55,8 @@ public class JULLogger implements Log { } } } catch( Throwable t ) { - // maybe it wasn't included - the ugly default will be used. + // no-op maybe it wasn't included - the ugly default will be used. } - } } @@ -97,70 +97,70 @@ public class JULLogger implements Log { } @Override - public final void debug(Object message) { + public final void debug(final Object message) { log(Level.FINE, String.valueOf(message), null); } @Override - public final void debug(Object message, Throwable t) { + public final void debug(final Object message, final Throwable t) { log(Level.FINE, String.valueOf(message), t); } @Override - public final void trace(Object message) { + public final void trace(final Object message) { log(Level.FINER, String.valueOf(message), null); } @Override - public final void trace(Object message, Throwable t) { + public final void trace(final Object message, final Throwable t) { log(Level.FINER, String.valueOf(message), t); } @Override - public final void info(Object message) { + public final void info(final Object message) { log(Level.INFO, String.valueOf(message), null); } @Override - public final void info(Object message, Throwable t) { + public final void info(final Object message, final Throwable t) { log(Level.INFO, String.valueOf(message), t); } @Override - public final void warn(Object message) { + public final void warn(final Object message) { log(Level.WARNING, String.valueOf(message), null); } @Override - public final void warn(Object message, Throwable t) { + public final void warn(final Object message, final Throwable t) { log(Level.WARNING, String.valueOf(message), t); } @Override - public final void error(Object message) { + public final void error(final Object message) { log(Level.SEVERE, String.valueOf(message), null); } @Override - public final void error(Object message, Throwable t) { + public final void error(final Object message, final Throwable t) { log(Level.SEVERE, String.valueOf(message), t); } @Override - public final void fatal(Object message) { + public final void fatal(final Object message) { log(Level.SEVERE, String.valueOf(message), null); } @Override - public final void fatal(Object message, Throwable t) { + public final void fatal(final Object message, final Throwable t) { log(Level.SEVERE, String.valueOf(message), t); } - private void log(Level level, String msg, Throwable ex) { + private void log(final Level level, final String msg, final Throwable ex) { if (logger.isLoggable(level)) { // Hack (?) to get the stack trace. - Throwable dummyException=new Throwable(); - StackTraceElement locations[]=dummyException.getStackTrace(); + final Throwable dummyException=new Throwable(); + final StackTraceElement[] locations=dummyException.getStackTrace(); // Caller will be the third element String cname = "unknown"; String method = "unknown"; Modified: tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/NoopLogger.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/NoopLogger.java?rev=1613479&r1=1613478&r2=1613479&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/NoopLogger.java (original) +++ tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/NoopLogger.java Fri Jul 25 17:24:36 2014 @@ -18,7 +18,7 @@ package org.apache.tomee.jul.formatter.l import org.apache.juli.logging.Log; -public class NoopLogger implements Log { +public final class NoopLogger implements Log { public static final NoopLogger INSTANCE = new NoopLogger(); private NoopLogger() { Modified: tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java?rev=1613479&r1=1613478&r2=1613479&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java (original) +++ tomee/tomee/trunk/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java Fri Jul 25 17:24:36 2014 @@ -37,7 +37,7 @@ public class ReloadableLog { ReloadableLog.class.getClassLoader(), INTERFACES, new ReloadableLogHandler(factory, name))); } - private static class ReloadableLogHandler implements InvocationHandler { + private static final class ReloadableLogHandler implements InvocationHandler { private static final String LOG4J_IMPL = "org.apache.tomee.loader.log.Log4jLog"; private static final String SLF4J_IMPL = "org.apache.tomee.loader.log.Slf4jLog"; Modified: tomee/tomee/trunk/utils/openejb-core-hibernate/pom.xml URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/utils/openejb-core-hibernate/pom.xml?rev=1613479&r1=1613478&r2=1613479&view=diff ============================================================================== --- tomee/tomee/trunk/utils/openejb-core-hibernate/pom.xml (original) +++ tomee/tomee/trunk/utils/openejb-core-hibernate/pom.xml Fri Jul 25 17:24:36 2014 @@ -88,17 +88,17 @@ <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> <version>${version.hibernate}</version> + <exclusions> + <exclusion> + <groupId>net.sf.ehcache</groupId> + <artifactId>ehcache-core</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>${ehcache.version}</version> - <type>pom</type> - </dependency> - <dependency> - <groupId>net.sf.ehcache</groupId> - <artifactId>ehcache-core</artifactId> - <version>${ehcache.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId>