svn commit: r495842 - /jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java
Author: skitching Date: Fri Jan 12 22:32:49 2007 New Revision: 495842 URL: http://svn.apache.org/viewvc?view=revrev=495842 Log: When useContextClassLoader is false, load classes using the classloader that loaded Betwixt, not the one that loaded Digester. Normally of course both libs will be loaded via the same classloader, but if they are not then using the Betwixt classloader seems far more intuitive. Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java?view=diffrev=495842r1=495841r2=495842 == --- jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java (original) +++ jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java Fri Jan 12 22:32:49 2007 @@ -1244,7 +1244,20 @@ digester = new XMLBeanInfoDigester(); digester.setXMLIntrospector( this ); } - digester.setUseContextClassLoader(configuration.isUseContextClassLoader()); + + if (configuration.isUseContextClassLoader()) { + // Use the context classloader to find classes. + // + // There is one case in which this gives odd behaviour; with digester = 1.8 (at least), + // if the context classloader is inaccessable for some reason then Digester will fall + // back to using the same classloader that loaded Digester. +digester.setUseContextClassLoader(true); + } else { +// Use the classloader that loaded this betwixt library, regardless + // of where the Digester class library happens to be. + digester.setClassLoader(this.getClass().getClassLoader()); + } + digester.setBeanClass( aClass ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r495843 - /jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/IntrospectionConfiguration.java
Author: skitching Date: Fri Jan 12 22:33:44 2007 New Revision: 495843 URL: http://svn.apache.org/viewvc?view=revrev=495843 Log: Make useContextClassLoader the default, and improve documentation for this feature. Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/IntrospectionConfiguration.java Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/IntrospectionConfiguration.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/IntrospectionConfiguration.java?view=diffrev=495843r1=495842r2=495843 == --- jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/IntrospectionConfiguration.java (original) +++ jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/IntrospectionConfiguration.java Fri Jan 12 22:33:44 2007 @@ -112,9 +112,9 @@ private PropertySuppressionStrategy propertySuppressionStrategy = PropertySuppressionStrategy.DEFAULT; /** - * Should the introspector use the context classloader. + * Should the introspector use the context classloader. Defaults to true. */ -private boolean useContextClassLoader = false; +private boolean useContextClassLoader = true; /** * Gets the codeClassNormalizer/code strategy. @@ -501,17 +501,27 @@ /** * Should be context classloader be used when loading classes? * @return codetrue/code if the context classloader is to be used during introspection, - * codefalse/code otherwise + * codefalse/code otherwise. */ public boolean isUseContextClassLoader() { return useContextClassLoader; } /** - * Sets whether the context classloader should be used to load classes during introspection. - * For containers with well behaved context classloaders, - * this should typically be set to true. - * @param useContextClassLoader + * pSpecify whether the context classloader should be used to load classes during introspection; + * the default value is true./p + * p + * When running code that is not in a container (ie where the context classloader is the same + * as the system classloader), this setting has no effect. When running code in containers that + * do define a context classloader for loaded components (eg webapps), a true value will allow + * classes in the loaded component to be accessable even when Betwixt is deployed via a + * higher level classloader. + * /p + * p + * If code is running in a container that uses a context classloader in unusual ways then it + * may be necessary to set this value to false. In this case, classes are always loaded using the + * same classloader that loaded the betwixt library. + * /p */ public void setUseContextClassLoader(boolean useContextClassLoader) { this.useContextClassLoader = useContextClassLoader; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r491767 - /jakarta/commons/proper/logging/trunk/xdocs/index.xml
Author: skitching Date: Tue Jan 2 01:29:54 2007 New Revision: 491767 URL: http://svn.apache.org/viewvc?view=revrev=491767 Log: Add reference to nightly build info on the wiki. Modified: jakarta/commons/proper/logging/trunk/xdocs/index.xml Modified: jakarta/commons/proper/logging/trunk/xdocs/index.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/xdocs/index.xml?view=diffrev=491767r1=491766r2=491767 == --- jakarta/commons/proper/logging/trunk/xdocs/index.xml (original) +++ jakarta/commons/proper/logging/trunk/xdocs/index.xml Tue Jan 2 01:29:54 2007 @@ -129,5 +129,11 @@ /p /subsection /section +section name=Development Builds + p +Regular builds of the current SVN HEAD code are made available. See the +a href=http://wiki.apache.org/jakarta-commons/Logging;wiki/a for details. + /p +/section /body /document - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r491520 - /jakarta/commons/proper/logging/trunk/xdocs/index.xml
Author: skitching Date: Sun Dec 31 17:34:57 2006 New Revision: 491520 URL: http://svn.apache.org/viewvc?view=revrev=491520 Log: Add section on 1.1.1 release to index. Modified: jakarta/commons/proper/logging/trunk/xdocs/index.xml Modified: jakarta/commons/proper/logging/trunk/xdocs/index.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/xdocs/index.xml?view=diffrev=491520r1=491519r2=491520 == --- jakarta/commons/proper/logging/trunk/xdocs/index.xml (original) +++ jakarta/commons/proper/logging/trunk/xdocs/index.xml Sun Dec 31 17:34:57 2006 @@ -81,6 +81,13 @@ Binary and source distributions are available a href=http://jakarta.apache.org/site/downloads/downloads_commons-logging.cgi;here/a. /p +subsection name='1.1.1 Release - Jan 2007' + p + This release is a minor update to the 1.1 release that fixes a number of bugs, and + resolves packaging issues for maven 1.x and maven 2.x users. + /p + pFor the full details, see the release notes for this version./p +/subsection subsection name='1.1 Release - 10 May 2006' pThis release makes several changes that are intended to resolve issues that have been encountered when using commons-logging in servlet containers or j2ee - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r491521 - in /jakarta/commons/proper/commons-nightly/trunk: nightly_proper_maven2_list.txt nightly_proper_maven_list.txt
Author: skitching Date: Sun Dec 31 18:04:23 2006 New Revision: 491521 URL: http://svn.apache.org/viewvc?view=revrev=491521 Log: Move logging from maven1 build to maven2 build. Modified: jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven2_list.txt jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven_list.txt Modified: jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven2_list.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven2_list.txt?view=diffrev=491521r1=491520r2=491521 == --- jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven2_list.txt (original) +++ jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven2_list.txt Sun Dec 31 18:04:23 2006 @@ -1 +1 @@ - +logging Modified: jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven_list.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven_list.txt?view=diffrev=491521r1=491520r2=491521 == --- jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven_list.txt (original) +++ jakarta/commons/proper/commons-nightly/trunk/nightly_proper_maven_list.txt Sun Dec 31 18:04:23 2006 @@ -19,7 +19,6 @@ jxpath lang launcher -logging math modeler net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r476770 - /jakarta/commons/proper/logging/trunk/pom.xml
Author: skitching Date: Sun Nov 19 00:36:36 2006 New Revision: 476770 URL: http://svn.apache.org/viewvc?view=revrev=476770 Log: Add note re how to run unit tests. Modified: jakarta/commons/proper/logging/trunk/pom.xml Modified: jakarta/commons/proper/logging/trunk/pom.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/pom.xml?view=diffrev=476770r1=476769r2=476770 == --- jakarta/commons/proper/logging/trunk/pom.xml (original) +++ jakarta/commons/proper/logging/trunk/pom.xml Sun Nov 19 00:36:36 2006 @@ -14,7 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. -- + project + !-- +- Note that due to the special requirements of logging unit-tests, most +- tests are executed in the integration-test phase rather than the +- test phase. Please run mvn integration-test to run the full suite of +- available unit tests. +-- parent groupIdorg.apache.commons/groupId artifactIdcommons-parent/artifactId - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r476772 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Author: skitching Date: Sun Nov 19 00:50:31 2006 New Revision: 476772 URL: http://svn.apache.org/viewvc?view=revrev=476772 Log: Improve diagnostics when underlying lib throws InvocationTargetException. Patch provided by Lilliane E. Blaze. See Jira issue LOGGING-111. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java?view=diffrev=476772r1=476771r2=476772 == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Sun Nov 19 00:50:31 2006 @@ -908,7 +908,7 @@ if (isDiagnosticsEnabled()) { logDiagnostic( No user-specified Log implementation; performing discovery + -using the standard supported logging implementations...); + using the standard supported logging implementations...); } for(int i=0; (iclassesToDiscover.length) (result == null); ++i) { result = createLogFromClass(classesToDiscover[i], logCategory, true); @@ -1362,6 +1362,29 @@ + logAdapterClassName + ' -- + discoveryFlaw.getClass().getName() + : + discoveryFlaw.getLocalizedMessage()); + +if (discoveryFlaw instanceof InvocationTargetException ) { + // Ok, the lib is there but while trying to create a real underlying + // logger something failed in the underlying lib; display info about + // that if possible. +InvocationTargetException ite = (InvocationTargetException)discoveryFlaw; +Throwable cause = ite.getTargetException(); +if (cause != null) { +logDiagnostic(... InvocationTargetException: + +cause.getClass().getName() + : + +cause.getLocalizedMessage()); + +if (cause instanceof ExceptionInInitializerError) { +ExceptionInInitializerError eiie = (ExceptionInInitializerError)cause; +Throwable cause2 = eiie.getException(); +if (cause2 != null) { +logDiagnostic(... ExceptionInInitializerError: + +cause2.getClass().getName() + : + +cause2.getLocalizedMessage()); +} +} +} +} } if (!allowFlawedDiscovery) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r476774 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4JLogger.java
Author: skitching Date: Sun Nov 19 00:57:51 2006 New Revision: 476774 URL: http://svn.apache.org/viewvc?view=revrev=476774 Log: Handle null log4j logger param to constructor better than just causing NullPointerException. Thanks to Lilianne E. Blaze for the patch; see jira LOGGING-111. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4JLogger.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4JLogger.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4JLogger.java?view=diffrev=476774r1=476773r2=476774 == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4JLogger.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4JLogger.java Sun Nov 19 00:57:51 2006 @@ -109,9 +109,14 @@ this.logger = getLogger(); } -/** For use with a log4j factory. +/** + * For use with a log4j factory. */ public Log4JLogger(Logger logger ) { +if (logger == null) { +throw new IllegalArgumentException( +Warning - null logger in constructor; possible log4j misconfiguration.); +} this.name = logger.getName(); this.logger=logger; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r476777 - /jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt
Author: skitching Date: Sun Nov 19 01:17:43 2006 New Revision: 476777 URL: http://svn.apache.org/viewvc?view=revrev=476777 Log: General updates Modified: jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt Modified: jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt?view=diffrev=476777r1=476776r2=476777 == --- jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt Sun Nov 19 01:17:43 2006 @@ -58,7 +58,9 @@ obtaining the context classloader. In version 1.1 it did. In this release, it has reverted to not using an AccessController; any user-level code that needs to obtain a context classloader should itself create an AccessController, and call the -LogFactory.getContextClassLoader method via the doPrivileged method. +LogFactory.getContextClassLoader method via the doPrivileged method. This fixes a +potential security issue, where untrusted code could get access to the context +classloader if a signed JCL library was in the classpath. == Dependencies == @@ -85,12 +87,13 @@ libraries, just the internally implemented SimpleLog and NoOpLog classes plus Jdk14Logger (which is currently required by Apache Tomcat). -This jar file may be used as a declared dependency for projects that care about -transitive dependencies and can't handle jar files such as commons-logging-nn.jar -which have optional dependencies depending on how they are used. In addition, -this jar file can be useful for rebundlers of JCL who recompile the source-code -but who may not be able to recompile against the full set of supported adapters; -such projects should be able to at least recreate an equivalent of this jar file. +The file commons-logging-api-nn.jar may be used as a declared dependency for +projects that care about transitive dependencies and can't handle jar files +such as commons-logging-nn.jar which have optional dependencies depending on +how they are used. In addition, this jar file can be useful for rebundlers of +JCL who recompile the source-code but who may not be able to recompile against +the full set of supported adapters; such projects should be able to at least +recreate an equivalent of this jar file. == General Notes == @@ -108,18 +111,36 @@ this merely affects how those are presented in the source files. See http://www.apache.org/legal/src-headers.html +This release can be built/tested with maven 2.0.4. Maven 1.x and Ant continue +to be supported. + == Bugs Fixed == * LOGGING-106: JCL 1.1 was completely unusable under a security policy that prevented access to system properties. Even signing/authorising the JCL library was not sufficient. This has been fixed by (a) catching SecurityException and falling back to a sensible default, and (b) using AccessController so JCL can be granted - privileges without needing the caller to have them too. + privileges without needing the caller to have them too. * LOGGING-107: JCL 1.1 auto-discovery failed under a security policy that prevented calls to ClassLoader.getParent. Signing/authorising the JCL library was not sufficient as an AccessController was not used. This has been fixed by catching SecurityException and using an AccessController. + +* MEV-392 (http://jira.codehaus.org/browse/MEV-392) + As JCL didn't provide a Maven2 pom.xml file, one was helpfully created by people + not involved with the commons-logging project and published to the standard maven + repositories. Unfortunately this pom declared normal dependencies on all the logging + libraries that are supported by the core JCL distribution, meaning they all get pulled + into a project that declares a dependency on JCL1.1. This release now provides an + official pom.xml which declares these dependencies as optional so they aren't + automatically included in projects that depend on JCL 1.1.1. + +* (no bug#): Fix thread-safety bug (SimpleDateFormat.format is not thread-safe). + Thanks to Martin Wilson of bright-interactive for the bug report. + +* (no bug#): Security issue regarding access to context classloader (see incompatibilities + section above). DEPRECATIONS: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r476784 - /jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt
Author: skitching Date: Sun Nov 19 01:54:02 2006 New Revision: 476784 URL: http://svn.apache.org/viewvc?view=revrev=476784 Log: Add note about maven1 support. Modified: jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt Modified: jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt?view=diffrev=476784r1=476783r2=476784 == --- jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt Sun Nov 19 01:54:02 2006 @@ -111,8 +111,8 @@ this merely affects how those are presented in the source files. See http://www.apache.org/legal/src-headers.html -This release can be built/tested with maven 2.0.4. Maven 1.x and Ant continue -to be supported. +This release can be built/tested with maven 2.0.4 as well as Ant. Note that +building with Maven 1.x is NOT supported (except for building the website). == Bugs Fixed == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r476637 - /jakarta/commons/proper/logging/trunk/pom.xml
Author: skitching Date: Sat Nov 18 14:32:29 2006 New Revision: 476637 URL: http://svn.apache.org/viewvc?view=revrev=476637 Log: Fix use of optional dependencies; optional is a separate flag, not a scope. Thanks to Wendy Smoak for pointing this out. Modified: jakarta/commons/proper/logging/trunk/pom.xml Modified: jakarta/commons/proper/logging/trunk/pom.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/pom.xml?view=diffrev=476637r1=476636r2=476637 == --- jakarta/commons/proper/logging/trunk/pom.xml (original) +++ jakarta/commons/proper/logging/trunk/pom.xml Sat Nov 18 14:32:29 2006 @@ -1,4 +1,3 @@ -?xml version=1.0 encoding=UTF-8? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -310,111 +309,38 @@ /plugins /build - !-- -- Special dependency handling follows. What we really want for JCL is to declare -- dependencies that are required when compiling but optional at runtime. -- Unfortunately Maven2 doesn't support this directly; if we use normal dependency -- declarations then *users* of JCL will get all the supported logging libs -- pulled into their project by default, but if we declare them optional then -- when JCL is *compiled* we get none of them in the classpath. -- A workaround is used here where two profiles are declared; one is active only -- when compiling and has normal dependencies while the other is active when -- other apps declare a dependency on this pom and as optional dependencies. --- - profiles -profile - idbuild/id - activation -!-- - - If this file is present in the current directory, then assume that - - someone has checked out the JCL source code and is building it. In - - this case declare normal dependencies so the logging adapters - - can be compiled. - -- -file - existscommons-logging-README.txt/exists -/file - /activation - - dependencies - dependency - groupIdjunit/groupId - artifactIdjunit/artifactId - version3.8.1/version - scopetest/scope - /dependency - dependency - groupIdlog4j/groupId - artifactIdlog4j/artifactId - version1.2.12/version - /dependency - dependency - groupIdlogkit/groupId - artifactIdlogkit/artifactId - version1.0.1/version - /dependency - dependency - groupIdavalon-framework/groupId - artifactIdavalon-framework/artifactId - version4.1.3/version - /dependency - dependency - groupIdjavax.servlet/groupId - artifactIdservlet-api/artifactId - version2.3/version - /dependency - /dependencies -/profile - -profile - iduse/id - activation -!-- - - If this file is not in the current directory, then assume that - - this pom is being processed because it is referenced as a - - dependency of some other project. In this case, don't pull in - - any particular logging library; the using project needs to declare - - a dependency on whatever lib they really want present. - -- -file - missingcommons-logging-README.txt/missing -/file - /activation - - dependencies - dependency - groupIdjunit/groupId - artifactIdjunit/artifactId - version3.8.1/version - scopetest/scope - /dependency - dependency - groupIdlog4j/groupId - artifactIdlog4j/artifactId - version1.2.12/version - scopeoptional/scope - /dependency - dependency - groupIdlogkit/groupId - artifactIdlogkit/artifactId - version1.0.1/version - scopeoptional/scope - /dependency - dependency - groupIdavalon-framework/groupId - artifactIdavalon-framework/artifactId - version4.1.3/version - scopeoptional/scope - /dependency - dependency - groupIdjavax.servlet/groupId - artifactIdservlet-api/artifactId - version2.3/version - scopeoptional/scope - /dependency - /dependencies -/profile - /profiles + dependencies +dependency + groupIdjunit/groupId + artifactIdjunit/artifactId + version3.8.1/version + scopetest/scope +/dependency +dependency + groupIdlog4j/groupId + artifactIdlog4j/artifactId + version1.2.12/version + optionaltrue/optional +/dependency
svn commit: r476370 - /jakarta/commons/proper/logging/trunk/pom.xml
Author: skitching Date: Fri Nov 17 15:42:48 2006 New Revision: 476370 URL: http://svn.apache.org/viewvc?view=revrev=476370 Log: Trivial change; add newline after license. Modified: jakarta/commons/proper/logging/trunk/pom.xml Modified: jakarta/commons/proper/logging/trunk/pom.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/pom.xml?view=diffrev=476370r1=476369r2=476370 == --- jakarta/commons/proper/logging/trunk/pom.xml (original) +++ jakarta/commons/proper/logging/trunk/pom.xml Fri Nov 17 15:42:48 2006 @@ -1,4 +1,4 @@ -?xml version=1.0 encoding=UTF-8?project +?xml version=1.0 encoding=UTF-8? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,6 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. -- +project parent groupIdorg.apache.commons/groupId artifactIdcommons-parent/artifactId - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r476429 - /jakarta/commons/proper/logging/trunk/pom.xml
Author: skitching Date: Fri Nov 17 19:41:32 2006 New Revision: 476429 URL: http://svn.apache.org/viewvc?view=revrev=476429 Log: Add comments about unusual dependency-handling approach. Modified: jakarta/commons/proper/logging/trunk/pom.xml Modified: jakarta/commons/proper/logging/trunk/pom.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/pom.xml?view=diffrev=476429r1=476428r2=476429 == --- jakarta/commons/proper/logging/trunk/pom.xml (original) +++ jakarta/commons/proper/logging/trunk/pom.xml Fri Nov 17 19:41:32 2006 @@ -310,10 +310,27 @@ /plugins /build + !-- +- Special dependency handling follows. What we really want for JCL is to declare +- dependencies that are required when compiling but optional at runtime. +- Unfortunately Maven2 doesn't support this directly; if we use normal dependency +- declarations then *users* of JCL will get all the supported logging libs +- pulled into their project by default, but if we declare them optional then +- when JCL is *compiled* we get none of them in the classpath. +- A workaround is used here where two profiles are declared; one is active only +- when compiling and has normal dependencies while the other is active when +- other apps declare a dependency on this pom and as optional dependencies. +-- profiles profile idbuild/id activation +!-- + - If this file is present in the current directory, then assume that + - someone has checked out the JCL source code and is building it. In + - this case declare normal dependencies so the logging adapters + - can be compiled. + -- file existscommons-logging-README.txt/exists /file @@ -352,6 +369,13 @@ profile iduse/id activation +!-- + - If this file is not in the current directory, then assume that + - this pom is being processed because it is referenced as a + - dependency of some other project. In this case, don't pull in + - any particular logging library; the using project needs to declare + - a dependency on whatever lib they really want present. + -- file missingcommons-logging-README.txt/missing /file - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r475623 - /jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt
Author: skitching Date: Thu Nov 16 00:12:15 2006 New Revision: 475623 URL: http://svn.apache.org/viewvc?view=revrev=475623 Log: Add info re support for maven2. Modified: jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt Modified: jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt?view=diffrev=475623r1=475622r2=475623 == --- jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt Thu Nov 16 00:12:15 2006 @@ -64,6 +64,11 @@ This is particularly useful for elements that contain xpath expressions that should be evaluated later using the same namespaces defined for the element. +Maven 2.x build support +--- + +This release now comes with a pom.xml file to allow digester to be built using maven 2.x. + BUGS FROM PREVIOUS RELEASE == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r472835 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/NodeCreateRule.java
Author: skitching Date: Thu Nov 9 01:59:53 2006 New Revision: 472835 URL: http://svn.apache.org/viewvc?view=revrev=472835 Log: Remove unused variable (fix Eclipse warning) Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/NodeCreateRule.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/NodeCreateRule.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/NodeCreateRule.java?view=diffrev=472835r1=472834r2=472835 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/NodeCreateRule.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/NodeCreateRule.java Thu Nov 9 01:59:53 2006 @@ -425,7 +425,7 @@ */ public void end() throws Exception { -Object top = digester.pop(); +digester.pop(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r472836 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/SetNestedPropertiesRule.java
Author: skitching Date: Thu Nov 9 02:06:56 2006 New Revision: 472836 URL: http://svn.apache.org/viewvc?view=revrev=472836 Log: Minor code cleanup: * log is digester.log, so use shorter path. * cache isDebugEnabled state in local variable Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/SetNestedPropertiesRule.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/SetNestedPropertiesRule.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/SetNestedPropertiesRule.java?view=diffrev=472836r1=472835r2=472836 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/SetNestedPropertiesRule.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/SetNestedPropertiesRule.java Thu Nov 9 02:06:56 2006 @@ -392,8 +392,6 @@ } public void body(String value) throws Exception { -boolean debug = log.isDebugEnabled(); - String propName = currChildElementName; if (elementNames.containsKey(currChildElementName)) { // overide propName @@ -404,21 +402,23 @@ } } -if (digester.log.isDebugEnabled()) { -digester.log.debug([SetNestedPropertiesRule]{ + digester.match + +boolean debug = log.isDebugEnabled(); + +if (debug) { +log.debug([SetNestedPropertiesRule]{ + digester.match + } Setting property ' + propName + ' to ' + value + '); } // Populate the corresponding properties of the top object Object top = digester.peek(); -if (digester.log.isDebugEnabled()) { +if (debug) { if (top != null) { -digester.log.debug([SetNestedPropertiesRule]{ + digester.match + +log.debug([SetNestedPropertiesRule]{ + digester.match + } Set + top.getClass().getName() + properties); } else { -digester.log.debug([SetPropertiesRule]{ + digester.match + +log.debug([SetPropertiesRule]{ + digester.match + } Set NULL properties); } } @@ -452,7 +452,7 @@ BeanUtils.setProperty(top, propName, value); } catch(NullPointerException e) { -digester.log.error(NullPointerException: +log.error(NullPointerException: + top= + top + ,propName= + propName + ,value= + value + !); throw e; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r472837 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginDeclarationRule.java
Author: skitching Date: Thu Nov 9 02:07:51 2006 New Revision: 472837 URL: http://svn.apache.org/viewvc?view=revrev=472837 Log: Remove unused variable. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginDeclarationRule.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginDeclarationRule.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginDeclarationRule.java?view=diffrev=472837r1=472836r2=472837 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginDeclarationRule.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginDeclarationRule.java Thu Nov 9 02:07:51 2006 @@ -20,10 +20,8 @@ import java.util.Properties; -import org.apache.commons.digester.Rule; import org.apache.commons.digester.Digester; - -import org.apache.commons.logging.Log; +import org.apache.commons.digester.Rule; /** * A Digester rule which allows the user to pre-declare a class which is to @@ -89,9 +87,6 @@ public static void declarePlugin(Digester digester, Properties props) throws PluginException { - -Log log = digester.getLogger(); -boolean debug = log.isDebugEnabled(); String id = props.getProperty(id); String pluginClassName = props.getProperty(class); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r472838 - in /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester: plugins/ xmlrules/
Author: skitching Date: Thu Nov 9 02:08:34 2006 New Revision: 472838 URL: http://svn.apache.org/viewvc?view=revrev=472838 Log: Add getCause method to all exception classes Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginAssertionFailure.java jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginConfigurationException.java jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginInvalidInputException.java jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/xmlrules/DigesterLoadingException.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginAssertionFailure.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginAssertionFailure.java?view=diffrev=472838r1=472837r2=472838 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginAssertionFailure.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginAssertionFailure.java Thu Nov 9 02:08:34 2006 @@ -72,4 +72,14 @@ this(msg); this.cause = cause; } + +/** + * Return the cause of this exception (if any) as specified in the + * exception constructor. + * + * @since 1.8 + */ +public Throwable getCause() { + return cause; +} } Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginConfigurationException.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginConfigurationException.java?view=diffrev=472838r1=472837r2=472838 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginConfigurationException.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginConfigurationException.java Thu Nov 9 02:08:34 2006 @@ -54,4 +54,14 @@ this(msg); this.cause = cause; } + +/** + * Return the cause of this exception (if any) as specified in the + * exception constructor. + * + * @since 1.8 + */ +public Throwable getCause() { + return cause; +} } Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginInvalidInputException.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginInvalidInputException.java?view=diffrev=472838r1=472837r2=472838 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginInvalidInputException.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginInvalidInputException.java Thu Nov 9 02:08:34 2006 @@ -50,4 +50,14 @@ this(msg); this.cause = cause; } + +/** + * Return the cause of this exception (if any) as specified in the + * exception constructor. + * + * @since 1.8 + */ +public Throwable getCause() { + return cause; +} } Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/xmlrules/DigesterLoadingException.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/xmlrules/DigesterLoadingException.java?view=diffrev=472838r1=472837r2=472838 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/xmlrules/DigesterLoadingException.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/xmlrules/DigesterLoadingException.java Thu Nov 9 02:08:34 2006 @@ -54,4 +54,13 @@ this.cause = cause; } +/** + * Return the cause of this exception (if any) as specified in the + * exception constructor. + * + * @since 1.8 + */ +public Throwable getCause() { + return cause; +} } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r472840 - in /jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester: ./ plugins/ xmlrules/
Author: skitching Date: Thu Nov 9 02:18:34 2006 New Revision: 472840 URL: http://svn.apache.org/viewvc?view=revrev=472840 Log: Remove unused variables (fix Eclipse warnings) Modified: jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/EBRTestCase.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/NodeCreateRuleTestCase.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/RulesBaseTestCase.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetNestedPropertiesRuleTestCase.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertiesRuleTestCase.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertyRuleTestCase.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestConfigurablePluginAttributes.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/DigesterLoaderTest.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/TestObject.java Modified: jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java?view=diffrev=472840r1=472839r2=472840 == --- jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java (original) +++ jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java Thu Nov 9 02:18:34 2006 @@ -319,6 +319,7 @@ SimpleTestBean bean = (SimpleTestBean) digester.parse(xmlTestReader()); fail(Should have thrown NoSuchMethodException); +assertNotNull(bean); // just to avoid compiler warning on unused variable } catch (Exception e) { if (e instanceof InvocationTargetException) { Throwable t = Modified: jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java?view=diffrev=472840r1=472839r2=472840 == --- jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java (original) +++ jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java Thu Nov 9 02:18:34 2006 @@ -120,11 +120,10 @@ digester.addCallMethod(employee, toString, 0, new String[] {}); digester.addCallMethod(employee, toString); -// Parse our test input -Object root1 = null; -// an exception will be thrown if the method can't be found -root1 = digester.parse(getInputStream(Test5.xml)); - +// Parse our test input. +// An exception will be thrown if the method can't be found +Object root1 = digester.parse(getInputStream(Test5.xml)); +assertNotNull(root1); } @@ -322,7 +321,7 @@ try { // an exception will be thrown if the method can't be found root1 = digester.parse(getInputStream(Test8.xml)); - +assertNotNull(root1); } catch (Throwable t) { // this means that the method can't be found and so the test fails fail(Digester threw Exception: + t); Modified: jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java?view=diffrev=472840r1=472839r2=472840 == --- jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java (original) +++ jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java Thu Nov 9 02:18:34 2006 @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.EmptyStackException; import java.util.Iterator; -import java.util.List; import java.util.Map; import junit.framework.Test; @@ -202,8 +201,6 @@ * Basic test for rule creation and matching
svn commit: r472841 - /jakarta/commons/proper/digester/trunk/build.xml
Author: skitching Date: Thu Nov 9 02:19:29 2006 New Revision: 472841 URL: http://svn.apache.org/viewvc?view=revrev=472841 Log: Add comments only. Modified: jakarta/commons/proper/digester/trunk/build.xml Modified: jakarta/commons/proper/digester/trunk/build.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/build.xml?view=diffrev=472841r1=472840r2=472841 == --- jakarta/commons/proper/digester/trunk/build.xml (original) +++ jakarta/commons/proper/digester/trunk/build.xml Thu Nov 9 02:19:29 2006 @@ -19,8 +19,20 @@ !-- -Digester component of the Jakarta Commons Subproject -$Id$ + Digester component of the Jakarta Commons Subproject + $Id$ + + The most useful targets in this build file are: +* compile +* test (includes preceding target) +* dist (includes preceding targets) + + Before running any targets it is necessary to indicate where all required + libraries can be found on the local system. See file build.properties.sample + for more information. + + Alternately, use maven 2.x or maven 1.x instead of Ant; the appropriate files + are provided by this project to download necessary dependencies automatically. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r472842 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/strategies/LoaderFromClass.java
Author: skitching Date: Thu Nov 9 02:19:56 2006 New Revision: 472842 URL: http://svn.apache.org/viewvc?view=revrev=472842 Log: Remove unused variable Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/strategies/LoaderFromClass.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/strategies/LoaderFromClass.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/strategies/LoaderFromClass.java?view=diffrev=472842r1=472841r2=472842 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/strategies/LoaderFromClass.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/strategies/LoaderFromClass.java Thu Nov 9 02:19:56 2006 @@ -75,7 +75,7 @@ try { Object[] params = {d, path}; -Object none = rulesMethod.invoke(null, params); +rulesMethod.invoke(null, params); } catch (Exception e) { throw new PluginException( Unable to invoke rules method + rulesMethod - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r472843 - /jakarta/commons/proper/digester/trunk/pom.xml
Author: skitching Date: Thu Nov 9 02:20:28 2006 New Revision: 472843 URL: http://svn.apache.org/viewvc?view=revrev=472843 Log: Add maven2 build file for Digester. Added: jakarta/commons/proper/digester/trunk/pom.xml Added: jakarta/commons/proper/digester/trunk/pom.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/pom.xml?view=autorev=472843 == --- jakarta/commons/proper/digester/trunk/pom.xml (added) +++ jakarta/commons/proper/digester/trunk/pom.xml Thu Nov 9 02:20:28 2006 @@ -0,0 +1,340 @@ +?xml version=1.0 encoding=UTF-8? + +!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the License); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an AS IS BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +-- + +!-- TODO: +* include dtds as resources +* build src jars +-- + +project +xmlns=http://maven.apache.org/POM/4.0.0; +xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; +xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; + parent +groupIdorg.apache.commons/groupId +artifactIdcommons-parent/artifactId +version1-SNAPSHOT/version + /parent + modelVersion4.0.0/modelVersion + groupIdorg.apache.commons/groupId + artifactIdcommons-digester/artifactId + nameDigester/name + version1.8-SNAPSHOT/version + + description +The Digester package lets you configure an XML-Java object mapping module +which triggers certain actions called rules whenever a particular +pattern of nested XML elements is recognized. + /description + + repositories +repository + idsnapshots/id + nameApache Snapshot repo/name + layoutdefault/layout + urlhttp://people.apache.org/repo/m2-snapshot-repository/url + snapshots +enabledtrue/enabled + /snapshots +/repository + /repositories + + urlhttp://jakarta.apache.org/commons/digester//url + + issueManagement +systemjira/system +urlhttp://issues.apache.org/jira/browse/DIGESTER/url + /issueManagement + + inceptionYear2001/inceptionYear + + developers +developer + nameCraig McClanahan/name + idcraigmcc/id + email[EMAIL PROTECTED]/email + organizationSun Microsystems/organization +/developer +developer + nameRobert Burrell Donkin/name + idrdonkin/id + email[EMAIL PROTECTED]/email +/developer +developer + nameScott Sanders/name + idsanders/id + email[EMAIL PROTECTED]/email +/developer +developer + nameJames Strachan/name + idjstrachan/id + email[EMAIL PROTECTED]/email +/developer +developer + nameJason van Zyl/name + idjvanzyl/id + email[EMAIL PROTECTED]/email +/developer +developer + nameTim OBrien/name + idtobrien/id + email[EMAIL PROTECTED]/email +/developer +developer + nameJean-Francois Arcand/name + idjfarcand/id + email[EMAIL PROTECTED]/email +/developer +developer + nameSimon Kitching/name + idskitching/id + email[EMAIL PROTECTED]/email +/developer + /developers + + contributors +contributor + nameBradley M. Handy/name + email[EMAIL PROTECTED]/email +/contributor +contributor + nameChristopher Lenz/name + email/ +/contributor +contributor + nameTed Husted/name + email/ +/contributor +contributor + nameDavid H. Martin/name + email/ +/contributor +contributor + nameHenri Chen/name + email/ +/contributor +contributor + nameJanek Bogucki/name + email/ +/contributor +contributor + nameMark Huisman/name + email/ +/contributor +contributor + namePaul Jack/name + email/ +/contributor +contributor + nameAnton Maslovsky/name + email/ +/contributor +contributor + nameMatt Cleveland/name + email/ +/contributor +contributor + nameGabriele Carcassi/name + email/ +/contributor +contributor + nameWendy Smoak/name + email[EMAIL PROTECTED]/email +/contributor +contributor + nameKevin Ross/name + email[EMAIL PROTECTED]/email +/contributor + /contributors + + scm + connectionscm:svn:scm:svn:https://svn.apache.org
svn commit: r468847 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
Author: skitching Date: Sun Oct 29 01:56:44 2006 New Revision: 468847 URL: http://svn.apache.org/viewvc?view=revrev=468847 Log: Change @since from 1.7.1 to 1.8 as that's what the next release will now be labelled. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java?view=diffrev=468847r1=468846r2=468847 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Sun Oct 29 01:56:44 2006 @@ -1023,7 +1023,7 @@ * Define a callback object which is invoked whever an object is pushed onto * a digester object stack, or popped off one. * - * @since 1.7.1 + * @since 1.8 */ public void setStackAction(StackAction stackAction) { this.stackAction = stackAction; @@ -1032,7 +1032,7 @@ /** * See setStackAction. * - * @since 1.7.1 + * @since 1.8 */ public StackAction getStackAction() { return stackAction; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r468849 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java
Author: skitching Date: Sun Oct 29 01:59:17 2006 New Revision: 468849 URL: http://svn.apache.org/viewvc?view=revrev=468849 Log: Change @since from 1.7.1 to 1.8 Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java?view=diffrev=468849r1=468848r2=468849 == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java Sun Oct 29 01:59:17 2006 @@ -40,7 +40,7 @@ * p * See also Digester.setStackAction. * - * @since 1.7.1 + * @since 1.8 */ public interface StackAction { /** @@ -74,4 +74,4 @@ * o is returned but this method could return an alternate object. */ public Object onPop(Digester d, String stackName, Object o); -} \ No newline at end of file +} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r468851 - /jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt
Author: skitching Date: Sun Oct 29 01:04:32 2006 New Revision: 468851 URL: http://svn.apache.org/viewvc?view=revrev=468851 Log: Update version number from 1.7.1 to 1.8; that will be the next release version. Modified: jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt Modified: jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt?view=diffrev=468851r1=468850r2=468851 == --- jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt Sun Oct 29 01:04:32 2006 @@ -2,11 +2,11 @@ Commons Digester Package -Version 1.7.1-dev +Version 1.8-dev Release Notes -*** Release notes current as of 2005-09-10 +*** Release notes current as of 2006-10-29 INTRODUCTION @@ -24,12 +24,12 @@ Dependencies = -Release 1.7.1 has the same dependencies as release 1.7. +Release 1.8 has the same dependencies as release 1.7. Compatible Dependency Sets: - Digester 1.7 + Logging 1.0.x + BeanUtils 1.x + Collections 2.x - Digester 1.7 + Logging 1.0.x + BeanUtils 1.x + Collections 3.x - Digester 1.7 + Logging 1.0.x + BeanUtils 1.7 + Digester 1.8 + Logging 1.0.x + BeanUtils 1.x + Collections 2.x + Digester 1.8 + Logging 1.0.x + BeanUtils 1.x + Collections 3.x + Digester 1.8 + Logging 1.0.x + BeanUtils 1.7 NEW FEATURES = @@ -55,6 +55,14 @@ code to monitor all objects pushed onto and popped off digester stacks. In particular, this makes it easier to store source file/line info for all objects created during parsing. + +Namespace Access + + +Method getCurrentNamespaces has been added to the Digester class. This allows user +code to get a snapshot of all the prefix-url mappings applicable at a point in time. +This is particularly useful for elements that contain xpath expressions that should +be evaluated later using the same namespaces defined for the element. BUGS FROM PREVIOUS RELEASE == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r464108 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/SimpleLog.java
Author: skitching Date: Sat Oct 14 20:11:19 2006 New Revision: 464108 URL: http://svn.apache.org/viewvc?view=revrev=464108 Log: Fix thread-safety bug (SimpleDateFormat.format is not thread-safe). Thanks to Martin Wilson of bright-interactive for the bug report. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/SimpleLog.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/SimpleLog.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/SimpleLog.java?view=diffrev=464108r1=464107r2=464108 == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/SimpleLog.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/SimpleLog.java Sat Oct 14 20:11:19 2006 @@ -100,7 +100,15 @@ static protected boolean showDateTime = false; /** The date and time format to use in the log message */ static protected String dateTimeFormat = DEFAULT_DATE_TIME_FORMAT; -/** Used to format times */ + +/** + * Used to format times. + * p + * Any code that accesses this object should first obtain a lock on it, + * ie use synchronized(dateFormatter); this requirement was introduced + * in 1.1.1 to fix an existing thread safety bug (SimpleDateFormat.format + * is not thread-safe). + */ static protected DateFormat dateFormatter = null; // Log Level Constants @@ -179,7 +187,6 @@ } } - // - Attributes /** The name of this simple log instance */ @@ -281,7 +288,12 @@ // Append date-time if so configured if(showDateTime) { -buf.append(dateFormatter.format(new Date())); +Date now = new Date(); +String dateText; +synchronized(dateFormatter) { +dateText = dateFormatter.format(now); +} +buf.append(dateText); buf.append( ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r427477 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java
Author: skitching Date: Tue Aug 1 00:37:00 2006 New Revision: 427477 URL: http://svn.apache.org/viewvc?rev=427477view=rev Log: Add javadoc only. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java?rev=427477r1=427476r2=427477view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Tue Aug 1 00:37:00 2006 @@ -135,6 +135,9 @@ * pre * useExplicitLoader(prefix, ClassLoader.getSystemClassLoader()); * /pre + * p + * Of course, this assumes that the classes of interest are already + * in the classpath of the system classloader. */ public void useSystemLoader(String prefix) { useExplicitLoader(prefix, ClassLoader.getSystemClassLoader()); @@ -192,6 +195,12 @@ * be found. Typically this is the name of a jar file, or a directory * containing class files. * p + * If there is no system property, but the classloader that loaded + * this class is a URLClassLoader then the set of URLs that the + * classloader uses for its classpath is scanned; any jar in the + * URL set whose name starts with the specified string is added to + * the classpath managed by this instance. + * p * Using logical library names allows the calling code to specify its * desired classpath without knowing the exact location of the necessary * classes. @@ -223,6 +232,20 @@ + as a System property.); } +/** + * If the classloader that loaded this class has this logical lib in its + * path, then return the matching URL otherwise return null. + * p + * This only works when the classloader loading this class is an instance + * of URLClassLoader and thus has a getURLs method that returns the classpath + * it uses when loading classes. However in practice, the vast majority of the + * time this type is the classloader used. + * p + * The classpath of the classloader for this instance is scanned, and any + * jarfile in the path whose name starts with the logicalLib string is + * considered a match. For example, passing foo will match a url + * of codefile:///some/where/foo-2.7.jar/code. + */ private URL libFromClasspath(String logicalLib) { ClassLoader cl = this.getClass().getClassLoader(); if (cl instanceof URLClassLoader == false) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r427797 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java
Author: skitching Date: Tue Aug 1 16:45:58 2006 New Revision: 427797 URL: http://svn.apache.org/viewvc?rev=427797view=rev Log: When multiple jars on classpath match logical lib name, use jar with shortest name. Also remove debug print statement. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java?rev=427797r1=427796r2=427797view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Tue Aug 1 16:45:58 2006 @@ -245,6 +245,11 @@ * jarfile in the path whose name starts with the logicalLib string is * considered a match. For example, passing foo will match a url * of codefile:///some/where/foo-2.7.jar/code. + * p + * When multiple classpath entries match the specified logicalLib string, + * the one with the shortest filename component is returned. This means that + * if foo-1.1.jar and foobar-1.1.jar are in the path, then a logicalLib + * name of foo will match the first entry above. */ private URL libFromClasspath(String logicalLib) { ClassLoader cl = this.getClass().getClassLoader(); @@ -254,6 +259,8 @@ URLClassLoader ucl = (URLClassLoader) cl; URL[] path = ucl.getURLs(); +URL shortestMatch = null; +int shortestMatchLen = Integer.MAX_VALUE; for(int i=0; ipath.length; ++i) { URL u = path[i]; @@ -270,16 +277,17 @@ } if (filename.startsWith(logicalLib)) { -System.out.println(found lib + logicalLib + at url + u); -return u; -} else { -System.out.println(lib + logicalLib + does not match [ + filename + ] at url + u); +// ok, this is a candidate +if (filename.length() shortestMatchLen) { +shortestMatch = u; +shortestMatchLen = filename.length(); +} } } -return null; - +return shortestMatch; } + /** * Override ClassLoader method. * p - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r427798 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/logkit/StandardTestCase.java
Author: skitching Date: Tue Aug 1 16:46:32 2006 New Revision: 427798 URL: http://svn.apache.org/viewvc?rev=427798view=rev Log: Remove unused imports (fix compile warnings). Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/logkit/StandardTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/logkit/StandardTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/logkit/StandardTestCase.java?rev=427798r1=427797r2=427798view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/logkit/StandardTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/logkit/StandardTestCase.java Tue Aug 1 16:46:32 2006 @@ -24,16 +24,13 @@ import java.io.ObjectOutputStream; import junit.framework.Test; -import junit.framework.TestCase; +import org.apache.commons.logging.AbstractLogTest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.PathableClassLoader; import org.apache.commons.logging.PathableTestSuite; import org.apache.commons.logging.impl.LogKitLogger; -import org.apache.commons.logging.impl.NoOpLog; - -import org.apache.commons.logging.AbstractLogTest; /** * Basic tests for Avalon LogKit logger adapter. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r427800 - in /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14: CustomConfigAPITestCase.java CustomConfigFullTestCase.java CustomConfigTestCase.java
Author: skitching Date: Tue Aug 1 16:48:14 2006 New Revision: 427800 URL: http://svn.apache.org/viewvc?rev=427800view=rev Log: Manually force our custom java.util.logging.Handler class to be loaded via the system classloader. This means that the unit test can successfully run even when the class is not in the system classpath (as happens when running tests with maven2's surefire plugin for example). Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigAPITestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigFullTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigAPITestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigAPITestCase.java?rev=427800r1=427799r2=427800view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigAPITestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigAPITestCase.java Tue Aug 1 16:48:14 2006 @@ -19,8 +19,8 @@ import junit.framework.Test; -import org.apache.commons.logging.PathableTestSuite; import org.apache.commons.logging.PathableClassLoader; +import org.apache.commons.logging.PathableTestSuite; /** @@ -30,12 +30,10 @@ public class CustomConfigAPITestCase extends CustomConfigTestCase { - public CustomConfigAPITestCase(String name) { super(name); } - /** * Return the tests included in this test suite. */ @@ -48,7 +46,9 @@ // be able to instantiate it. And this test case must see the same // class in order to be able to access its data. Yes this is ugly // but the whole jdk14 API is a *** mess anyway. -parent.useSystemLoader(org.apache.commons.logging.jdk14.TestHandler); +ClassLoader scl = ClassLoader.getSystemClassLoader(); +loadTestHandler(HANDLER_NAME, scl); +parent.useExplicitLoader(HANDLER_NAME, scl); parent.addLogicalLib(commons-logging-api); PathableClassLoader child = new PathableClassLoader(parent); Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigFullTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigFullTestCase.java?rev=427800r1=427799r2=427800view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigFullTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigFullTestCase.java Tue Aug 1 16:48:14 2006 @@ -49,7 +49,9 @@ // be able to instantiate it. And this test case must see the same // class in order to be able to access its data. Yes this is ugly // but the whole jdk14 API is a *** mess anyway. -parent.useSystemLoader(org.apache.commons.logging.jdk14.TestHandler); +ClassLoader scl = ClassLoader.getSystemClassLoader(); +loadTestHandler(HANDLER_NAME, scl); +parent.useExplicitLoader(HANDLER_NAME, scl); parent.addLogicalLib(commons-logging); PathableClassLoader child = new PathableClassLoader(parent); Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java?rev=427800r1=427799r2=427800view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java Tue Aug 1 16:48:14 2006 @@ -18,7 +18,9 @@ package org.apache.commons.logging.jdk14; +import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.lang.reflect.Method; import java.util.Iterator; import java.util.logging.Handler; import java.util.logging.Level; @@ -27,7 +29,9 @@ import java.util.logging.Logger; import junit.framework.Test; -import junit.framework.TestSuite; + +import org.apache.commons.logging.PathableClassLoader; +import org.apache.commons.logging.PathableTestSuite; /** @@ -41,6 +45,8 @@ public class CustomConfigTestCase extends DefaultConfigTestCase { +protected static final String HANDLER_NAME
svn commit: r427808 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java
Author: skitching Date: Tue Aug 1 17:08:20 2006 New Revision: 427808 URL: http://svn.apache.org/viewvc?rev=427808view=rev Log: Have DefaultConfigTestCase explicitly set up its classpath. When run from ant, log4j is not on the classpath so using the default setup works; however when run from maven2 surefire, log4j is on the path. Explicitly controlling the test classpath works in both cases. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java?rev=427808r1=427807r2=427808view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java Tue Aug 1 17:08:20 2006 @@ -29,6 +29,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.commons.logging.PathableClassLoader; +import org.apache.commons.logging.PathableTestSuite; /** @@ -87,7 +89,13 @@ * Return the tests included in this test suite. */ public static Test suite() throws Exception { -return (new TestSuite(DefaultConfigTestCase.class)); +PathableClassLoader loader = new PathableClassLoader(null); +loader.useExplicitLoader(junit., Test.class.getClassLoader()); +loader.addLogicalLib(testclasses); +loader.addLogicalLib(commons-logging); + +Class testClass = loader.loadClass(DefaultConfigTestCase.class.getName()); +return new PathableTestSuite(testClass, loader); } /** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r427814 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java
Author: skitching Date: Tue Aug 1 17:18:56 2006 New Revision: 427814 URL: http://svn.apache.org/viewvc?rev=427814view=rev Log: Make test compatible with maven2 surefire. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java?rev=427814r1=427813r2=427814view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java Tue Aug 1 17:18:56 2006 @@ -20,6 +20,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; +import java.util.HashSet; +import java.util.Set; import junit.framework.Test; import junit.framework.TestCase; @@ -86,6 +88,21 @@ } /** + * Utility method to return the set of all classloaders in the + * parent chain starting from the one that loaded the class for + * this object instance. + */ +private Set getAncestorCLs() { +Set s = new HashSet(); +ClassLoader cl = this.getClass().getClassLoader(); +while (cl != null) { +s.add(cl); +cl = cl.getParent(); +} +return s; +} + +/** * Test that the classloader hierarchy is as expected, and that * calling loadClass() on various classloaders works as expected. * Note that for this test case, parent-first classloading is @@ -130,11 +147,13 @@ PathableClassLoader.class.getName().equals( systemLoader.getClass().getName())); -// junit classes should be visible; their classloader is system. -// this will of course throw an exception if not found. +// junit classes should be visible; their classloader is not +// in the hierarchy of parent classloaders for this class, +// though it is accessable due to trickery in the PathableClassLoader. Class junitTest = contextLoader.loadClass(junit.framework.Test); -assertSame(Junit not loaded via systemloader, -systemLoader, junitTest.getClassLoader()); +Set ancestorCLs = getAncestorCLs(); +assertFalse(Junit not loaded by ancestor classloader, +ancestorCLs.contains(junitTest.getClassLoader())); // jcl api classes should be visible only via the parent Class logClass = contextLoader.loadClass(org.apache.commons.logging.Log); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r427394 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java
Author: skitching Date: Mon Jul 31 18:13:11 2006 New Revision: 427394 URL: http://svn.apache.org/viewvc?rev=427394view=rev Log: Allow libs for test to be discovered via the classpath as well as via system properties. This has been implemented to suppprt running tests via the maven surefire plugin, but is a general-purpose mechanism. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java?rev=427394r1=427393r2=427394view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Mon Jul 31 18:13:11 2006 @@ -197,22 +197,66 @@ * classes. */ public void addLogicalLib(String logicalLib) { +// first, check the system properties String filename = System.getProperty(logicalLib); -if (filename == null) { -throw new UnknownError( -Logical lib [ + logicalLib + ] is not defined -+ as a System property.); +if (filename != null) { +try { +URL libUrl = new File(filename).toURL(); +addURL(libUrl); +return; +} catch(java.net.MalformedURLException e) { +throw new UnknownError( +Invalid file [ + filename + ] for logical lib [ + logicalLib + ]); +} } -try { -URL url = new File(filename).toURL(); -addURL(url); -} catch(java.net.MalformedURLException e) { -throw new UnknownError( -Invalid file [ + filename + ] for logical lib [ + logicalLib + ]); +// now check the classpath for a similar-named lib +URL libUrl = libFromClasspath(logicalLib); +if (libUrl != null) { +addURL(libUrl); +return; } + +// lib not found +throw new UnknownError( +Logical lib [ + logicalLib + ] is not defined ++ as a System property.); +} + +private URL libFromClasspath(String logicalLib) { +ClassLoader cl = this.getClass().getClassLoader(); +if (cl instanceof URLClassLoader == false) { +return null; +} + +URLClassLoader ucl = (URLClassLoader) cl; +URL[] path = ucl.getURLs(); +for(int i=0; ipath.length; ++i) { +URL u = path[i]; + +// extract the filename bit on the end of the url +String filename = u.toString(); +if (!filename.endsWith(.jar)) { +// not a jarfile, ignore it +continue; +} + +int lastSlash = filename.lastIndexOf('/'); +if (lastSlash = 0) { +filename = filename.substring(lastSlash+1); +} + +if (filename.startsWith(logicalLib)) { +System.out.println(found lib + logicalLib + at url + u); +return u; +} else { +System.out.println(lib + logicalLib + does not match [ + filename + ] at url + u); +} +} + +return null; + } - /** * Override ClassLoader method. * p - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r427396 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java
Author: skitching Date: Mon Jul 31 18:16:02 2006 New Revision: 427396 URL: http://svn.apache.org/viewvc?rev=427396view=rev Log: Change test to be compatible with maven2 surefire; when using surefire, junit is not loaded via the system classpath. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java?rev=427396r1=427395r2=427396view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java Mon Jul 31 18:16:02 2006 @@ -20,6 +20,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; +import java.util.HashSet; +import java.util.Set; import junit.framework.Test; import junit.framework.TestCase; @@ -87,7 +89,22 @@ // and return our custom TestSuite class return new PathableTestSuite(testClass, context); } - + +/** + * Utility method to return the set of all classloaders in the + * parent chain starting from the one that loaded the class for + * this object instance. + */ +private Set getAncestorCLs() { +Set s = new HashSet(); +ClassLoader cl = this.getClass().getClassLoader(); +while (cl != null) { +s.add(cl); +cl = cl.getParent(); +} +return s; +} + /** * Test that the classloader hierarchy is as expected, and that * calling loadClass() on various classloaders works as expected. @@ -133,11 +150,13 @@ PathableClassLoader.class.getName().equals( systemLoader.getClass().getName())); -// junit classes should be visible; their classloader is system. -// this will of course throw an exception if not found. +// junit classes should be visible; their classloader is not +// in the hierarchy of parent classloaders for this class, +// though it is accessable due to trickery in the PathableClassLoader. Class junitTest = contextLoader.loadClass(junit.framework.Test); -assertSame(Junit not loaded via systemloader, -systemLoader, junitTest.getClassLoader()); +Set ancestorCLs = getAncestorCLs(); +assertFalse(Junit not loaded by ancestor classloader, +ancestorCLs.contains(junitTest.getClassLoader())); // jcl api classes should be visible only via the parent Class logClass = contextLoader.loadClass(org.apache.commons.logging.Log); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r427417 - /jakarta/commons/proper/logging/trunk/pom.xml
Author: skitching Date: Mon Jul 31 20:08:15 2006 New Revision: 427417 URL: http://svn.apache.org/viewvc?rev=427417view=rev Log: Copy resources into test jar. Also minor layout tidyups. Modified: jakarta/commons/proper/logging/trunk/pom.xml Modified: jakarta/commons/proper/logging/trunk/pom.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/pom.xml?rev=427417r1=427416r2=427417view=diff == --- jakarta/commons/proper/logging/trunk/pom.xml (original) +++ jakarta/commons/proper/logging/trunk/pom.xml Mon Jul 31 20:08:15 2006 @@ -144,18 +144,29 @@ sourceDirectorysrc/java/sourceDirectory testSourceDirectorysrc/test/testSourceDirectory +testResources + testResource +directorysrc/test/directory +filteringfalse/filtering +includes + include**/*.properties/include +/includes + /testResource +/testResources + plugins -!-- - - The custom test framework requires the unit test code to be - - in a jarfile so it can control its place in the classpath. - -- + + !-- +- The custom test framework requires the unit test code to be +- in a jarfile so it can control its place in the classpath. +-- plugin artifactIdmaven-jar-plugin/artifactId - executions -execution - idtestjar/id - phasepackage/phase - goals +executions + execution +idtestjar/id +phasepackage/phase +goals goaltest-jar/goal /goals configuration @@ -260,6 +271,12 @@ include**/*TestCase.java/include /includes systemProperties +!-- +property + nameorg.apache.commons.logging.diagnostics.dest/name + valueSTDOUT/value +/property +-- property namecommons-logging/name valuetarget/${project.build.finalName}.jar/value - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r427418 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java
Author: skitching Date: Mon Jul 31 20:10:13 2006 New Revision: 427418 URL: http://svn.apache.org/viewvc?rev=427418view=rev Log: Minor test tidyups (including fixing incorrect comment due to copy-and-paste). Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java?rev=427418r1=427417r2=427418view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java Mon Jul 31 20:10:13 2006 @@ -62,13 +62,9 @@ String thisClassPath = thisClass.getName().replace('.', '/') + .class; URL baseUrl = dummy.findResource(thisClassPath); -// Now set up the desired classloader hierarchy. We'll put a config -// file of priority=10 in the container path, and ones of both -// no priority and priority=20 in the webapp path. -// -// A second properties file with priority=20 is also added, -// so we can check that the first one in the classpath is -// used. +// Now set up the desired classloader hierarchy. We'll put JCL +// in the container path, the testcase in a webapp path, and +// both config files into the webapp path too. PathableClassLoader containerLoader = new PathableClassLoader(null); containerLoader.useExplicitLoader(junit., Test.class.getClassLoader()); containerLoader.addLogicalLib(commons-logging); @@ -110,6 +106,19 @@ */ public void testPriority() throws Exception { LogFactory instance = LogFactory.getFactory(); + +ClassLoader thisClassLoader = this.getClass().getClassLoader(); +ClassLoader lfClassLoader = instance.getClass().getClassLoader(); +ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + +// context classloader should be thisClassLoader +assertEquals(thisClassLoader, contextClassLoader); + +// lfClassLoader should be parent of this classloader +assertEquals(lfClassLoader, thisClassLoader.getParent()); +assertEquals(PathableClassLoader.class.getName(), +lfClassLoader.getClass().getName()); + String id = (String) instance.getAttribute(configId); assertEquals(Correct config file loaded, priority20, id ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r426313 - /jakarta/commons/proper/logging/trunk/build.xml
Author: skitching Date: Thu Jul 27 16:05:22 2006 New Revision: 426313 URL: http://svn.apache.org/viewvc?rev=426313view=rev Log: Exclude LogFactoryImpl anonymous inner classes from adapter jar that shouldn't be included. Modified: jakarta/commons/proper/logging/trunk/build.xml Modified: jakarta/commons/proper/logging/trunk/build.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/build.xml?rev=426313r1=426312r2=426313view=diff == --- jakarta/commons/proper/logging/trunk/build.xml (original) +++ jakarta/commons/proper/logging/trunk/build.xml Thu Jul 27 16:05:22 2006 @@ -493,7 +493,7 @@ include name=META-INF/LICENSE.txt/ include name=META-INF/NOTICE.txt/ exclude name=org/apache/commons/logging/impl/WeakHashtable*.class / - exclude name=org/apache/commons/logging/impl/LogFactoryImpl.class / + exclude name=org/apache/commons/logging/impl/LogFactoryImpl*.class / /jar /target - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r426316 - /jakarta/commons/proper/logging/trunk/pom.xml
Author: skitching Date: Thu Jul 27 16:09:24 2006 New Revision: 426316 URL: http://svn.apache.org/viewvc?rev=426316view=rev Log: Rework packaging phase. JCL now builds correctly with maven2 (though unit tests don't run). Modified: jakarta/commons/proper/logging/trunk/pom.xml Modified: jakarta/commons/proper/logging/trunk/pom.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/pom.xml?rev=426316r1=426315r2=426316view=diff == --- jakarta/commons/proper/logging/trunk/pom.xml (original) +++ jakarta/commons/proper/logging/trunk/pom.xml Thu Jul 27 16:09:24 2006 @@ -3,7 +3,7 @@ groupIdcommons-logging/groupId artifactIdcommons-logging/artifactId nameLogging/name - version1.1.1/version + version1.1.1-SNAPSHOT/version descriptionCommons Logging is a thin adapter allowing configurable bridging to other, well known logging systems./description urlhttp://jakarta.apache.org/commons/logging/url @@ -145,55 +145,93 @@ testSourceDirectorysrc/test/testSourceDirectory plugins - plugin !-- - - We want to create three jarfiles here; normal, -api and -adapters. - - The default jar:jar target is used to create the normal one, and - - two additional executions are defined to build the others. - - - - The custom test framework also requires the unit test code to be + - The custom test framework requires the unit test code to be - in a jarfile so it can control its place in the classpath. -- + plugin artifactIdmaven-jar-plugin/artifactId + executions +execution + idtestjar/id + phasepackage/phase + goals + goaltest-jar/goal +/goals +configuration + jarNamecommons-logging/jarName +/configuration + /execution +/executions + /plugin + + plugin +!-- + - We want to create four jarfiles from this project: normal, tests, api + - and adapters. The first two are handled by the normal jar:jar target. + - Alas, the standard jar plugin doesn't have includes/excludes support + - in version 2.0, so antrun is used to create the other ones. + -- +artifactIdmaven-antrun-plugin/artifactId executions execution idapijar/id phasepackage/phase -goals - goaljar/goal -/goals configuration - jarName${project.artifactId}-api-${project.version}/jarName - excludes - excludeorg/apache/commons/logging/impl/Log4JLogger.class/exclude - /excludes + tasks +property name=workdir value=${project.build.directory}/rejar/ +property name=target value=${project.artifactId}-api-${project.version}/ + +delete dir=${workdir} failonerror=false/ +mkdir dir=${workdir}/ + +unjar + src=${project.build.directory}/${project.build.finalName}.jar + dest=${workdir}/ +jar + basedir=${workdir} + destfile=${project.build.directory}/${target}.jar + exclude name=org/apache/commons/logging/impl/Log4J*/ + exclude name=org/apache/commons/logging/impl/Avalon*/ + exclude name=org/apache/commons/logging/impl/Jdk13*/ + exclude name=org/apache/commons/logging/impl/LogKit*/ + exclude name=org/apache/commons/logging/impl/Servlet*/ +/jar + /tasks /configuration +goals + goalrun/goal +/goals /execution execution idadaptersjar/id phasepackage/phase configuration - jarName${project.artifactId}-adapters-${project.version}/jarName - excludes -excludeorg/apache/commons/logging/Log.class/exclude -excludeorg/apache/commons/logging/LogFactory.class/exclude - excludeorg/apache/commons/logging/impl/LogFactoryImpl.class/exclude - excludeorg/apache/commons/logging/impl/WeakHashtable.class/exclude - /excludes + tasks +property name=workdir value=${project.build.directory}/rejar/ +property name=target value=${project.artifactId}-adapters-${project.version}/ + +delete dir=${workdir} failonerror=false/ +mkdir dir=${workdir}/ + +unjar + src=${project.build.directory}/${project.build.finalName}.jar + dest=${workdir}/ +jar + basedir=${workdir
svn commit: r425247 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java
Author: skitching Date: Mon Jul 24 18:26:37 2006 New Revision: 425247 URL: http://svn.apache.org/viewvc?rev=425247view=rev Log: Add javadoc about setExplicitLoader/addLogicalLib. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java?rev=425247r1=425246r2=425247view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Mon Jul 24 18:26:37 2006 @@ -72,9 +72,27 @@ * See setParentFirst. */ private boolean parentFirst = true; - + /** * Constructor. + * p + * Often, null is passed as the parent, ie the parent of the new + * instance is the bootloader. This ensures that the classpath is + * totally clean; nothing but the standard java library will be + * present. + * p + * When using a null parent classloader with a junit testcase, it *is* + * necessary for the junit library to also be visible. In this case, it + * is recommended that the following code be used: + * pre + * pathableLoader.useExplicitLoader( + * junit., + * junit.framework.Test.class.getClassLoader()); + * /pre + * Note that this works regardless of whether junit is on the system + * classpath, or whether it has been loaded by some test framework that + * creates its own classloader to run unit tests in (eg maven2's + * Surefire plugin). */ public PathableClassLoader(ClassLoader parent) { super(NO_URLS, parent); @@ -125,6 +143,28 @@ /** * Specify a classloader to use for specific java packages. + * p + * The specified classloader is normally a loader that is NOT + * an ancestor of this classloader. In particular, this loader + * may have the bootloader as its parent, but be configured to + * see specific other classes (eg the junit library loaded + * via the system classloader). + * p + * The differences between using this method, and using + * addLogicalLib are: + * ul + * liIf code calls getClassLoader on a class loaded via + * lookaside, then traces up its inheritance chain, it + * will see the real classloaders. When the class is remapped + * into this classloader via addLogicalLib, the classloader + * chain seen is this object plus ancestors. + * liIf two different jars contain classes in the same + * package, then it is not possible to load both jars into + * the same lookaside classloader (eg the system classloader) + * then map one of those subsets from here. Of course they could + * be loaded into two different lookaside classloaders and + * then a prefix used to map from here to one of those classloaders. + * /ul */ public void useExplicitLoader(String prefix, ClassLoader loader) { if (lookasides == null) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r425249 - in /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging: config/ jdk14/ log4j/log4j12/ logkit/ security/ servlet/ simple/ tccl/ tccl/log/ tccl/logfactory/
Author: skitching Date: Mon Jul 24 18:30:16 2006 New Revision: 425249 URL: http://svn.apache.org/viewvc?rev=425249view=rev Log: Make unit tests compatible with maven2 Surefire plugin. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigAPITestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigFullTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/log4j12/ApiClasspathStandardTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/log4j12/AppClasspathStandardTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/log4j12/ChildClasspathStandardTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/log4j12/ParentClasspathStandardTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/logkit/StandardTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityAllowedTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityForbiddenTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/simple/CustomConfigTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/simple/DateTimeCustomConfigTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/simple/DefaultConfigTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/BadTCCLTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclEnabledTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/logfactory/TcclDisabledTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/logfactory/TcclEnabledTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java?rev=425249r1=425248r2=425249view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java Mon Jul 24 18:30:16 2006 @@ -55,7 +55,7 @@ // class through a dummy loader though this is not absolutely // necessary... PathableClassLoader dummy = new PathableClassLoader(null); -dummy.useSystemLoader(junit.); +dummy.useExplicitLoader(junit., Test.class.getClassLoader()); dummy.addLogicalLib(testclasses); dummy.addLogicalLib(commons-logging); @@ -70,7 +70,7 @@ // so we can check that the first one in the classpath is // used. PathableClassLoader containerLoader = new PathableClassLoader(null); -containerLoader.useSystemLoader(junit.); +containerLoader.useExplicitLoader(junit., Test.class.getClassLoader()); containerLoader.addLogicalLib(commons-logging); PathableClassLoader webappLoader = new PathableClassLoader(containerLoader); Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java?rev=425249r1=425248r2=425249view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java Mon Jul 24 18:30:16 2006 @@ -62,7 +62,7 @@ // class through a dummy loader though this is not absolutely // necessary... PathableClassLoader dummy = new PathableClassLoader(null); -dummy.useSystemLoader(junit.); +dummy.useExplicitLoader(junit., Test.class.getClassLoader
svn commit: r425250 - /jakarta/commons/proper/logging/trunk/project.xml
Author: skitching Date: Mon Jul 24 18:32:04 2006 New Revision: 425250 URL: http://svn.apache.org/viewvc?rev=425250view=rev Log: Replace confusing variable use with plain text. There's no need for flexibility here as the artifact id is really unlikely to change, and if it does we can just search-and-replace. Modified: jakarta/commons/proper/logging/trunk/project.xml Modified: jakarta/commons/proper/logging/trunk/project.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/project.xml?rev=425250r1=425249r2=425250view=diff == --- jakarta/commons/proper/logging/trunk/project.xml (original) +++ jakarta/commons/proper/logging/trunk/project.xml Mon Jul 24 18:32:04 2006 @@ -32,8 +32,8 @@ /description logo/images/logo.png/logo - urlhttp://jakarta.apache.org/commons/${pom.artifactId.substring(8)}//url - packageorg.apache.commons.${pom.artifactId.substring(8)}/package + urlhttp://jakarta.apache.org/commons/logging/url + packageorg.apache.commons.logging/package organization nameThe Apache Software Foundation/name @@ -52,13 +52,12 @@ gumpRepositoryIdjakarta/gumpRepositoryId issueTrackingUrlhttp://issues.apache.org/jira//issueTrackingUrl siteAddresspeople.apache.org/siteAddress - siteDirectory/www/jakarta.apache.org/commons/${pom.artifactId.substring(8)}//siteDirectory - distributionDirectory/www/jakarta.apache.org/builds/jakarta-commons/${pom.artifactId.substring(8)}//distributionDirectory + siteDirectory/www/jakarta.apache.org/commons/logging//siteDirectory + distributionDirectory/www/jakarta.apache.org/builds/jakarta-commons/logging/distributionDirectory repository - !--connectionscm:cvs:${logging.cvs}:jakarta-commons/logging//connection-- - connectionscm:svn:http://svn.apache.org/repos/asf/jakarta/commons/proper/${pom.artifactId.substring(8)}/trunk/connection - urlhttp://svn.apache.org/repos/asf/jakarta/commons/proper/${pom.artifactId.substring(8)}/trunk/url + connectionscm:svn:http://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk/connection + urlhttp://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk/url /repository versions - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r425252 - in /jakarta/commons/proper/logging/trunk: commons-logging-README.txt pom.xml
Author: skitching Date: Mon Jul 24 18:37:50 2006 New Revision: 425252 URL: http://svn.apache.org/viewvc?rev=425252view=rev Log: Initial attempt at building commons-logging using maven2; not fully functional yet. Added: jakarta/commons/proper/logging/trunk/commons-logging-README.txt (with props) jakarta/commons/proper/logging/trunk/pom.xml Added: jakarta/commons/proper/logging/trunk/commons-logging-README.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/commons-logging-README.txt?rev=425252view=auto == --- jakarta/commons/proper/logging/trunk/commons-logging-README.txt (added) +++ jakarta/commons/proper/logging/trunk/commons-logging-README.txt Mon Jul 24 18:37:50 2006 @@ -0,0 +1,6 @@ +The Logging package is an ultra-thin bridge between different logging implementations. A library that uses the commons-logging API can be used with any logging implementation at runtime. Commons-logging comes with support for a number of popular logging implementations, and writing adapters for others is a reasonably simple task. + +See RELEASE-NOTES.txt for details on the current release. + + +Note: The maven2 pom.xml file is affected by the presence or absence of this file. See the comments in that file for details. Propchange: jakarta/commons/proper/logging/trunk/commons-logging-README.txt -- svn:eol-style = native Added: jakarta/commons/proper/logging/trunk/pom.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/pom.xml?rev=425252view=auto == --- jakarta/commons/proper/logging/trunk/pom.xml (added) +++ jakarta/commons/proper/logging/trunk/pom.xml Mon Jul 24 18:37:50 2006 @@ -0,0 +1,361 @@ +?xml version=1.0 encoding=UTF-8?project + modelVersion4.0.0/modelVersion + groupIdcommons-logging/groupId + artifactIdcommons-logging/artifactId + nameLogging/name + version1.1.1/version + descriptionCommons Logging is a thin adapter allowing configurable bridging to other, +well known logging systems./description + urlhttp://jakarta.apache.org/commons/logging/url + + issueManagement +urlhttp://issues.apache.org/jira//url + /issueManagement + + ciManagement +notifiers + notifier +configuration + addresscommons-dev@jakarta.apache.org/address +/configuration + /notifier +/notifiers + /ciManagement + + inceptionYear2001/inceptionYear + + mailingLists +mailingList + nameCommons Dev List/name + subscribe[EMAIL PROTECTED]/subscribe + unsubscribe[EMAIL PROTECTED]/unsubscribe + archivehttp://mail-archives.apache.org/mod_mbox/jakarta-commons-dev//archive + otherArchives + archivehttp://www.mail-archive.com/commons-dev%40jakarta.apache.org//archive + /otherArchives +/mailingList +mailingList + nameCommons User List/name + subscribe[EMAIL PROTECTED]/subscribe + unsubscribe[EMAIL PROTECTED]/unsubscribe + archivehttp://mail-archives.apache.org/mod_mbox/jakarta-commons-user//archive + otherArchives + archivehttp://www.mail-archive.com/commons-user%40jakarta.apache.org//archive + /otherArchives +/mailingList + /mailingLists + developers +developer + idmorgand/id + nameMorgan Delagrange/name + emailmorgand at apache dot org/email + organizationApache/organization + roles +roleJava Developer/role + /roles +/developer +developer + idrwaldhoff/id + nameRodney Waldhoff/name + emailrwaldhoff at apache org/email + organizationApache Software Foundation/organization +/developer +developer + idcraigmcc/id + nameCraig McClanahan/name + emailcraigmcc at apache org/email + organizationApache Software Foundation/organization +/developer +developer + idsanders/id + nameScott Sanders/name + emailsanders at apache dot org/email + organizationApache Software Foundation/organization +/developer +developer + idrdonkin/id + nameRobert Burrell Donkin/name + emailrdonkin at apache dot org/email + organizationApache Software Foundation/organization +/developer +developer + iddonaldp/id + namePeter Donald/name + emaildonaldp at apache dot org/email + organization/organization +/developer +developer + idcostin/id + nameCostin Manolache/name + emailcostin at apache dot org/email + organizationApache Software Foundation/organization +/developer +developer + idrsitze/id + nameRichard Sitze/name + emailrsitze at apache dot org/email + organizationApache Software Foundation/organization +/developer +developer + idbaliuka/id + nameJuozas Baliuka/name + email[EMAIL
svn commit: r424063 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java
Author: skitching Date: Thu Jul 20 14:06:09 2006 New Revision: 424063 URL: http://svn.apache.org/viewvc?rev=424063view=rev Log: * INCOMPATIBLE CHANGE (minor): protected method getContextClassloader no longer uses an AccessController. This was a (minor) security flaw. Instead, behaviour is reverted to pre-1.1 behaviour where no AccessController is used, and a new private method getContextClassloaderInternal has been created. The chance of breaking valid user code is extremely small here. Note that this forces subclass LogFactoryImpl to provide its own copy of getContextClassloaderInternal, as the parent no longer exposes the (restricted) context classloader object. * Get system properties using an AccessController so they are accessable by a trusted JCL lib called from untrusted code. * Revert recent patch to run entire static initializer under an AccessController, as the chances of creating a security flaw are too high. The specific problem this patch was intended to fix has been addressed by fetching specific system properties via an AccessController. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java?rev=424063r1=424062r2=424063view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Thu Jul 20 14:06:09 2006 @@ -49,6 +49,30 @@ */ public abstract class LogFactory { +// Implementation note re AccessController usage +// +// It is important to keep code invoked via an AccessController to small +// auditable blocks. Such code must carefully evaluate all user input +// (parameters, system properties, config file contents, etc). As an +// example, a Log implementation should not write to its logfile +// with an AccessController anywhere in the call stack, otherwise an +// insecure application could configure the log implementation to write +// to a protected file using the privileges granted to JCL rather than +// to the calling application. +// +// Under no circumstance should a non-private method return data that is +// retrieved via an AccessController. That would allow an insecure app +// to invoke that method and obtain data that it is not permitted to have. +// +// Invoking user-supplied code with an AccessController set is not a major +// issue (eg invoking the constructor of the class specified by +// HASHTABLE_IMPLEMENTATION_PROPERTY). That class will be in a different +// trust domain, and therefore must have permissions to do whatever it +// is trying to do regardless of the permissions granted to JCL. There is +// a slight issue in that untrusted code may point that environment var +// to another trusted library, in which case the code runs if both that +// lib and JCL have the necessary permissions even when the untrusted +// caller does not. That's a pretty hard route to exploit though. // - Manifest Constants @@ -318,7 +342,7 @@ Hashtable result = null; String storeImplementationClass; try { -storeImplementationClass = System.getProperty(HASHTABLE_IMPLEMENTATION_PROPERTY); +storeImplementationClass = getSystemProperty(HASHTABLE_IMPLEMENTATION_PROPERTY, null); } catch(SecurityException ex) { // Permissions don't allow this to be accessed. Default to the modern // weak hashtable implementation if it is available. @@ -387,7 +411,7 @@ */ public static LogFactory getFactory() throws LogConfigurationException { // Identify the class loader we will be using -ClassLoader contextClassLoader = getContextClassLoader(); +ClassLoader contextClassLoader = getContextClassLoaderInternal(); if (contextClassLoader == null) { // This is an odd enough situation to report about. This @@ -453,7 +477,7 @@ } try { -String factoryClass = System.getProperty(FACTORY_PROPERTY); +String factoryClass = getSystemProperty(FACTORY_PROPERTY, null); if (factoryClass != null) { if (isDiagnosticsEnabled()) { logDiagnostic( @@ -755,6 +779,11 @@ * from starting up. Maybe it would be good to detect this situation and * just disable all commons-logging? Not high priority though - as stated * above, security policies that prevent classloader access aren't common. + * p + * Note that returning
svn commit: r424066 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Author: skitching Date: Thu Jul 20 14:08:49 2006 New Revision: 424066 URL: http://svn.apache.org/viewvc?rev=424066view=rev Log: * Add method getSystemProperty which fetches system properties using an AccessController, so they are accessable by a trusted JCL lib called from untrusted code. * Add method getContextClassLoaderInternal to fetch context classloader using an AccessController, as the parent LogFactory class no longer exposes this (restricted) object for any subclass to access. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java?rev=424066r1=424065r2=424066view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Thu Jul 20 14:08:49 2006 @@ -21,6 +21,8 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; @@ -639,6 +641,53 @@ // -- Private Methods /** + * Calls LogFactory.directGetContextClassLoader under the control of an + * AccessController class. This means that java code running under a + * security manager that forbids access to ClassLoaders will still work + * if this class is given appropriate privileges, even when the caller + * doesn't have such privileges. Without using an AccessController, the + * the entire call stack must have the privilege before the call is + * allowed. + * + * @return the context classloader associated with the current thread, + * or null if security doesn't allow it. + * + * @throws LogConfigurationException if there was some weird error while + * attempting to get the context classloader. + * + * @throws SecurityException if the current java security policy doesn't + * allow this class to access the context classloader. + */ +private static ClassLoader getContextClassLoaderInternal() +throws LogConfigurationException { +return (ClassLoader)AccessController.doPrivileged( +new PrivilegedAction() { +public Object run() { +return LogFactory.directGetContextClassLoader(); +} +}); +} + +/** + * Read the specified system property, using an AccessController so that + * the property can be read if JCL has been granted the appropriate + * security rights even if the calling code has not. + * p + * Take care not to expose the value returned by this method to the + * calling application in any way; otherwise the calling app can use that + * info to access data that should not be available to it. + */ +private static String getSystemProperty(final String key, final String def) +throws SecurityException { +return (String) AccessController.doPrivileged( +new PrivilegedAction() { +public Object run() { +return System.getProperty(key, def); +} +}); +} + +/** * Utility method to check whether a particular logging library is * present and available for use. Note that this does inot/i * affect the future behaviour of this class. @@ -701,7 +750,11 @@ } try { -String value = System.getProperty(property); +// warning: minor security hole here, in that we potentially read a system +// property that the caller cannot, then output it in readable form as a +// diagnostic message. However it's only ever JCL-specific properties +// involved here, so the harm is truly trivial. +String value = getSystemProperty(property, null); if (value != null) { if (isDiagnosticsEnabled()) { logDiagnostic([ENV] Found system property [ + value + ] for + property); @@ -901,7 +954,7 @@ LOG_PROPERTY + '); } try { -specifiedClass = System.getProperty(LOG_PROPERTY); +specifiedClass = getSystemProperty(LOG_PROPERTY, null); } catch (SecurityException e) { if (isDiagnosticsEnabled()) { logDiagnostic(No access allowed to system property ' + @@ -916,7 +969,7
svn commit: r424078 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java
Author: skitching Date: Thu Jul 20 14:52:52 2006 New Revision: 424078 URL: http://svn.apache.org/viewvc?rev=424078view=rev Log: Only count security exceptions before a message is actually logged, as j.u.logging does (and should) generate security exceptions. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java?rev=424078r1=424077r2=424078view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java Thu Jul 20 14:52:52 2006 @@ -93,6 +93,19 @@ org.apache.commons.logging.LogFactory); Method m = c.getMethod(getLog, new Class[] {Class.class}); Log log = (Log) m.invoke(null, new Object[] {this.getClass()}); + +// Check whether we had any security exceptions so far (which were +// caught by the code). We should not, as every secure operation +// should be wrapped in an AccessController. Any security exceptions +// indicate a path that is missing an appropriate AccessController. +// +// We don't wait until after the log.info call to get this count +// because java.util.logging tries to load a resource bundle, which +// requires permission accessClassInPackage. JCL explicitly does not +// wrap calls to log methods in AccessControllers because writes to +// a log file *should* only be permitted if the original caller is +// trusted to access that file. +int untrustedCodeCount = mySecurityManager.getUntrustedCodeCount(); log.info(testing); // check that the default map implementation was loaded, as JCL was @@ -104,7 +117,7 @@ assertNotNull(factoryTable); assertEquals(CustomHashtable.class.getName(), factoryTable.getClass().getName()); -assertEquals(0, mySecurityManager.getUntrustedCodeCount()); +assertEquals(0, untrustedCodeCount); } catch(Throwable t) { // Restore original security manager so output can be generated; the // PrintWriter constructor tries to read the line.separator - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r424082 - in /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security: SecurityAllowedTestCase.java SecurityForbiddenTestCase.java SecurityTestCaseAllowed.java Se
Author: skitching Date: Thu Jul 20 14:59:50 2006 New Revision: 424082 URL: http://svn.apache.org/viewvc?rev=424082view=rev Log: Rename testcase files, as batch junit testing only detects classes ending in TestCase. Added: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityAllowedTestCase.java - copied, changed from r424078, jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityForbiddenTestCase.java - copied, changed from r423653, jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseForbidden.java Removed: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseForbidden.java Copied: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityAllowedTestCase.java (from r424078, jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java) URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityAllowedTestCase.java?p2=jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityAllowedTestCase.javap1=jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.javar1=424078r2=424082rev=424082view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityAllowedTestCase.java Thu Jul 20 14:59:50 2006 @@ -40,7 +40,7 @@ * PathableClassLoader approach to ensure each test is run in its own * classloader, and use a separate testcase class for each test. */ -public class SecurityTestCaseAllowed extends TestCase +public class SecurityAllowedTestCase extends TestCase { private SecurityManager oldSecMgr; @@ -59,7 +59,7 @@ parent.addLogicalLib(testclasses); Class testClass = parent.loadClass( -org.apache.commons.logging.security.SecurityTestCaseAllowed); +org.apache.commons.logging.security.SecurityAllowedTestCase); return new PathableTestSuite(testClass, parent); } Copied: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityForbiddenTestCase.java (from r423653, jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseForbidden.java) URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityForbiddenTestCase.java?p2=jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityForbiddenTestCase.javap1=jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseForbidden.javar1=423653r2=424082rev=424082view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseForbidden.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityForbiddenTestCase.java Thu Jul 20 14:59:50 2006 @@ -43,7 +43,7 @@ * PathableClassLoader approach to ensure each test is run in its own * classloader, and use a separate testcase class for each test. */ -public class SecurityTestCaseForbidden extends TestCase +public class SecurityForbiddenTestCase extends TestCase { private SecurityManager oldSecMgr; @@ -62,7 +62,7 @@ parent.addLogicalLib(testclasses); Class testClass = parent.loadClass( -org.apache.commons.logging.security.SecurityTestCaseForbidden); +org.apache.commons.logging.security.SecurityForbiddenTestCase); return new PathableTestSuite(testClass, parent); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r424107 - in /jakarta/commons/proper/logging/trunk/src/java: ./ org/apache/commons/logging/ org/apache/commons/logging/impl/
Author: skitching Date: Thu Jul 20 16:15:42 2006 New Revision: 424107 URL: http://svn.apache.org/viewvc?rev=424107view=rev Log: Update license info using script update-AL20.pl, as per http://www.apache.org/legal/src-headers.html Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/Log.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogConfigurationException.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogSource.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/AvalonLogger.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Jdk13LumberjackLogger.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Jdk14Logger.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4JLogger.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogKitLogger.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/NoOpLog.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/ServletContextCleaner.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/SimpleLog.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/WeakHashtable.java jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/package.html jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/package.html jakarta/commons/proper/logging/trunk/src/java/overview.html Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/Log.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/Log.java?rev=424107r1=424106r2=424107view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/Log.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/Log.java Thu Jul 20 16:15:42 2006 @@ -1,9 +1,10 @@ /* - * Copyright 2001-2004 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogConfigurationException.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogConfigurationException.java?rev=424107r1=424106r2=424107view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogConfigurationException.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogConfigurationException.java Thu Jul 20 16:15:42 2006 @@ -1,9 +1,10 @@ /* - * Copyright 2001-2004 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java?rev=424107r1=424106r2=424107view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java
svn commit: r424110 - in /jakarta/commons/proper/logging/trunk: ./ xdocs/
Author: skitching Date: Thu Jul 20 16:29:33 2006 New Revision: 424110 URL: http://svn.apache.org/viewvc?rev=424110view=rev Log: Update license info using script update-AL20.pl, as per http://www.apache.org/legal/src-headers.html Modified: jakarta/commons/proper/logging/trunk/PROPOSAL.html jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt jakarta/commons/proper/logging/trunk/STATUS.html jakarta/commons/proper/logging/trunk/build.properties.sample jakarta/commons/proper/logging/trunk/build.xml jakarta/commons/proper/logging/trunk/checkstyle.xml jakarta/commons/proper/logging/trunk/maven.xml jakarta/commons/proper/logging/trunk/project.properties jakarta/commons/proper/logging/trunk/project.xml jakarta/commons/proper/logging/trunk/xdocs/building.xml jakarta/commons/proper/logging/trunk/xdocs/cvs-usage.xml jakarta/commons/proper/logging/trunk/xdocs/guide.xml jakarta/commons/proper/logging/trunk/xdocs/index.xml jakarta/commons/proper/logging/trunk/xdocs/issue-tracking.xml jakarta/commons/proper/logging/trunk/xdocs/junit-report.xml jakarta/commons/proper/logging/trunk/xdocs/navigation.xml jakarta/commons/proper/logging/trunk/xdocs/proposal.xml jakarta/commons/proper/logging/trunk/xdocs/troubleshooting.xml Modified: jakarta/commons/proper/logging/trunk/PROPOSAL.html URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/PROPOSAL.html?rev=424110r1=424109r2=424110view=diff == --- jakarta/commons/proper/logging/trunk/PROPOSAL.html (original) +++ jakarta/commons/proper/logging/trunk/PROPOSAL.html Thu Jul 20 16:29:33 2006 @@ -1,10 +1,11 @@ !-- - Copyright 2001-2004 The Apache Software Foundation. - - Licensed under the Apache License, Version 2.0 (the License); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the License); you may not use this file except in compliance with + the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Modified: jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt?rev=424110r1=424109r2=424110view=diff == --- jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt Thu Jul 20 16:29:33 2006 @@ -1,10 +1,11 @@ !-- - Copyright 2005,2006 The Apache Software Foundation. - - Licensed under the Apache License, Version 2.0 (the License); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the License); you may not use this file except in compliance with + the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Modified: jakarta/commons/proper/logging/trunk/STATUS.html URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/STATUS.html?rev=424110r1=424109r2=424110view=diff == --- jakarta/commons/proper/logging/trunk/STATUS.html (original) +++ jakarta/commons/proper/logging/trunk/STATUS.html Thu Jul 20 16:29:33 2006 @@ -1,10 +1,11 @@ !-- - Copyright 2001-2004 The Apache Software Foundation. - - Licensed under the Apache License, Version 2.0 (the License); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the License); you may not use this file except in compliance with + the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Modified: jakarta/commons/proper/logging/trunk/build.properties.sample URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/build.properties.sample?rev=424110r1=424109r2=424110view=diff
svn commit: r424112 - /jakarta/commons/proper/logging/trunk/xdocs/tech.xml
Author: skitching Date: Thu Jul 20 16:32:01 2006 New Revision: 424112 URL: http://svn.apache.org/viewvc?rev=424112view=rev Log: Update license info using script update-AL20.pl, as per http://www.apache.org/legal/src-headers.html Modified: jakarta/commons/proper/logging/trunk/xdocs/tech.xml Modified: jakarta/commons/proper/logging/trunk/xdocs/tech.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/xdocs/tech.xml?rev=424112r1=424111r2=424112view=diff == --- jakarta/commons/proper/logging/trunk/xdocs/tech.xml (original) +++ jakarta/commons/proper/logging/trunk/xdocs/tech.xml Thu Jul 20 16:32:01 2006 @@ -1,21 +1,20 @@ ?xml version=1.0? !-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the License); you may not use this file except in compliance with +the License. You may obtain a copy of the License at - Copyright 2001-2004 The Apache Software Foundation. - - Licensed under the Apache License, Version 2.0 (the License); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an AS IS BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an AS IS BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. -- document - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r424113 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java
Author: skitching Date: Thu Jul 20 16:34:46 2006 New Revision: 424113 URL: http://svn.apache.org/viewvc?rev=424113view=rev Log: Add @since comment for new method. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java?rev=424113r1=424112r2=424113view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java Thu Jul 20 16:34:46 2006 @@ -39,6 +39,8 @@ * methods. This allows multiple actions to be chained together. * p * See also Digester.setStackAction. + * + * @since 1.7.1 */ public interface StackAction { /** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r424114 - /jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt
Author: skitching Date: Thu Jul 20 16:35:25 2006 New Revision: 424114 URL: http://svn.apache.org/viewvc?rev=424114view=rev Log: Note that method addStackAction has been added to the Digester class. Modified: jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt Modified: jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt?rev=424114r1=424113r2=424114view=diff == --- jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt Thu Jul 20 16:35:25 2006 @@ -48,6 +48,14 @@ -- node-create-rule tag added to provide access to NodeCreateRule. Patch provided by Kevin Ross; bugzilla 36482 +Stack Monitoring + + +Method setStackAction has been added to the Digester class. This allows user +code to monitor all objects pushed onto and popped off digester stacks. In +particular, this makes it easier to store source file/line info for all +objects created during parsing. + BUGS FROM PREVIOUS RELEASE == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r424139 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Author: skitching Date: Thu Jul 20 17:09:23 2006 New Revision: 424139 URL: http://svn.apache.org/viewvc?rev=424139view=rev Log: Fix for LOGGING-107. JCL failed when run under a security policy that prevented calling ClassLoader.getParent. We now catch SecurityException in this case, and also use an AccessController so JCL can be granted permissions without needing the caller to have those permissions too. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java?rev=424139r1=424138r2=424139view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Thu Jul 20 17:09:23 2006 @@ -689,6 +689,28 @@ } /** + * Fetch the parent classloader of a specified classloader. + * p + * If a SecurityException occurs, null is returned. + * p + * Note that this method is non-static merely so logDiagnostic is available. + */ +private ClassLoader getParentClassLoader(final ClassLoader cl) { +try { +return (ClassLoader)AccessController.doPrivileged( +new PrivilegedAction() { +public Object run() { +return cl.getParent(); +} +}); +} catch(SecurityException ex) { +logDiagnostic([SECURITY] Unable to obtain parent classloader); +return null; +} + +} + +/** * Utility method to check whether a particular logging library is * present and available for use. Note that this does inot/i * affect the future behaviour of this class. @@ -1161,7 +1183,8 @@ } // try the parent classloader -currentCL = currentCL.getParent(); +// currentCL = currentCL.getParent(); +currentCL = getParentClassLoader(currentCL); } if ((logAdapter != null) affectState) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r424144 - /jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt
Author: skitching Date: Thu Jul 20 17:12:48 2006 New Revision: 424144 URL: http://svn.apache.org/viewvc?rev=424144view=rev Log: Start release notes for 1.1.1 Modified: jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt Modified: jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt?rev=424144r1=424143r2=424144view=diff == --- jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt Thu Jul 20 17:12:48 2006 @@ -20,25 +20,14 @@ $Id$ Commons Logging Package -Version 1.1.0 +Version 1.1.1 Release Notes INTRODUCTION: -This release of Jakarta Commons Logging (JCL) is a maintenance release, with a -few new configuration features but no major changes in services provided. - -This release introduces significant changes in the way that discovery of -logging implementations occurs, and how errors are handled. A number of -problems that have troubled users in past releases (particularly the -Log4JLogger does not implement Log problem) will hopefully be -significantly reduced or cured. - -This release is 100% compatible with existing code that calls -commons-logging. There are some incompatibilities with code that extends -commons-logging, for example to implement custom logging adapters. See -the compatibility section for details. +This release of Jakarta Commons Logging (JCL) is a maintenance release, with +just a couple of fixes for using JCL under restrictive security policies. All core classes were compiled with a 1.2.x JDK. JCL may work on some augmented 1.1 series JREs but it is recommended that those wish to run @@ -58,99 +47,18 @@ updated implementation with a deployed application may not have any effect. See the commons-logging site and/or the wiki for more information. -== New Features == - -* Jar files now have release-numbers embedded in the names, for easier management. - -* New jar file commons-logging-adapters-xxx.jar is now provided. This can be - used to resolve class cast conflicts where parts of commons-logging are - deployed via different classloaders. It is not expected to be frequently - used; it is only necessary in situations where a container has deployed - commons-logging-api.jar and a webapp wants to bind to a third-party - logging implementation such as log4j. In this case, the webapp can - experience problems if it deploys commons-logging.jar as this causes - duplicates of the core commons-logging classes, but commons-logging-adapters - can be safely used. - -* New internal diagnostics feature. If commons-logging is behaving in an - unexpected manner, you can now set system property -org.apache.commons.logging.diagnostics.dest - to the value STDOUT, STDERR or a filename. As commons-logging initialises - itself for each new contextClassLoader it detects, useful information will - be output about which logging library is bound to and why. - -* JCL now prefers to make a best attempt in problem scenarios rather than - report an error and fail to initialise. New configurable attributes - ALLOW_FLAWED_HIERARCHY, ALLOW_FLAWED_DISCOVERY and ALLOW_FLAWED_CONTEXT are - provided to control startup behavior. The default values for these are all - true, meaning that commons-logging attempts to recover from bad logging - configuration situations by finding *some* logger to use even when it isn't - quite the one that might be expected. This will significantly reduce the - occurrence of the dreaded LogConfigurationException on application/webapp - startup at the cost of slightly more ambiguity about where output will go. - In cases where no logging output is generated or wanted (which is the case - 99% of the time) this is definitely a more convenient approach. Users who - cannot figure out where logging went or why it went to an unexpected - destination can enable diagnostics to find out, or set the ALLOW_FLAWED_ - settings to false to force LogConfigurationException to be thrown as in - earlier releases. - -* Fix for the problem where memory was not being released under some circumstances - when a webapp was undeployed. An internal change fixes some situations where - that occurs (by using weak references); this requires no action on the part of - users of this library. In addition, a utility class ServletContextCleaner is - provided in the jar file which is expected to resolve this problem in all - situations; however it is necessary for an application to define this class as - a ServletContextListener in the web.xml in order for this to be invoked. - -* Prioritised commons-logging.properties files. A file with the name - commons-logging.properties placed
svn commit: r423653 - in /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security: MockSecurityManager.java SecurityTestCase.java SecurityTestCaseAllowed.java SecurityTestCas
Author: skitching Date: Wed Jul 19 16:26:49 2006 New Revision: 423653 URL: http://svn.apache.org/viewvc?rev=423653view=rev Log: Add more unit tests for SecurityManager/AccessController issues Added: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseAllowed.java (with props) jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCaseForbidden.java (with props) Removed: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java?rev=423653r1=423652r2=423653view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java Wed Jul 19 16:26:49 2006 @@ -18,68 +18,118 @@ import java.io.FilePermission; import java.security.Permission; -import java.util.PropertyPermission; +import java.security.Permissions; /** * Custom implementation of a security manager, so we can control the * security environment for tests in this package. - * p - * Note that we don't want to refuse permission to any junit method; otherwise - * any call to an assert will not be able to output its data! */ public class MockSecurityManager extends SecurityManager { + +private Permissions permissions = new Permissions(); +private static final Permission setSecurityManagerPerm = +new RuntimePermission(setSecurityManager); + +private int untrustedCodeCount = 0; + +public MockSecurityManager() { +permissions.add(setSecurityManagerPerm); +} + +/** + * Define the set of permissions to be granted to classes in the o.a.c.l package, + * but NOT to unit-test classes in o.a.c.l.security package. + */ +public void addPermission(Permission p) { +permissions.add(p); +} + +/** + * This returns the number of times that a check of a permission failed + * due to stack-walking tracing up into untrusted code. Any non-zero + * value indicates a bug in JCL, ie a situation where code was not + * correctly wrapped in an AccessController block. The result of such a + * bug is that signing JCL is not sufficient to allow JCL to perform + * the operation; the caller would need to be signed too. + */ +public int getUntrustedCodeCount() { +return untrustedCodeCount; +} + public void checkPermission(Permission p) throws SecurityException { -// System.out.println(\n\ntesting permission: + p.getClass() + :+ p); - -// allow read-only access to files, as this is needed to load classes! +if (setSecurityManagerPerm.implies(p)) { +// ok, allow this; we don't want to block any calls to setSecurityManager +// otherwise this custom security manager cannot be reset to the original. +// System.out.println(setSecurityManager: granted); +return; +} + +// Allow read-only access to files, as this is needed to load classes! +// Ideally, we would limit this to just .class and .jar files. if (p instanceof FilePermission) { -FilePermission fp = (FilePermission) p; -if (fp.getActions().equals(read)) { -return; -} + FilePermission fp = (FilePermission) p; + if (fp.getActions().equals(read)) { +// System.out.println(Permit read of files); +return; + } } +System.out.println(\n\ntesting permission: + p.getClass() + :+ p); + Exception e = new Exception(); e.fillInStackTrace(); StackTraceElement[] stack = e.getStackTrace(); -boolean isControlled = false; +// scan the call stack from most recent to oldest. // start at 1 to skip the entry in the stack for this method for(int i=1; istack.length; ++i) { -String mname = stack[i].getMethodName(); -if (mname.equals(setSecurityManager)) { -// ok, allow this; we don't want to block any calls to setSecurityManager -// otherwise this custom security manager cannot be reset to the original -// one... -// System.out.println(Allow setSecurityManager); -return; -} - String cname = stack[i].getClassName
svn commit: r423654 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java
Author: skitching Date: Wed Jul 19 16:31:00 2006 New Revision: 423654 URL: http://svn.apache.org/viewvc?rev=423654view=rev Log: Fix LOGGING-106 where JCL wouldn't start when run under a SecurityManager that refuses access to system properties. Also use an AccessController so that a signed JCL will work in an unsigned app; note that there appears to be other places where we are missing AccessControllers too. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java?rev=423654r1=423653r2=423654view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Wed Jul 19 16:31:00 2006 @@ -316,8 +316,15 @@ */ private static final Hashtable createFactoryStore() { Hashtable result = null; -String storeImplementationClass -= System.getProperty(HASHTABLE_IMPLEMENTATION_PROPERTY); +String storeImplementationClass; +try { +storeImplementationClass = System.getProperty(HASHTABLE_IMPLEMENTATION_PROPERTY); +} catch(SecurityException ex) { +// Permissions don't allow this to be accessed. Default to the modern +// weak hashtable implementation if it is available. +storeImplementationClass = null; +} + if (storeImplementationClass == null) { storeImplementationClass = WEAK_HASHTABLE_CLASSNAME; } @@ -1698,6 +1705,19 @@ } } +// called from static class initialiser, ie when class is loaded +private static void initClass() { +// note: it's safe to call methods before initDiagnostics (though +// diagnostic output gets discarded). +thisClassLoader = getClassLoader(LogFactory.class); +initDiagnostics(); +logClassLoaderEnvironment(LogFactory.class); +factories = createFactoryStore(); +if (isDiagnosticsEnabled()) { +logDiagnostic(BOOTSTRAP COMPLETED); +} +} + // -- // Static initialiser block to perform initialisation at class load time. // @@ -1718,13 +1738,12 @@ // -- static { -// note: it's safe to call methods before initDiagnostics. -thisClassLoader = getClassLoader(LogFactory.class); -initDiagnostics(); -logClassLoaderEnvironment(LogFactory.class); -factories = createFactoryStore(); -if (isDiagnosticsEnabled()) { -logDiagnostic(BOOTSTRAP COMPLETED); -} +AccessController.doPrivileged( +new PrivilegedAction() { +public Object run() { +initClass(); +return null; +} +}); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r420429 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/impl/WeakHashtableTest.java
Author: skitching Date: Sun Jul 9 23:03:14 2006 New Revision: 420429 URL: http://svn.apache.org/viewvc?rev=420429view=rev Log: Remove weird unicode char in comments that causes compile warnings Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/impl/WeakHashtableTest.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/impl/WeakHashtableTest.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/impl/WeakHashtableTest.java?rev=420429r1=420428r2=420429view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/impl/WeakHashtableTest.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/impl/WeakHashtableTest.java Sun Jul 9 23:03:14 2006 @@ -56,7 +56,7 @@ weakHashtable.put(keyThree, valueThree); } -/** Tests public boolean contains(ObjectÊvalue) */ +/** Tests public boolean contains(Object value) */ public void testContains() throws Exception { assertFalse(weakHashtable.contains(new Long(1))); assertFalse(weakHashtable.contains(new Long(2))); @@ -67,7 +67,7 @@ assertFalse(weakHashtable.contains(new Long(400))); } -/** Tests public boolean containsKey(ObjectÊkey) */ +/** Tests public boolean containsKey(Object key) */ public void testContainsKey() throws Exception { assertTrue(weakHashtable.containsKey(new Long(1))); assertTrue(weakHashtable.containsKey(new Long(2))); @@ -78,7 +78,7 @@ assertFalse(weakHashtable.containsKey(new Long(400))); } -/** Tests public boolean containsValue(ObjectÊvalue) */ +/** Tests public boolean containsValue(Object value) */ public void testContainsValue() throws Exception { assertFalse(weakHashtable.containsValue(new Long(1))); assertFalse(weakHashtable.containsValue(new Long(2))); @@ -119,7 +119,7 @@ } } -/** Tests public Object get(ObjectÊkey) */ +/** Tests public Object get(Object�key) */ public void testGet() throws Exception { assertEquals(valueOne, weakHashtable.get(keyOne)); assertEquals(valueTwo, weakHashtable.get(keyTwo)); @@ -148,7 +148,7 @@ assertTrue(keySet.contains(keyThree)); } -/** Tests public Object put(ObjectÊkey, ObjectÊvalue) */ +/** Tests public Object put(Object key, Object value) */ public void testPut() throws Exception { Long anotherKey = new Long(2004); weakHashtable.put(anotherKey, new Long(1066)); @@ -174,7 +174,7 @@ assertNotNull(did not throw an exception adding a null value, caught); } -/** Tests public void putAll(MapÊt) */ +/** Tests public void putAll(Map t) */ public void testPutAll() throws Exception { Map newValues = new HashMap(); Long newKey = new Long(1066); @@ -190,7 +190,7 @@ assertEquals(anotherNewValue, weakHashtable.get(anotherNewKey)); } -/** Tests public Object remove(ObjectÊkey) */ +/** Tests public Object remove(Object�key) */ public void testRemove() throws Exception { weakHashtable.remove(keyOne); assertEquals(2, weakHashtable.size()); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r420478 - in /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security: ./ MockSecurityManager.java SecurityTestCase.java
Author: skitching Date: Mon Jul 10 03:25:49 2006 New Revision: 420478 URL: http://svn.apache.org/viewvc?rev=420478view=rev Log: Add unit tests to check behaviour when running in applet-like environments with restrictive security managers. Added: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java (with props) jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/SecurityTestCase.java (with props) Added: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java?rev=420478view=auto == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java (added) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java Mon Jul 10 03:25:49 2006 @@ -0,0 +1,85 @@ +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.logging.security; + +import java.io.FilePermission; +import java.security.Permission; +import java.util.PropertyPermission; + + +/** + * Custom implementation of a security manager, so we can control the + * security environment for tests in this package. + * p + * Note that we don't want to refuse permission to any junit method; otherwise + * any call to an assert will not be able to output its data! + */ +public class MockSecurityManager extends SecurityManager { +public void checkPermission(Permission p) throws SecurityException { +// System.out.println(\n\ntesting permission: + p.getClass() + :+ p); + +// allow read-only access to files, as this is needed to load classes! +if (p instanceof FilePermission) { +FilePermission fp = (FilePermission) p; +if (fp.getActions().equals(read)) { +return; +} +} + +Exception e = new Exception(); +e.fillInStackTrace(); +StackTraceElement[] stack = e.getStackTrace(); + +boolean isControlled = false; +// start at 1 to skip the entry in the stack for this method +for(int i=1; istack.length; ++i) { +String mname = stack[i].getMethodName(); +if (mname.equals(setSecurityManager)) { +// ok, allow this; we don't want to block any calls to setSecurityManager +// otherwise this custom security manager cannot be reset to the original +// one... +// System.out.println(Allow setSecurityManager); +return; +} + +String cname = stack[i].getClassName(); +//System.out.println( + i + : + stack[i].getClassName() + +// . + stack[i].getMethodName()); +if (cname.startsWith(org.apache.commons.logging)) { +isControlled = true; +break; +} +} + +if (!isControlled) { +// we have scanned the entire stack, and found no logging classes, so +// this must have been called from junit +// System.out.println(Not relevant to test; returning success); +return; +} + +if (p instanceof PropertyPermission) { +// emulate an applet environment where system properties are not accessable +throw new SecurityException( + Permission refused to access property: ++ ((PropertyPermission)p).getName()); +} + +// emulate an environment where *everything* is refused +throw new SecurityException(Permission refused: + p.getClass() + : + p); +} +} Propchange: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java -- svn:eol-style = native Propchange: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/security/MockSecurityManager.java
svn commit: r406292 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java
Author: skitching Date: Sun May 14 02:31:48 2006 New Revision: 406292 URL: http://svn.apache.org/viewcvs?rev=406292view=rev Log: Fix incorrect package name in unit test. The test was still being compiled and run ok; the generated .class was just ending up in an odd directory. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java?rev=406292r1=406291r2=406292view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java Sun May 14 02:31:48 2006 @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.apache.commons.logging.log4j.log4j12; +package org.apache.commons.logging.servlet; import junit.framework.Test; import junit.framework.TestCase; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r406293 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/WeakHashtable.java
Author: skitching Date: Sun May 14 02:35:42 2006 New Revision: 406293 URL: http://svn.apache.org/viewcvs?rev=406293view=rev Log: Remove unused variable. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/WeakHashtable.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/WeakHashtable.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/WeakHashtable.java?rev=406293r1=406292r2=406293view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/WeakHashtable.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/WeakHashtable.java Sun May 14 02:35:42 2006 @@ -237,7 +237,6 @@ purgeOne(); } -Object result = null; Referenced keyRef = new Referenced(key, queue); return super.put(keyRef, value); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r406303 - in /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging: pathable/ tccl/log/ tccl/logfactory/
Author: skitching Date: Sun May 14 03:02:26 2006 New Revision: 406303 URL: http://svn.apache.org/viewcvs?rev=406303view=rev Log: Fix a few trivial compiler warnings. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclEnabledTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/logfactory/TcclDisabledTestCase.java jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/logfactory/TcclEnabledTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java?rev=406303r1=406302r2=406303view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java Sun May 14 03:02:26 2006 @@ -158,6 +158,7 @@ try { Class noSuchClass = contextLoader.loadClass(no.such.class); fail(Class no.such.class is unexpectedly available); +assertNotNull(noSuchClass); // silence warning about unused var } catch(ClassNotFoundException ex) { // ok } Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java?rev=406303r1=406302r2=406303view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java Sun May 14 03:02:26 2006 @@ -155,6 +155,7 @@ try { Class noSuchClass = contextLoader.loadClass(no.such.class); fail(Class no.such.class is unexpectedly available); +assertNotNull(noSuchClass); // silence warning about unused var } catch(ClassNotFoundException ex) { // ok } Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java?rev=406303r1=406302r2=406303view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java Sun May 14 03:02:26 2006 @@ -118,6 +118,7 @@ try { Class clazz = thisClassLoader.loadClass(MY_LOG_IMPL); fail(Unexpectedly able to load MyLog via test class classloader); +assertNotNull(clazz); // silence warnings about unused var } catch(ClassNotFoundException ex) { // ok, expected } @@ -125,6 +126,7 @@ // MyLog should be loadable via tccl loader try { Class clazz = tcclLoader.loadClass(MY_LOG_IMPL); +assertNotNull(clazz); } catch(ClassNotFoundException ex) { fail(Unexpectedly unable to load MyLog via tccl classloader); } @@ -144,9 +146,10 @@ instance.getClass().getName()); try { -Log log = instance.getLog(test); +Log log = instance.getInstance(test); fail(Unexpectedly succeeded in loading a custom Log class + that is only accessable via the tccl.); +assertNotNull(log); // silence compiler warning about unused var } catch(LogConfigurationException ex) { // ok, expected int index = ex.getMessage().indexOf(MY_LOG_IMPL); Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclEnabledTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/tccl/log/TcclEnabledTestCase.java?rev=406303r1=406302r2=406303view=diff
svn commit: r398293 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/substitution/VariableAttributes.java
Author: skitching Date: Sun Apr 30 00:24:27 2006 New Revision: 398293 URL: http://svn.apache.org/viewcvs?rev=398293view=rev Log: Trivial javadoc fix Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/substitution/VariableAttributes.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/substitution/VariableAttributes.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/substitution/VariableAttributes.java?rev=398293r1=398292r2=398293view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/substitution/VariableAttributes.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/substitution/VariableAttributes.java Sun Apr 30 00:24:27 2006 @@ -26,7 +26,7 @@ /** * pWrapper for an org.xml.sax.Attributes object which expands any * variables referenced in the attribute value via ${foo} or similar. - * This is only done something actually asks for the attribute value, + * This is only done when something actually asks for the attribute value, * thereby imposing no performance penalty if the attribute is not used./p * * @since 1.6 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r398305 - /jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt
Author: skitching Date: Sun Apr 30 03:17:16 2006 New Revision: 398305 URL: http://svn.apache.org/viewcvs?rev=398305view=rev Log: Note Digester works with recent Kaffe/GNU-classpath releases. Add note on (partially) resolved bug#37034 Modified: jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt Modified: jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt?rev=398305r1=398304r2=398305view=diff == --- jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/digester/trunk/RELEASE-NOTES.txt Sun Apr 30 03:17:16 2006 @@ -34,6 +34,12 @@ NEW FEATURES = +Kaffe/GNU-Classpath compatibility +--- +All Digester unit tests now pass with the Kaffe 1.1.6 JVM. It is expected +that Digester works with other free Java implementations that also use the +GNU Classpath libraries. + Xmlrules Enhancements -- The xmlrules module has had the following updates to provide access @@ -47,6 +53,11 @@ Reports Addressed -- +* Bugzilla #37034 raises issue with jarfiles being locked on Windows machines. + A bug in Sun's java libraries can cause a jarfile to become locked + when a jarfile is the source of an xml or dtd file used by Digester. + In particular, this can cause problems when redeploying a J2EE webapp. + A workaround for the Sun bug has been added to Digester to resolve this. Fixes without Bugzilla entries -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r398306 - in /jakarta/commons/proper/digester/trunk/src: java/org/apache/commons/digester/ test/org/apache/commons/digester/
Author: skitching Date: Sun Apr 30 03:19:12 2006 New Revision: 398306 URL: http://svn.apache.org/viewcvs?rev=398306view=rev Log: Add new Digester.setStackAction feature; this allows user code to monitor the digester stacks. In particular it helps with tracking info on xml file source for created objects. Added: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java (with props) jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java (with props) Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java jakarta/commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java?rev=398306r1=398305r2=398306view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Sun Apr 30 03:19:12 2006 @@ -340,6 +340,12 @@ */ private ContentHandler customContentHandler = null; +/** + * Object which will receive callbacks for every pop/push action + * on the default stack or named stacks. + */ +private StackAction stackAction = null; + // - Properties /** @@ -1013,6 +1019,14 @@ customContentHandler = handler; } +public void setStackAction(StackAction stackAction) { + this.stackAction = stackAction; +} + +public StackAction getStackAction() { + return stackAction; +} + // - ContentHandler Methods @@ -2622,7 +2636,11 @@ public Object pop() { try { -return (stack.pop()); + Object popped = stack.pop(); + if (stackAction != null) { + popped = stackAction.onPop(this, null, popped); + } +return popped; } catch (EmptyStackException e) { log.warn(Empty stack (returning null)); return (null); @@ -2638,11 +2656,14 @@ */ public void push(Object object) { +if (stackAction != null) { + object = stackAction.onPush(this, null, object); +} + if (stack.size() == 0) { root = object; } stack.push(object); - } /** @@ -2655,6 +2676,10 @@ * @since 1.6 */ public void push(String stackName, Object value) { +if (stackAction != null) { + value = stackAction.onPush(this, stackName, value); +} + ArrayStack namedStack = (ArrayStack) stacksByName.get(stackName); if (namedStack == null) { namedStack = new ArrayStack(); @@ -2669,7 +2694,7 @@ * pstrongNote:/strong a stack is considered empty * if no objects have been pushed onto it yet./p * - * @param stackName the name of the stack from which the top value is to be popped + * @param stackName the name of the stack from which the top value is to be popped. * @return the top codeObject/code on the stack or or null if the stack is either * empty or has not been created yet * @throws EmptyStackException if the named stack is empty @@ -2684,11 +2709,14 @@ log.debug(Stack ' + stackName + ' is empty); } throw new EmptyStackException(); - -} else { +} -result = namedStack.pop(); +result = namedStack.pop(); + +if (stackAction != null) { + result = stackAction.onPop(this, stackName, result); } + return result; } Added: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java?rev=398306view=auto == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java (added) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/StackAction.java Sun Apr 30 03:19:12 2006 @@ -0,0 +1,75 @@ +/* $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0
svn commit: r398309 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
Author: skitching Date: Sun Apr 30 03:28:11 2006 New Revision: 398309 URL: http://svn.apache.org/viewcvs?rev=398309view=rev Log: Add javadoc for new methods. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java?rev=398309r1=398308r2=398309view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Sun Apr 30 03:28:11 2006 @@ -1019,10 +1019,21 @@ customContentHandler = handler; } +/** + * Define a callback object which is invoked whever an object is pushed onto + * a digester object stack, or popped off one. + * + * @since 1.7.1 + */ public void setStackAction(StackAction stackAction) { this.stackAction = stackAction; } +/** + * See setStackAction. + * + * @since 1.7.1 + */ public StackAction getStackAction() { return stackAction; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r397513 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Rule.java
Author: skitching Date: Thu Apr 27 03:21:57 2006 New Revision: 397513 URL: http://svn.apache.org/viewcvs?rev=397513view=rev Log: Add javadoc to encourage writing of custom Rule classes, and giving basic guidance. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Rule.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Rule.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Rule.java?rev=397513r1=397512r2=397513view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Rule.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Rule.java Thu Apr 27 03:21:57 2006 @@ -25,6 +25,28 @@ /** * Concrete implementations of this class implement actions to be taken when * a corresponding nested pattern of XML elements has been matched. + * p + * Writing a custom Rule is considered perfectly normal when using Digester, + * and is encouraged whenever the default set of Rule classes don't meet your + * requirements; the digester framework can help process xml even when the + * built-in rules aren't quite what is needed. Creating a custom Rule is + * just as easy as subclassing javax.servlet.http.HttpServlet for webapps, + * or javax.swing.Action for GUI applications. + * p + * If a rule wishes to manipulate a digester stack (the default object stack, + * a named stack, or the parameter stack) then it should only ever push + * objects in the rule's begin method and always pop exactly the same + * number of objects off the stack during the rule's end method. Of course + * peeking at the objects on the stacks can be done from anywhere. + * p + * Rule objects should be stateless, ie they should not update any instance + * member during the parsing process. A rule instance that changes state + * will encounter problems if invoked in a nested manner; this can happen + * if the same instance is added to digester multiple times or if a + * wildcard pattern is used which can match both an element and a child of the + * same element. The digester object stack and named stacks should be used to + * store any state that a rule requires, making the rule class safe under all + * possible uses. */ public abstract class Rule { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r397514 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
Author: skitching Date: Thu Apr 27 03:30:09 2006 New Revision: 397514 URL: http://svn.apache.org/viewcvs?rev=397514view=rev Log: Remove mention of a specific contributor from javadoc. No offence is intended to James House; however this info clutters the method description and no other user or contributor is explicitly listed like this. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java?rev=397514r1=397513r2=397514view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Thu Apr 27 03:30:09 2006 @@ -97,8 +97,7 @@ /** * Construct a new Digester, allowing a SAXParser to be passed in. This * allows Digester to be used in environments which are unfriendly to - * JAXP1.1 (such as WebLogic 6.0). Thanks for the request to change go to - * James House ([EMAIL PROTECTED]). This may help in places where + * JAXP1.1 (such as WebLogic 6.0). This may help in places where * you are able to load JAXP 1.1 classes yourself. */ public Digester(SAXParser parser) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r397515 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
Author: skitching Date: Thu Apr 27 03:33:04 2006 New Revision: 397515 URL: http://svn.apache.org/viewcvs?rev=397515view=rev Log: Minor javadoc update on clear method. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java?rev=397515r1=397514r2=397515view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Thu Apr 27 03:33:04 2006 @@ -2559,7 +2559,8 @@ /** - * Clear the current contents of the object stack. + * Clear the current contents of the default object stack, the param stack, + * all named stacks, and other internal variables. * p * Calling this method imight/i allow another document of the same type * to be correctly parsed. However this method was not intended for this - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r395181 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Author: skitching Date: Wed Apr 19 01:57:54 2006 New Revision: 395181 URL: http://svn.apache.org/viewcvs?rev=395181view=rev Log: Fix problem with suggested alternative for invalid log adapter class. Always trim whitespace from user-specified log adapter class name. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java?rev=395181r1=395180r2=395181view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Wed Apr 19 01:57:54 2006 @@ -77,6 +77,8 @@ /** SimpleLog class name */ private static final String LOGGING_IMPL_SIMPLE_LOGGER = org.apache.commons.logging.impl.SimpleLog; +private static final String PKG_IMPL=org.apache.commons.logging.impl.; +private static final int PKG_LEN = PKG_IMPL.length(); // --- Constructors @@ -783,15 +785,13 @@ messageBuffer.append(specifiedLogClassName); messageBuffer.append(' cannot be found or is not useable.); -// // Mistyping or misspelling names is a common fault. // Construct a good error message, if we can if (specifiedLogClassName != null) { -final String trimmedName = specifiedLogClassName.trim(); -informUponSimilarName(messageBuffer, trimmedName, LOGGING_IMPL_LOG4J_LOGGER); -informUponSimilarName(messageBuffer, trimmedName, LOGGING_IMPL_JDK14_LOGGER); -informUponSimilarName(messageBuffer, trimmedName, LOGGING_IMPL_LUMBERJACK_LOGGER); -informUponSimilarName(messageBuffer, trimmedName, LOGGING_IMPL_SIMPLE_LOGGER); +informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_LOG4J_LOGGER); +informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_JDK14_LOGGER); +informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_LUMBERJACK_LOGGER); +informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_SIMPLE_LOGGER); } throw new LogConfigurationException(messageBuffer.toString()); } @@ -845,19 +845,25 @@ } - /** * Appends message if the given name is similar to the candidate. * @param messageBuffer codeStringBuffer/code the message should be appended to, * not null * @param name the (trimmed) name to be test against the candidate, not null - * @param candidate the candidate name + * @param candidate the candidate name (not null) */ private void informUponSimilarName(final StringBuffer messageBuffer, final String name, final String candidate) { -// this formular (first four letters of the name excluding package) -// gives a reason guess -if (candidate.regionMatches(true, 0, name, 0, 38)) { +if (name.equals(candidate)) { +// Don't suggest a name that is exactly the same as the one the +// user tried... +return; +} + +// If the user provides a name that is in the right package, and gets +// the first 4 characters of the adapter class right (ignoring case), +// then suggest the candidate adapter class name. +if (name.regionMatches(true, 0, candidate, 0, PKG_LEN + 4)) { messageBuffer.append( Did you mean '); messageBuffer.append(candidate); messageBuffer.append('?); @@ -917,8 +923,14 @@ } } +// Remove any whitespace; it's never valid in a classname so its +// presence just means a user mistake. As we know what they meant, +// we may as well strip the spaces. +if (specifiedClass != null) { +specifiedClass = specifiedClass.trim(); +} + return specifiedClass; - } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r395185 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/package.html
Author: skitching Date: Wed Apr 19 02:33:50 2006 New Revision: 395185 URL: http://svn.apache.org/viewcvs?rev=395185view=rev Log: The use of static Log objects may or may not be safe depending on how that code is intended to be deployed. It's therefore better for the examples to show the safest approach (without static fields). Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/package.html Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/package.html URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/package.html?rev=395185r1=395184r2=395185view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/package.html (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/package.html Wed Apr 19 02:33:50 2006 @@ -56,7 +56,7 @@ public class Foo { -static Log log = LogFactory.getLog(Foo.class); +private Log log = LogFactory.getLog(Foo.class); public void foo() { ... @@ -221,7 +221,7 @@ public class MyComponent { - protected static Log log = + protected Log log = LogFactory.getLog(MyComponent.class); // Called once at startup time - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r395196 - /jakarta/commons/proper/logging/trunk/xdocs/building.xml
Author: skitching Date: Wed Apr 19 03:14:01 2006 New Revision: 395196 URL: http://svn.apache.org/viewcvs?rev=395196view=rev Log: Note that building requires maven 1.x Modified: jakarta/commons/proper/logging/trunk/xdocs/building.xml Modified: jakarta/commons/proper/logging/trunk/xdocs/building.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/xdocs/building.xml?rev=395196r1=395195r2=395196view=diff == --- jakarta/commons/proper/logging/trunk/xdocs/building.xml (original) +++ jakarta/commons/proper/logging/trunk/xdocs/building.xml Wed Apr 19 03:14:01 2006 @@ -24,7 +24,7 @@ section name=Overview p Commons Logging uses a href=http://ant.apache.org;Ant/a as a build system - and a href=http://maven.apache.org;Maven/a for documentation only. + and a href=http://maven.apache.org;Maven 1.x/a for documentation only. /p /section !-- == -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r395202 - in /jakarta/commons/proper/logging/trunk: RELEASE-NOTES.txt xdocs/guide.xml xdocs/troubleshooting.xml
Author: skitching Date: Wed Apr 19 03:39:49 2006 New Revision: 395202 URL: http://svn.apache.org/viewcvs?rev=395202view=rev Log: Add information about some containers effectively forcing parentFirst=true for JCL classes. Modified: jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt jakarta/commons/proper/logging/trunk/xdocs/guide.xml jakarta/commons/proper/logging/trunk/xdocs/troubleshooting.xml Modified: jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt?rev=395202r1=395201r2=395202view=diff == --- jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/logging/trunk/RELEASE-NOTES.txt Wed Apr 19 03:39:49 2006 @@ -51,6 +51,12 @@ Jakarta Commons Logging wiki site: http://wiki.apache.org/jakarta-commons/Logging +Note that some containers (some versions of Apache Tomcat and JBoss in +particular) prevent webapps, ejbs, etc from overriding the commons-logging +implementation provided by the container. This means that bundling this +updated implementation with a deployed application may not have any effect. +See the commons-logging site and/or the wiki for more information. + == New Features == * Jar files now have release-numbers embedded in the names, for easier management. Modified: jakarta/commons/proper/logging/trunk/xdocs/guide.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/xdocs/guide.xml?rev=395202r1=395201r2=395202view=diff == --- jakarta/commons/proper/logging/trunk/xdocs/guide.xml (original) +++ jakarta/commons/proper/logging/trunk/xdocs/guide.xml Wed Apr 19 03:39:49 2006 @@ -113,7 +113,9 @@ In most cases, including the (full) codecommons-logging.jar/code in the classpath should result in JCL configuring itself in a reasonable manner. There's a good chance that it'll guess your preferred logging system and you won't -need to do any configuration at all! +need to do any configuration at all! Note, however, that providing a simple +commons-logging.properties file which specifies the concrete logging library to be +used is recommended, as it saves any possible confusion. /p subsection name='Configuration' p Modified: jakarta/commons/proper/logging/trunk/xdocs/troubleshooting.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/xdocs/troubleshooting.xml?rev=395202r1=395201r2=395202view=diff == --- jakarta/commons/proper/logging/trunk/xdocs/troubleshooting.xml (original) +++ jakarta/commons/proper/logging/trunk/xdocs/troubleshooting.xml Wed Apr 19 03:39:49 2006 @@ -328,5 +328,73 @@ /subsection /subsection /section + section name='Containers With Custom ClassLoading Behaviour for Logging' + p + Because commons-logging is such a fundamental library, some containers modify the way + in which classloading behaves for commons-logging classes. + /p + subsection name=Apache Tomcat + p + At the current date, Tomcat 5.5.16 is the current release. All releases from version + 4.1.x through 5.5.16 have a startup process that places jarfile + ${tomcat.home}/bin/commons-logging-api.jar in the system classpath and then + prevents any webapp from overriding the classes in that jarfile. Effectively, all + webapps behave as if parent-first classloading were enabled for those classes. + /p + p + This has some benefits; in particular it means that there are no problems in + these Tomcat versions with having multiple copies of the commons-logging Log + interface in the classpath (which avoids the Log does not implement Log + problem described elsewhere). + /p + p + However it also means that no webapp can override the core commons-logging + classes by including an updated commons-logging jarfile in WEB-INF/lib; any + class already loaded via the container takes priority. In particular, as + Tomcat bundles logging 1.0.4 only, the new diagnostics and memory-leak-prevention + features of the 1.1 release will not be available unless the container's + library version is updated. + /p + p + Because the commons-logging-api.jar in the container does not contain any + log-library-adapter classes, updated behaviour for these iwill/i be + seen when logging 1.1 is bundled in WEB-INF/lib. In particular, the + support for log4j's TRACE level will take effect without having to update + the container. + /p + p + If you do wish to update Tomcat's version of commons-logging, then you + imust/i use the commons-logging-1.1-api jar only, not the full jar. + Classes in the webapp cannot override classes loaded from the system + classpath set up during Tomcat's startup process, and logging adapters + can only see
svn commit: r394649 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Author: skitching Date: Mon Apr 17 02:16:28 2006 New Revision: 394649 URL: http://svn.apache.org/viewcvs?rev=394649view=rev Log: * Log the classloader that really loaded the adapter class, rather than the one we called loadClass on. * Remove some debug code accidentally committed recently. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java?rev=394649r1=394648r2=394649view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Mon Apr 17 02:16:28 2006 @@ -967,7 +967,10 @@ + objectId(currentCL)); try { if (isDiagnosticsEnabled()) { -// show exactly where we are loading this class from. +// Show the location of the first occurrence of the .class file +// in the classpath. This is the location that ClassLoader.loadClass +// will load the class from -- unless the classloader is doing +// something weird. URL url; String resourceName = logAdapterClassName.replace('.', '/') + .class; if (currentCL != null) { @@ -982,18 +985,6 @@ logDiagnostic(Class ' + logAdapterClassName + ' was found at ' + url + '); } } - -// hack -{ -String l4jCategory = org.apache.log4j.Category; -String l4jResource = l4jCategory.replace('.', '/') + .class; -URL l4jUrl = currentCL.getResource(l4jResource); -if (l4jUrl == null) { -logDiagnostic(log4j not found: + l4jResource); -} else { -logDiagnostic(log4j found: + l4jUrl); -} -} Class c = null; try { @@ -1030,6 +1021,7 @@ break; } } + constructor = c.getConstructor(logConstructorSignature); Object o = constructor.newInstance(params); @@ -1042,7 +1034,6 @@ logAdapter = (Log) o; break; } - // Oops, we have a potential problem here. An adapter class // has been found and its underlying lib is present too, but @@ -1127,7 +1118,7 @@ logDiagnostic( Log adapter ' + logAdapterClassName -+ ' from classloader + objectId(currentCL) ++ ' from classloader + objectId(logAdapterClass.getClassLoader()) + has been selected for use.); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r394457 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java
Author: skitching Date: Sun Apr 16 04:27:11 2006 New Revision: 394457 URL: http://svn.apache.org/viewcvs?rev=394457view=rev Log: Fix error where getResources() would return parent items first, even when parentFirst attribute was set to false. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java?rev=394457r1=394456r2=394457view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Sun Apr 16 04:27:11 2006 @@ -21,8 +21,9 @@ import java.io.InputStream; import java.net.URL; import java.net.URLClassLoader; - -// TODO: use HashTable instead of HashMap for java1.1 support +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -232,6 +233,25 @@ return local; } return super.getResource(name); +} +} + +/** + * Same as parent class method except that when parentFirst is false + * any resources in the local classpath are returned before resources + * in the parent. + */ +public Enumeration getResources(String name) throws IOException { +if (parentFirst) { +return super.getResources(name); +} else { +Enumeration localUrls = super.findResources(name); +Enumeration parentUrls = getParent().getResources(name); + +ArrayList localItems = Collections.list(localUrls); +ArrayList parentItems = Collections.list(parentUrls); +localItems.addAll(parentItems); +return Collections.enumeration(localItems); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r394459 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java
Author: skitching Date: Sun Apr 16 04:34:33 2006 New Revision: 394459 URL: http://svn.apache.org/viewcvs?rev=394459view=rev Log: Update javadoc only Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java?rev=394459r1=394458r2=394459view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java Sun Apr 16 04:34:33 2006 @@ -30,6 +30,15 @@ /** * Tests that verify that the process of configuring logging on startup * works correctly by selecting the file with the highest priority. + * p + * This test sets up a classpath where: + * ul + * li first file (in parent loader) has priority=10 (parentFirst=true) + * li second file found has no priority set + * li third file found has priority=20 + * li fourth file found also has priority=20 + * /ul + * The result should be that the third file is used. */ public class PriorityConfigTestCase extends TestCase { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r394460 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java
Author: skitching Date: Sun Apr 16 04:35:22 2006 New Revision: 394460 URL: http://svn.apache.org/viewcvs?rev=394460view=rev Log: Add unit test to verify that priority of first-found config file is respected Added: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java (with props) Added: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java?rev=394460view=auto == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java (added) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java Sun Apr 16 04:35:22 2006 @@ -0,0 +1,119 @@ +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.logging.config; + + +import java.net.URL; + +import junit.framework.Test; +import junit.framework.TestCase; + +import org.apache.commons.logging.LogFactory; +import org.apache.commons.logging.PathableClassLoader; +import org.apache.commons.logging.PathableTestSuite; + + +/** + * Tests that verify that the process of configuring logging on startup + * works correctly by selecting the file with the highest priority. + * p + * This test sets up a classpath where: + * ul + * li first file found has priority=20 + * li second file (in parent path) has priority=10 (parentFirst=false) + * /ul + * The result should be that the first file is used. + */ + +public class FirstPriorityConfigTestCase extends TestCase { + +// --- JUnit Infrastructure Methods + + +/** + * Return the tests included in this test suite. + */ +public static Test suite() throws Exception { +Class thisClass = PriorityConfigTestCase.class; + +// Determine the URL to this .class file, so that we can then +// append the priority dirs to it. For tidiness, load this +// class through a dummy loader though this is not absolutely +// necessary... +PathableClassLoader dummy = new PathableClassLoader(null); +dummy.useSystemLoader(junit.); +dummy.addLogicalLib(testclasses); +dummy.addLogicalLib(commons-logging); + +String thisClassPath = thisClass.getName().replace('.', '/') + .class; +URL baseUrl = dummy.findResource(thisClassPath); + +// Now set up the desired classloader hierarchy. We'll put a config +// file of priority=10 in the container path, and ones of both +// no priority and priority=20 in the webapp path. +// +// A second properties file with priority=20 is also added, +// so we can check that the first one in the classpath is +// used. +PathableClassLoader containerLoader = new PathableClassLoader(null); +containerLoader.useSystemLoader(junit.); +containerLoader.addLogicalLib(commons-logging); + +URL pri10URL = new URL(baseUrl, priority10/); +containerLoader.addURL(pri10URL); + +PathableClassLoader webappLoader = new PathableClassLoader(containerLoader); +webappLoader.setParentFirst(false); +webappLoader.addLogicalLib(testclasses); + +URL pri20URL = new URL(baseUrl, priority20/); +webappLoader.addURL(pri20URL); + +// load the test class via webapp loader, and use the webapp loader +// as the tccl loader too. +Class testClass = webappLoader.loadClass(thisClass.getName()); +return new PathableTestSuite(testClass, webappLoader); +} + +/** + * Set up instance variables required by this test case. + */ +public void setUp() throws Exception { +LogFactory.releaseAll(); +} + +/** + * Tear down instance variables required by this test case. + */ +public void tearDown() { +LogFactory.releaseAll(); +} + +// --- Test Methods + +/** + * Verify that the config file being used is the one containing + * the desired configId value
svn commit: r394461 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java
Author: skitching Date: Sun Apr 16 04:36:37 2006 New Revision: 394461 URL: http://svn.apache.org/viewcvs?rev=394461view=rev Log: Fix bug where priority of first commons-logging.properties file found was ignored. Also improve diagnostics output. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java?rev=394461r1=394460r2=394461view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Sun Apr 16 04:36:37 2006 @@ -1387,16 +1387,39 @@ if (newProps != null) { if (props == null) { props = newProps; +String priorityStr = props.getProperty(PRIORITY_KEY); +priority = 0.0; +if (priorityStr != null) { +priority = Double.parseDouble(priorityStr); +} + +if (isDiagnosticsEnabled()) { +logDiagnostic( +[LOOKUP] First properties file found at ' + url + '); +} } else { String newPriorityStr = newProps.getProperty(PRIORITY_KEY); +double newPriority = 0.0; if (newPriorityStr != null) { -double newPriority = Double.valueOf(newPriorityStr).doubleValue(); -if (newPriority priority) { -props = newProps; -priority = newPriority; +newPriority = Double.parseDouble(newPriorityStr); +} + +if (newPriority priority) { +props = newProps; +priority = newPriority; + +if (isDiagnosticsEnabled()) { +logDiagnostic( +[LOOKUP] New properties file found at ' + url + ' ++ has higher priority than earlier file.); } +} else { +logDiagnostic( +[LOOKUP] New properties file found at ' + url + ' ++ has less priority than earlier file -- ignoring.); } } + } } } catch (SecurityException e) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r394462 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java
Author: skitching Date: Sun Apr 16 04:43:29 2006 New Revision: 394462 URL: http://svn.apache.org/viewcvs?rev=394462view=rev Log: Improve diagnostics Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java?rev=394462r1=394461r2=394462view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Sun Apr 16 04:43:29 2006 @@ -1373,6 +1373,7 @@ Properties props = null; double priority = 0.0; +URL propsUrl = null; try { Enumeration urls = getResources(classLoader, fileName); @@ -1386,6 +1387,7 @@ Properties newProps = getProperties(url); if (newProps != null) { if (props == null) { +propsUrl = url; props = newProps; String priorityStr = props.getProperty(PRIORITY_KEY); priority = 0.0; @@ -1395,7 +1397,8 @@ if (isDiagnosticsEnabled()) { logDiagnostic( -[LOOKUP] First properties file found at ' + url + '); +[LOOKUP] Properties file found at ' + url + ' ++ with priority + priority); } } else { String newPriorityStr = newProps.getProperty(PRIORITY_KEY); @@ -1405,18 +1408,27 @@ } if (newPriority priority) { +if (isDiagnosticsEnabled()) { +if (isDiagnosticsEnabled()) { +logDiagnostic( +[LOOKUP] Properties file at ' + url + ' ++ with priority + newPriority ++ overrides file at ' + propsUrl + ' ++ with priority + priority); +} +} + +propsUrl = url; props = newProps; priority = newPriority; - +} else { if (isDiagnosticsEnabled()) { logDiagnostic( -[LOOKUP] New properties file found at ' + url + ' -+ has higher priority than earlier file.); +[LOOKUP] Properties file at ' + url + ' ++ with priority + newPriority ++ does not override file at ' + propsUrl + ' ++ with priority + priority); } -} else { -logDiagnostic( -[LOOKUP] New properties file found at ' + url + ' -+ has less priority than earlier file -- ignoring.); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r394463 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java
Author: skitching Date: Sun Apr 16 05:01:57 2006 New Revision: 394463 URL: http://svn.apache.org/viewcvs?rev=394463view=rev Log: Handle case of null parent classloader Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java?rev=394463r1=394462r2=394463view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Sun Apr 16 05:01:57 2006 @@ -246,7 +246,22 @@ return super.getResources(name); } else { Enumeration localUrls = super.findResources(name); -Enumeration parentUrls = getParent().getResources(name); + +ClassLoader parent = getParent(); +if (parent == null) { +// Alas, there is no method to get matching resources +// from a null (BOOT) parent classloader. Calling +// ClassLoader.getSystemClassLoader isn't right. Maybe +// calling Class.class.getResources(name) would do? +// +// However for the purposes of unit tests, we can +// simply assume that no relevant resources are +// loadable from the parent; unit tests will never be +// putting any of their resources in a boot classloader +// path! +return localUrls; +} +Enumeration parentUrls = parent.getResources(name); ArrayList localItems = Collections.list(localUrls); ArrayList parentItems = Collections.list(parentUrls); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r394466 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java
Author: skitching Date: Sun Apr 16 05:11:05 2006 New Revision: 394466 URL: http://svn.apache.org/viewcvs?rev=394466view=rev Log: Improve diagnostic output Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java?rev=394466r1=394465r2=394466view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Sun Apr 16 05:11:05 2006 @@ -455,6 +455,12 @@ } factory = newFactory(factoryClass, baseClassLoader, contextClassLoader); +} else { +if (isDiagnosticsEnabled()) { +logDiagnostic( +[LOOKUP] No system property [ + FACTORY_PROPERTY ++ ] defined.); +} } } catch (SecurityException e) { if (isDiagnosticsEnabled()) { @@ -522,6 +528,13 @@ } factory = newFactory(factoryClassName, baseClassLoader, contextClassLoader ); } +} else { +// is == null +if (isDiagnosticsEnabled()) { +logDiagnostic( +[LOOKUP] No resource file with name ' + SERVICE_ID ++ ' found.); +} } } catch( Exception ex ) { // note: if the specified LogFactory class wasn't compatible with LogFactory @@ -539,32 +552,37 @@ } -// Third try a properties file. -// If the properties file exists, it'll be read and the properties -// used. IMHO ( costin ) System property and JDK1.3 jar service -// should be enough for detecting the class name. The properties -// should be used to set the attributes ( which may be specific to -// the webapp, even if a default logger is set at JVM level by a -// system property ) +// Third try looking into the properties file read earlier (if found) if (factory == null) { -if (isDiagnosticsEnabled()) { -logDiagnostic( -[LOOKUP] Looking for a properties file of name ' + FACTORY_PROPERTIES -+ ' to define the LogFactory subclass to use...); -} if (props != null) { if (isDiagnosticsEnabled()) { logDiagnostic( -[LOOKUP] Properties file found. Looking for property ' +[LOOKUP] Looking in properties file for entry with key ' + FACTORY_PROPERTY + ' to define the LogFactory subclass to use...); } String factoryClass = props.getProperty(FACTORY_PROPERTY); if (factoryClass != null) { +if (isDiagnosticsEnabled()) { +logDiagnostic( +[LOOKUP] Properties file specifies LogFactory subclass ' ++ factoryClass + '); +} factory = newFactory(factoryClass, baseClassLoader, contextClassLoader); // what about handling an exception from newFactory?? +} else { +if (isDiagnosticsEnabled()) { +logDiagnostic( +[LOOKUP] Properties file has no entry specifying LogFactory subclass.); +} +} +} else { +if (isDiagnosticsEnabled()) { +logDiagnostic( +[LOOKUP] No properties file available to determine ++ LogFactory subclass from..); } } } @@ -1436,9 +1454,22 @@ } } catch (SecurityException e) { if (isDiagnosticsEnabled()) { -logDiagnostic(SecurityException thrown); +logDiagnostic(SecurityException thrown while trying to find/read config files.); +} +} + +if (isDiagnosticsEnabled()) { +if (props == null) { +logDiagnostic( +[LOOKUP] No properties file of name ' + FACTORY_PROPERTIES ++ ' found.); +} else { +logDiagnostic( +[LOOKUP] Properties file of name ' + FACTORY_PROPERTIES
svn commit: r394467 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Author: skitching Date: Sun Apr 16 05:15:30 2006 New Revision: 394467 URL: http://svn.apache.org/viewcvs?rev=394467view=rev Log: Improve diagnostics Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java?rev=394467r1=394466r2=394467view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java Sun Apr 16 05:15:30 2006 @@ -20,6 +20,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.net.URL; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; @@ -682,32 +683,41 @@ if (isDiagnosticsEnabled()) { logDiagnostic([ENV] Trying to get configuration for item + property); } -if (isDiagnosticsEnabled()) { -logDiagnostic([ENV] Looking for attribute + property); -} + Object valueObj = getAttribute(property); if (valueObj != null) { if (isDiagnosticsEnabled()) { -logDiagnostic([ENV] Found value [ + valueObj + ] for + property); +logDiagnostic([ENV] Found LogFactory attribute [ + valueObj + ] for + property); } return valueObj.toString(); } if (isDiagnosticsEnabled()) { -logDiagnostic([ENV] Looking for system property + property); +logDiagnostic([ENV] No LogFactory attribute found for + property); } + try { String value = System.getProperty(property); +if (value != null) { +if (isDiagnosticsEnabled()) { +logDiagnostic([ENV] Found system property [ + value + ] for + property); +} +return value; +} + if (isDiagnosticsEnabled()) { -logDiagnostic([ENV] Found value [ + value + ] for + property); +logDiagnostic([ENV] No system property found for property + property); } -return value; } catch (SecurityException e) { if (isDiagnosticsEnabled()) { -logDiagnostic([ENV] Security prevented reading system property.); +logDiagnostic([ENV] Security prevented reading system property + property); } } - + +if (isDiagnosticsEnabled()) { +logDiagnostic([ENV] No configuration defined for item + property); +} + return null; } @@ -749,7 +759,7 @@ throws LogConfigurationException { if (isDiagnosticsEnabled()) { -logDiagnostic(Attempting to discover a Log implementation...); +logDiagnostic(Discovering a Log implementation...); } initConfiguration(); @@ -760,6 +770,11 @@ String specifiedLogClassName = findUserSpecifiedLogClassName(); if (specifiedLogClassName != null) { +if (isDiagnosticsEnabled()) { +logDiagnostic(Attempting to load user-specified log class ' + +specifiedLogClassName + '...); +} + result = createLogFromClass(specifiedLogClassName, logCategory, true); @@ -812,6 +827,11 @@ // service file in META-INF to force use of that logging lib anyway, // rather than relying on discovery. +if (isDiagnosticsEnabled()) { +logDiagnostic( +No user-specified Log implementation; performing discovery + +using the standard supported logging implementations...); +} for(int i=0; (iclassesToDiscover.length) (result == null); ++i) { result = createLogFromClass(classesToDiscover[i], logCategory, true); } @@ -946,6 +966,35 @@ + ' from classloader + objectId(currentCL)); try { +if (isDiagnosticsEnabled()) { +// show exactly where we are loading this class from. +URL url; +String resourceName = logAdapterClassName.replace('.', '/') + .class; +if (currentCL != null) { +url = currentCL.getResource(resourceName ); +} else { +url = ClassLoader.getSystemResource(resourceName
svn commit: r394560 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java
Author: skitching Date: Sun Apr 16 14:20:21 2006 New Revision: 394560 URL: http://svn.apache.org/viewcvs?rev=394560view=rev Log: Fix dumb double-test. Thanks to Dennis Lundberg for pointing this out. Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java?rev=394560r1=394559r2=394560view=diff == --- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java (original) +++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Sun Apr 16 14:20:21 2006 @@ -1427,13 +1427,11 @@ if (newPriority priority) { if (isDiagnosticsEnabled()) { -if (isDiagnosticsEnabled()) { -logDiagnostic( -[LOOKUP] Properties file at ' + url + ' -+ with priority + newPriority -+ overrides file at ' + propsUrl + ' -+ with priority + priority); -} +logDiagnostic( +[LOOKUP] Properties file at ' + url + ' ++ with priority + newPriority ++ overrides file at ' + propsUrl + ' ++ with priority + priority); } propsUrl = url; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r394563 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java
Author: skitching Date: Sun Apr 16 14:30:19 2006 New Revision: 394563 URL: http://svn.apache.org/viewcvs?rev=394563view=rev Log: Remove recently-added implementation of getResources. As javadoc already stated, this can't be implemented because in java 1.4 getResources is final :-(. Unit tests that care about getResources() order will just have to use parentFirst=true. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java?rev=394563r1=394562r2=394563view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/PathableClassLoader.java Sun Apr 16 14:30:19 2006 @@ -98,6 +98,10 @@ * child-first lookup instead, to allow the components to override libs * which are visible in shared classloaders provided by the container. * p + * Note that the method getResources always behaves as if parentFirst=true, + * because of limitations in java 1.4; see the javadoc for method + * getResourcesInOrder for details. + * p * This value defaults to true. */ public void setParentFirst(boolean state) { @@ -237,11 +241,14 @@ } /** - * Same as parent class method except that when parentFirst is false - * any resources in the local classpath are returned before resources - * in the parent. + * Emulate a proper implementation of getResources which respects the + * setting for parentFirst. + * p + * Note that it's not possible to override the inherited getResources, as + * it's declared final in java1.4 (thought that's been removed for 1.5). + * The inherited implementation always behaves as if parentFirst=true. */ -public Enumeration getResources(String name) throws IOException { +public Enumeration getResourcesInOrder(String name) throws IOException { if (parentFirst) { return super.getResources(name); } else { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r394564 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java
Author: skitching Date: Sun Apr 16 14:30:57 2006 New Revision: 394564 URL: http://svn.apache.org/viewcvs?rev=394564view=rev Log: Add comment about getResources not respecting parentFirst Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java?rev=394564r1=394563r2=394564view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/PriorityConfigTestCase.java Sun Apr 16 14:30:57 2006 @@ -39,6 +39,10 @@ * li fourth file found also has priority=20 * /ul * The result should be that the third file is used. + * p + * Note that parentFirst=true is used in this test because method + * codePathableClassLoader.getResources/code always behaves as if + * parentFirst=true; see the PathableClassLoader javadoc for details. */ public class PriorityConfigTestCase extends TestCase { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r394603 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java
Author: skitching Date: Sun Apr 16 20:30:38 2006 New Revision: 394603 URL: http://svn.apache.org/viewcvs?rev=394603view=rev Log: * Fix bug where unit tests weren't getting executed at all (wrong test class name) * Put both resources in child classloader rather than using parent, to avoid confusion with parentFirst not being supported by PathableClassLoader.getResources. Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java?rev=394603r1=394602r2=394603view=diff == --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java (original) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/config/FirstPriorityConfigTestCase.java Sun Apr 16 20:30:38 2006 @@ -34,11 +34,10 @@ * This test sets up a classpath where: * ul * li first file found has priority=20 - * li second file (in parent path) has priority=10 (parentFirst=false) + * li second file found has priority=10 * /ul * The result should be that the first file is used. */ - public class FirstPriorityConfigTestCase extends TestCase { // --- JUnit Infrastructure Methods @@ -48,7 +47,7 @@ * Return the tests included in this test suite. */ public static Test suite() throws Exception { -Class thisClass = PriorityConfigTestCase.class; +Class thisClass = FirstPriorityConfigTestCase.class; // Determine the URL to this .class file, so that we can then // append the priority dirs to it. For tidiness, load this @@ -73,15 +72,14 @@ containerLoader.useSystemLoader(junit.); containerLoader.addLogicalLib(commons-logging); -URL pri10URL = new URL(baseUrl, priority10/); -containerLoader.addURL(pri10URL); - PathableClassLoader webappLoader = new PathableClassLoader(containerLoader); -webappLoader.setParentFirst(false); webappLoader.addLogicalLib(testclasses); - + URL pri20URL = new URL(baseUrl, priority20/); webappLoader.addURL(pri20URL); + +URL pri10URL = new URL(baseUrl, priority10/); +webappLoader.addURL(pri10URL); // load the test class via webapp loader, and use the webapp loader // as the tccl loader too. @@ -113,7 +111,5 @@ LogFactory instance = LogFactory.getFactory(); String id = (String) instance.getAttribute(configId); assertEquals(Correct config file loaded, priority20, id ); - -fail(deliberate failure); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385890 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java
Author: skitching Date: Tue Mar 14 13:09:22 2006 New Revision: 385890 URL: http://svn.apache.org/viewcvs?rev=385890view=rev Log: Fix compile error (oops). Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java?rev=385890r1=385889r2=385890view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java Tue Mar 14 13:09:22 2006 @@ -22,6 +22,7 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; import org.apache.commons.digester.parser.GenericParser; import org.apache.commons.digester.parser.XercesParser; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385705 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
Author: skitching Date: Mon Mar 13 17:35:05 2006 New Revision: 385705 URL: http://svn.apache.org/viewcvs?rev=385705view=rev Log: Fix for problem where SAXNotRecognisedException was being thrown when validation is enabled (Digester.setValidating(true)) and Xerces is in the classpath BUT IS NOT the actual XML parser being used. See bugzilla#38894. This fix avoids using ParserFeatureSetterFactory just to enable validating; that can be done in a more portable way. There is still a bug in ParserFeatureSetterFactory to fix - the incorrect detection of the underlying parser. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java?rev=385705r1=385704r2=385705view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Mon Mar 13 17:35:05 2006 @@ -685,14 +685,25 @@ // Create a new parser try { -if (validating) { +if (validating (schemaLocation != null)) { +// There is no portable way to specify the location of +// an xml schema to be applied to the input document, so +// we have to use parser-specific code for this. That code +// is hidden behind the ParserFeatureSetterFactory class. + Properties properties = new Properties(); properties.put(SAXParserFactory, getFactory()); if (schemaLocation != null) { properties.put(schemaLocation, schemaLocation); properties.put(schemaLanguage, schemaLanguage); } -parser = ParserFeatureSetterFactory.newSAXParser(properties); } else { +parser = ParserFeatureSetterFactory.newSAXParser(properties); + } else { + // The user doesn't want to use any non-portable parsing features, + // so we can just use the portable API here. Note that method + // getFactory returns a factory already configured with the + // appropriate namespaceAware and validating properties. + parser = getFactory().newSAXParser(); } } catch (Exception e) { @@ -808,7 +819,24 @@ /** - * Set the XML Schema URI used for validating a XML Instance. + * Set the XML Schema URI used for validating the input XML. + * p + * It is often desirable to iforce/i the input document to be + * validated against a particular schema regardless of what type + * the input document declares itself to be. This method allows that + * to be done. + * p + * Note, however, that there is no standard API for enabling this + * feature on the underlying SAX parser; this method therefore only works + * for those parsers explicitly supported by Digester's + * ParserFeatureSetterFactory class. If the underlying parser does not + * support the feature, or is not one of the supported parsers, then + * an exception will be thrown when getParser is called (explicitly, + * or implicitly via the parse method). + * p + * See also method setSchemaLanguage which allows the type of the schema + * specified here to be defined. By default, the schema is expected to + * be a W3C xml schema definition. * * @param schemaLocation a URI to the schema. */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385707 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java
Author: skitching Date: Mon Mar 13 17:49:09 2006 New Revision: 385707 URL: http://svn.apache.org/viewcvs?rev=385707view=rev Log: Fix incorrect detection of Xerces library. Checking the classpath is not enough, as multiple XML parsers may be present. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java?rev=385707r1=385706r2=385707view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java Mon Mar 13 17:49:09 2006 @@ -37,7 +37,7 @@ * * @since 1.6 */ -public class ParserFeatureSetterFactory{ +public class ParserFeatureSetterFactory { /** * codetrue/code is Xerces is used. @@ -47,10 +47,14 @@ static { try{ // Use reflection to avoid a build dependency with Xerces. -Class versionClass = -Class.forName(org.apache.xerces.impl.Version); -isXercesUsed = true; -} catch (Exception ex){ + // + // Note that this does not detect Sun's repackaging of + // Xerces as com.sun.org.apache.xerces; perhaps it should? + SAXParserFactory factory = SAXParserFactory.newInstance(); + if (factory.getClass().getName().startsWith(org.apache.xerces)) { +isXercesUsed = true; + } +} catch (Exception ex) { isXercesUsed = false; } } @@ -74,4 +78,4 @@ } } -} \ No newline at end of file +} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385708 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
Author: skitching Date: Mon Mar 13 17:50:30 2006 New Revision: 385708 URL: http://svn.apache.org/viewcvs?rev=385708view=rev Log: Document fact that ParserFeatureSetterFactory is broken and is unlikely to be fixed. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java?rev=385708r1=385707r2=385708view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Mon Mar 13 17:50:30 2006 @@ -837,6 +837,13 @@ * See also method setSchemaLanguage which allows the type of the schema * specified here to be defined. By default, the schema is expected to * be a W3C xml schema definition. + * p + * IMPORTANT NOTE: This functionality was never very reliable, and has + * been horribly broken since the 1.6 release of Digester. There are + * currently no plans to fix it, so you are strongly recommended to + * avoid using this method. Instead, create an XMLParser instance + * yourself, configure validation appropriately, and pass it as a + * parameter to the Digester constructor. * * @param schemaLocation a URI to the schema. */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385710 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/parser/XercesParser.java
Author: skitching Date: Mon Mar 13 17:52:35 2006 New Revision: 385710 URL: http://svn.apache.org/viewcvs?rev=385710view=rev Log: Document fact that XercesParser is broken. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/parser/XercesParser.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/parser/XercesParser.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/parser/XercesParser.java?rev=385710r1=385709r2=385710view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/parser/XercesParser.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/parser/XercesParser.java Mon Mar 13 17:52:35 2006 @@ -175,6 +175,11 @@ /** * Configure schema validation as recommended by the Xerces spec. * Both DTD and Schema validation will be enabled simultaneously. + * p + * NOTE: This method is broken. It is supposed to set up validation + * against the schema specified in property schemaLocation, but + * it doesn't. + * * @param factory SAXParserFactory to be configured */ private static void configureXerces(SAXParserFactory factory) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385714 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
Author: skitching Date: Mon Mar 13 18:21:42 2006 New Revision: 385714 URL: http://svn.apache.org/viewcvs?rev=385714view=rev Log: Make createInputSourceFromURL public, so it can be called from other places in Digester (eg xmlrules module). Improve javadoc for the method. Minor varname changes. Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java?rev=385714r1=385713r2=385714view=diff == --- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java (original) +++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java Mon Mar 13 18:21:42 2006 @@ -1779,20 +1779,41 @@ * Given a URL, return an InputSource that reads from that URL. * p * Ideally this function would not be needed and code could just use - * codenew InputSource(entityURL)/code. - * Unforunately it appears that when the entityURL points to a file - * within a jar archive a caching mechanism inside the InputSource - * implementation causes a file-handle to the jar file to remain open. - * On Windows systems this then causes the jar archive file to be - * locked on disk (in use) which makes it impossible to delete the - * jar file - and that really stuffs up undeploy in webapps in - * particular. + * codenew InputSource(entityURL)/code. Unfortunately it appears + * that when the entityURL points to a file within a jar archive a + * caching mechanism inside the InputSource implementation causes a + * file-handle to the jar file to remain open. On Windows systems + * this then causes the jar archive file to be locked on disk + * (in use) which makes it impossible to delete the jar file - + * and that really stuffs up undeploy in webapps in particular. + * p + * In JDK1.4 and later, Apache XercesJ is used as the xml parser. + * The InputSource object provided is converted into an XMLInputSource, + * and eventually passed to an instance of XMLDocumentScannerImpl to + * specify the source data to be converted into tokens for the rest + * of the XMLReader code to handle. XMLDocumentScannerImpl calls + * fEntityManager.startDocumentEntity(source), where fEntityManager + * is declared in ancestor class XMLScanner to be an XMLEntityManager. In + * that class, if the input source stream is null, then: + * code + * URL location = new URL(expandedSystemId); + * URLConnection connect = location.openConnection(); + * if (connect instanceof HttpURLConnection) { + *setHttpProperties(connect,xmlInputSource); + * } + * stream = connect.getInputStream(); + * /code + * This method pretty much duplicates the standard behaviour, except + * that it calls URLConnection.setUseCaches(false) before opening + * the connection. */ -private InputSource createInputSourceFromURL(String url) +public static InputSource createInputSourceFromURL(String url) throws MalformedURLException, IOException { -URLConnection urlConnection = new URL(url).openConnection(); -urlConnection.setUseCaches(false); -InputSource source = new InputSource(urlConnection.getInputStream()); +URL location = new URL(url); +URLConnection connection = location.openConnection(); +connection.setUseCaches(false); + InputStream stream = connection.getInputStream(); +InputSource source = new InputSource(stream); source.setSystemId(url); return source; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r384387 - /jakarta/commons/proper/logging/contrib/simon/jcl2/pom.xml
Author: skitching Date: Wed Mar 8 16:29:48 2006 New Revision: 384387 URL: http://svn.apache.org/viewcvs?rev=384387view=rev Log: General tidyups. Add profile in attempt to allow building with alternate JDKs Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/pom.xml Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/pom.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/pom.xml?rev=384387r1=384386r2=384387view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/pom.xml (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/pom.xml Wed Mar 8 16:29:48 2006 @@ -1,10 +1,106 @@ project modelVersion4.0.0/modelVersion + groupIdorg.apache.commons.logging/groupId - version0.1-SNAPSHOT/version artifactIdcommons-logging/artifactId - nameCommons Logging/name packagingpom/packaging + nameCommons Logging/name + version0.1-SNAPSHOT/version + + description +A thin adapter allowing configurable bridging to other +well known logging systems. + /description + + urlhttp://jakarta.apache.org/commons/logging/url + + prerequisites +maven2.0.2/maven + /prerequisites + + issueManagement +systemBugzilla/system +urlhttp://issues.apache.org/bugzilla/url + /issueManagement + + inceptionYear2001/inceptionYear + + mailingLists +mailingList + nameCommons Dev List/name + subscribe[EMAIL PROTECTED]/subscribe + unsubscribe[EMAIL PROTECTED]/unsubscribe + archivehttp://mail-archives.apache.org/mod_mbox/jakarta-commons-dev//archive +/mailingList +mailingList + nameCommons User List/name + subscribe[EMAIL PROTECTED]/subscribe + unsubscribe[EMAIL PROTECTED]/unsubscribe + archivehttp://mail-archives.apache.org/mod_mbox/jakarta-commons-user//archive +/mailingList + /mailingLists + + developers +developer + idskitching/id + nameSimon Kitching/name + email[EMAIL PROTECTED]/email + timezone+12/timezone +/developer + /developers + + licenses +license + nameApache License 2.0/name + urlhttp://www.apache.org/licenses/LICENSE-2.0.txt/url + distributionrepo/distribution +/license + /licenses + + scm + connectionhttp://svn.apache.org/repos/asf/jakarta/commons/proper/logging/contrib/simon/jcl2//connection + developerConnectionhttps://svn.apache.org/repos/asf/jakarta/commons/proper/logging/contrib/simon/jcl2//developerConnection + urlhttp://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/url + /scm + + organisation +nameApache Software Foundation/name +urlhttp://www.apache.org/url + /organisation + + profiles + +!-- + - If maven is run using + - mvn -Dcompiler.path=/path/to/java1.3 + - then the specified compiler is used to compile all code. + - + - This is needed when building releases intended to run on + - java versions earlier than the one used to run maven (and + - maven requires java1.4 or later). + -- +profile + idrelease/id + activation +property + namecompiler.path/name +/property + /activation + build +pluginManagement + plugins +plugin + groupIdorg.apache.maven.plugins/groupId + artifactIdmaven-compiler-plugin/artifactId + configuration +executable${compiler.path}/executable + /configuration +/plugin + /plugins +/pluginManagement + /build +/profile + /profiles !-- - The subdirectories containing submodules of this project. @@ -27,6 +123,7 @@ urlhttp://www.ibiblio.org/pub/packages/maven2/url /repository /repositories + pluginRepositories pluginRepository idIbiblio/id @@ -34,23 +131,6 @@ /pluginRepository /pluginRepositories - developers -developer - idskitching/id - nameSimon Kitching/name - email[EMAIL PROTECTED]/email - timezone+12/timezone -/developer - /developers - - licenses -license - nameApache License 2.0/name - urlhttp://www.apache.org/licenses/LICENSE-2.0.txt/url - distributionrepo/distribution -/license - /licenses - reporting plugins plugin @@ -62,4 +142,6 @@ /plugin /plugins /reporting + + !-- distribution management clause goes here -- /project - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r384388 - /jakarta/commons/proper/logging/contrib/simon/jcl2/
Author: skitching Date: Wed Mar 8 16:34:28 2006 New Revision: 384388 URL: http://svn.apache.org/viewcvs?rev=384388view=rev Log: Add svn:ignore props Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/ (props changed) Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/ -- --- svn:ignore (added) +++ svn:ignore Wed Mar 8 16:34:28 2006 @@ -0,0 +1,3 @@ +.classpath +.project +target - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r384400 - /jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java
Author: skitching Date: Wed Mar 8 18:01:46 2006 New Revision: 384400 URL: http://svn.apache.org/viewcvs?rev=384400view=rev Log: Minor fix: allow blank lines in file Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java?rev=384400r1=384399r2=384400view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java Wed Mar 8 18:01:46 2006 @@ -145,7 +145,7 @@ return null; } s.trim(); -if (!s.startsWith(#)) { +if ((s.length() 0) !s.startsWith(#)) { return s; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r384401 - in /jakarta/commons/proper/logging/contrib/simon/jcl2/core: ./ test/org/apache/commons/logging/ test/resources/ test/resources/META-INF/ test/resources/META-INF/services/
Author: skitching Date: Wed Mar 8 18:03:18 2006 New Revision: 384401 URL: http://svn.apache.org/viewcvs?rev=384401view=rev Log: Add unit tests for Utils class Added: jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/org/apache/commons/logging/UtilsTestCase.java (with props) jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/ jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/ jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/ jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service1 jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service2 jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service3 jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service4 jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service5 jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service6 Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/pom.xml Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/pom.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/core/pom.xml?rev=384401r1=384400r2=384401view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/core/pom.xml (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/core/pom.xml Wed Mar 8 18:03:18 2006 @@ -35,13 +35,13 @@ directoryconf/directory /resource /resources -!-- + testResources testResource -directorysrc/test/resources/directory +directorytest/resources/directory /testResource /testResources --- + /build /project Added: jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/org/apache/commons/logging/UtilsTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/org/apache/commons/logging/UtilsTestCase.java?rev=384401view=auto == --- jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/org/apache/commons/logging/UtilsTestCase.java (added) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/org/apache/commons/logging/UtilsTestCase.java Wed Mar 8 18:03:18 2006 @@ -0,0 +1,112 @@ +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.logging; + +import org.apache.commons.logging.PathableClassLoader; +import org.apache.commons.logging.PathableTestSuite; + +import junit.framework.Test; +import junit.framework.TestCase; + +/** + * Tests the Utils class. + */ +public class UtilsTestCase extends TestCase +{ +public interface Service0 {} +public interface Service1 {} +public interface Service2 {} +public interface Service3 {} +public interface Service4 {} +public interface Service5 {} +public interface Service6 {} + +// service implementation cannot be instantiated +public static abstract class Service4Impl implements Service4 {} + +// service implementation doesn't implement service +public static class Service5Impl {} + +// service implementation valid +public static class Service6Impl implements Service6 {} + +public void testCreateServiceInstance() +{ +ClassLoader classLoader = null; + +// service file cannot be found +try { +Object o = Utils.createServiceInstance(Service0.class, classLoader); +fail(Unexpectedly retrieved service for Service0); +} catch(LogConfigurationException ex) { +boolean msgOk = ex.getMessage().contains(has no service file); +assertTrue(Service0 service file does not exist, msgOk); +} + +// service file is empty +try { +Object o = Utils.createServiceInstance
svn commit: r384408 - /jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service2
Author: skitching Date: Wed Mar 8 18:57:57 2006 New Revision: 384408 URL: http://svn.apache.org/viewcvs?rev=384408view=rev Log: Test that within service files it is ok to have lines with just whitespace, and lines with comments not starting in column 0. Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service2 Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service2 URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase%24Service2?rev=384408r1=384407r2=384408view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service2 (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/core/test/resources/META-INF/services/org.apache.commons.logging.UtilsTestCase$Service2 Wed Mar 8 18:57:57 2006 @@ -1,4 +1,9 @@ # this is a test service file # that contains just blank lines -# and comments, and nothing else. \ No newline at end of file +# and comments, and nothing else. + + # This comment starts with whitespace + +# the following line contains whitespace + \ No newline at end of file - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r384409 - /jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java
Author: skitching Date: Wed Mar 8 18:58:58 2006 New Revision: 384409 URL: http://svn.apache.org/viewcvs?rev=384409view=rev Log: Fix bug where lines with whitespace or comments not starting in column 0 were being treated as the classname. Thanks to Rahul Akolkar for spotting this. Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java?rev=384409r1=384408r2=384409view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/Utils.java Wed Mar 8 18:58:58 2006 @@ -140,11 +140,11 @@ final InputStreamReader isr = new InputStreamReader(is); final BufferedReader reader = new BufferedReader(isr); for(;;) { -final String s = reader.readLine(); +String s = reader.readLine(); if (s == null) { return null; } -s.trim(); +s = s.trim(); if ((s.length() 0) !s.startsWith(#)) { return s; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r384410 - in /jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging: LogFactory.java LogHandler.java
Author: skitching Date: Wed Mar 8 19:01:56 2006 New Revision: 384410 URL: http://svn.apache.org/viewcvs?rev=384410view=rev Log: Rename some stuff for clarity; no functional change. Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogFactory.java jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogHandler.java Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogFactory.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogFactory.java?rev=384410r1=384409r2=384410view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogFactory.java (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogFactory.java Wed Mar 8 19:01:56 2006 @@ -34,8 +34,8 @@ public abstract class LogFactory { -private static final LogFactory instance = discoverInstance(); - +private static final LogFactory instance = discoverLogFactory(); + /** * Each jarfile that contains this class is also expected to contain: * ul @@ -46,7 +46,7 @@ * the concrete class. An instance of that type will be created, and * all methods on this class then simply delegate to that instance. */ -private static LogFactory discoverInstance() { +private static LogFactory discoverLogFactory() { return (LogFactory) Utils.createServiceInstance(LogFactory.class); } @@ -56,7 +56,7 @@ * @param clazz Class from which a log name will be derived */ public static Log getLog(Class clazz) { -return instance.getInstance(clazz); +return instance.getLogFor(clazz); } /** @@ -67,7 +67,7 @@ * logging implementation that is being wrapped) */ public static Log getLog(String name) { -return instance.getInstance(name); +return instance.getLogFor(name); } /** @@ -75,16 +75,13 @@ * concrete library. */ public static void release() { -instance.release(); +instance.releaseResources(); } /** * Get an instance of Log whose category matches the specified class. - * p - * This method would perhaps be better named getLog, but that name - * is already taken by the static method on this class. */ -protected abstract Log getInstance(Class clazz); +protected abstract Log getLogFor(Class clazz); /** * Get an instance of Log whose category matches the specified string. @@ -92,13 +89,11 @@ * This method would perhaps be better named getLog, but that name * is already taken by the static method on this class. */ -protected abstract Log getInstance(String category); +protected abstract Log getLogFor(String category); /** - * Release all resources. - * p - * This method would perhaps be better named release, but that name - * is already taken by the static method on this class. + * Release all resources, presumably in preparation for shutdown of + * this application. */ -protected abstract void releaseInstance(); +protected abstract void releaseResources(); } Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogHandler.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogHandler.java?rev=384410r1=384409r2=384410view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogHandler.java (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/core/java/org/apache/commons/logging/LogHandler.java Wed Mar 8 19:01:56 2006 @@ -24,7 +24,7 @@ */ public interface LogHandler { -public Log getLog(Class clazz); -public Log getLog(String category); -public void release(); +public Log getLogFor(Class clazz); +public Log getLogFor(String category); +public void releaseResources(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r384411 - in /jakarta/commons/proper/logging/contrib/simon/jcl2: core-dynamic/java/org/apache/commons/logging/ core-static/java/org/apache/commons/logging/ noop/java/org/apache/commons/log
Author: skitching Date: Wed Mar 8 19:03:49 2006 New Revision: 384411 URL: http://svn.apache.org/viewcvs?rev=384411view=rev Log: Method renames due to change in core; no functional changes. Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core-dynamic/java/org/apache/commons/logging/LogFactoryDynamic.java jakarta/commons/proper/logging/contrib/simon/jcl2/core-static/java/org/apache/commons/logging/LogFactoryStatic.java jakarta/commons/proper/logging/contrib/simon/jcl2/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java jakarta/commons/proper/logging/contrib/simon/jcl2/simple/java/org/apache/commons/logging/simple/SimpleLogHandler.java Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core-dynamic/java/org/apache/commons/logging/LogFactoryDynamic.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/core-dynamic/java/org/apache/commons/logging/LogFactoryDynamic.java?rev=384411r1=384410r2=384411view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/core-dynamic/java/org/apache/commons/logging/LogFactoryDynamic.java (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/core-dynamic/java/org/apache/commons/logging/LogFactoryDynamic.java Wed Mar 8 19:03:49 2006 @@ -51,8 +51,8 @@ * * @param clazz Class from which a log name will be derived */ -public Log getInstance(Class clazz) { -return getHandler().getLog(clazz); +public Log getLogFor(Class clazz) { +return getHandler().getLogFor(clazz); } /** @@ -60,12 +60,12 @@ * returned (the meaning of this name is only known to the underlying * logging implementation that is being wrapped) */ -public Log getInstance(String name) { -return getHandler().getLog(name); +public Log getLogFor(String name) { +return getHandler().getLogFor(name); } -public void releaseInstance() { -getHandler().release(); +public void releaseResources() { +getHandler().releaseResources(); } private synchronized LogHandler getHandler() { Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/core-static/java/org/apache/commons/logging/LogFactoryStatic.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/core-static/java/org/apache/commons/logging/LogFactoryStatic.java?rev=384411r1=384410r2=384411view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/core-static/java/org/apache/commons/logging/LogFactoryStatic.java (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/core-static/java/org/apache/commons/logging/LogFactoryStatic.java Wed Mar 8 19:03:49 2006 @@ -51,8 +51,8 @@ * * @param clazz Class from which a log name will be derived */ -public Log getInstance(Class clazz) { -return handler.getLog(clazz); +public Log getLogFor(Class clazz) { +return handler.getLogFor(clazz); } /** @@ -60,11 +60,11 @@ * returned (the meaning of this name is only known to the underlying * logging implementation that is being wrapped) */ -public Log getInstance(String name) { -return handler.getLog(name); +public Log getLogFor(String name) { +return handler.getLogFor(name); } -public void releaseInstance() { -handler.release(); +public void releaseResources() { +handler.releaseResources(); } } Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java?rev=384411r1=384410r2=384411view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java Wed Mar 8 19:03:49 2006 @@ -30,14 +30,14 @@ public final class NoOpLogHandler implements LogHandler { private NoOpLog instance = new NoOpLog(); -public Log getLog(Class clazz) { +public Log getLogFor(Class clazz) { return instance; } -public Log getLog(String category) { +public Log getLogFor(String category) { return instance; } -public void release() { +public void releaseResources() { } } Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/simple/java/org/apache/commons/logging/simple/SimpleLogHandler.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/simple
svn commit: r384412 - /jakarta/commons/proper/logging/contrib/simon/jcl2/log4j/java/org/apache/commons/logging/log4j/Log4JLogHandler.java
Author: skitching Date: Wed Mar 8 19:05:37 2006 New Revision: 384412 URL: http://svn.apache.org/viewcvs?rev=384412view=rev Log: Update method names due to core changes; no functional change Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/log4j/java/org/apache/commons/logging/log4j/Log4JLogHandler.java Modified: jakarta/commons/proper/logging/contrib/simon/jcl2/log4j/java/org/apache/commons/logging/log4j/Log4JLogHandler.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/log4j/java/org/apache/commons/logging/log4j/Log4JLogHandler.java?rev=384412r1=384411r2=384412view=diff == --- jakarta/commons/proper/logging/contrib/simon/jcl2/log4j/java/org/apache/commons/logging/log4j/Log4JLogHandler.java (original) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/log4j/java/org/apache/commons/logging/log4j/Log4JLogHandler.java Wed Mar 8 19:05:37 2006 @@ -34,11 +34,11 @@ */ private HashMap logs = new HashMap(); -public Log getLog(Class clazz) { -return getLog(clazz.getName()); +public Log getLogFor(Class clazz) { +return getLogFor(clazz.getName()); } -public synchronized Log getLog(String category) { +public synchronized Log getLogFor(String category) { Log log = (Log) logs.get(category); if (log == null) { log = new Log4JLog(category); @@ -47,7 +47,7 @@ return log; } -public synchronized void release() { +public synchronized void releaseResources() { logs.clear(); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r384414 - in /jakarta/commons/proper/logging/contrib/simon/jcl2/testutils: ./ java/ java/org/ java/org/apache/ java/org/apache/commons/ java/org/apache/commons/logging/ test/ test/org/ tes
Author: skitching Date: Wed Mar 8 19:34:09 2006 New Revision: 384414 URL: http://svn.apache.org/viewcvs?rev=384414view=rev Log: Make unit-testing util classes into their own module, so these can be a test dependency of other modules that need them. Added: jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/apache/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/apache/commons/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/apache/commons/logging/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/apache/commons/logging/PathableClassLoader.java (with props) jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/apache/commons/logging/PathableTestSuite.java (with props) jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/pom.xml jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/test/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/test/org/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/test/org/apache/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/test/org/apache/commons/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/test/org/apache/commons/logging/ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/test/resources/ Added: jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/apache/commons/logging/PathableClassLoader.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/apache/commons/logging/PathableClassLoader.java?rev=384414view=auto == --- jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/apache/commons/logging/PathableClassLoader.java (added) +++ jakarta/commons/proper/logging/contrib/simon/jcl2/testutils/java/org/apache/commons/logging/PathableClassLoader.java Wed Mar 8 19:34:09 2006 @@ -0,0 +1,260 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.logging; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLClassLoader; + +// TODO: use HashTable instead of HashMap for java1.1 support +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * A ClassLoader which sees only specified classes, and which can be + * set to do parent-first or child-first path lookup. + * p + * Note that this classloader is not industrial strength; users + * looking for such a class may wish to look at the Tomcat sourcecode + * instead. In particular, this class may not be threadsafe. + * p + * Note that the ClassLoader.getResources method isn't overloaded here. + * It would be nice to ensure that when child-first lookup is set the + * resources from the child are returned earlier in the list than the + * resources from the parent. However overriding this method isn't possible + * as the java 1.4 version of ClassLoader declares this method final + * (though the java 1.5 version has removed the final qualifier). As the + * ClassLoader javadoc doesn't specify the order in which resources + * are returned, it's valid to return the resources in any order (just + * untidy) so the inherited implementation is technically ok. + */ + +public class PathableClassLoader extends URLClassLoader { + +private static final URL[] NO_URLS = new URL[0]; + +/** + * A map of package-prefix to ClassLoader. Any class which is in + * this map is looked up via the specified classloader instead of + * the classpath associated with this classloader or its parents. + * p + * This is necessary in order for the rest of the world to communicate + * with classes loaded via a custom classloader. As an example, junit + * testcases which are loaded via a custom classloader needs to see + * the same junit classes as the code invoking the testcase, otherwise + * they can't pass result objects back. + * p + * Normally, only a classloader created with a null parent needs to + * have any