commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1197917 - in /commons/proper/digester/trunk: RELEASE-NOTES.txt src/changes/changes.xml src/main/java/org/apache/commons/digester3/binder/DigesterLoader.java src/test/java/org/apache/commons/digester3/binder/DigesterLoaderTestCase.jav
Date Sat, 05 Nov 2011 11:14:38 GMT
On 5 November 2011 10:24,  <simonetripodi@apache.org> wrote:
> Author: simonetripodi
> Date: Sat Nov  5 10:24:42 2011
> New Revision: 1197917
>
> URL: http://svn.apache.org/viewvc?rev=1197917&view=rev
> Log:
> [DIGESTER-155] ClassLoader reference set to DigesterLoader not set in produced Digetser
instances
>
> Modified:
>    commons/proper/digester/trunk/RELEASE-NOTES.txt
>    commons/proper/digester/trunk/src/changes/changes.xml
>    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/DigesterLoader.java
>    commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/binder/DigesterLoaderTestCase.java
>
> Modified: commons/proper/digester/trunk/RELEASE-NOTES.txt
> URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/RELEASE-NOTES.txt?rev=1197917&r1=1197916&r2=1197917&view=diff
> ==============================================================================
> --- commons/proper/digester/trunk/RELEASE-NOTES.txt (original)
> +++ commons/proper/digester/trunk/RELEASE-NOTES.txt Sat Nov  5 10:24:42 2011
> @@ -55,7 +55,7 @@ NEW FEATURES
>  BUGS FROM PREVIOUS RELEASE
>  ===========================

Does that mean bugs are existing bugs carried over from previous releases?
That's how I read it initially, but I suspect it means the list of
bugs fixed since the previous release.

Maybe it should read

BUGS FIXED SINCE PREVIOUS RELEASE


> - * NONE
> + * [DIGESTER-155] ClassLoader reference set to DigesterLoader not set in produced Digetser
instances
>
>  IMPROVEMENTS OVER PREVIOUS RELEASE
>  ===================================
>
> Modified: commons/proper/digester/trunk/src/changes/changes.xml
> URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/changes/changes.xml?rev=1197917&r1=1197916&r2=1197917&view=diff
> ==============================================================================
> --- commons/proper/digester/trunk/src/changes/changes.xml (original)
> +++ commons/proper/digester/trunk/src/changes/changes.xml Sat Nov  5 10:24:42 2011
> @@ -23,6 +23,9 @@
>   </properties>
>   <body>
>   <release version="3.2" date="201?-??-??" description="Maintenance release.">
> +    <action dev="simonetripodi" type="fix" issue="DIGESTER-155">
> +      ClassLoader reference set to DigesterLoader not set in produced Digetser instances
> +    </action>
>     <action dev="simonetripodi" type="add" issue="DIGESTER-153">
>       Add Constructor support to ObjectCreateRule
>     </action>
>
> Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/DigesterLoader.java
> URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/DigesterLoader.java?rev=1197917&r1=1197916&r2=1197917&view=diff
> ==============================================================================
> --- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/DigesterLoader.java
(original)
> +++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/DigesterLoader.java
Sat Nov  5 10:24:42 2011
> @@ -107,8 +107,6 @@ public final class DigesterLoader
>
>     private final Iterable<RulesModule> rulesModules;
>
> -    private boolean useContextClassLoader = true;
> -
>     /**
>      * The class loader to use for instantiating application objects.
>      * If not specified, the context class loader, or the class loader
> @@ -159,6 +157,7 @@ public final class DigesterLoader
>     private DigesterLoader( Iterable<RulesModule> rulesModules )
>     {
>         this.rulesModules = rulesModules;
> +        setUseContextClassLoader( true );
>     }
>
>     /**
> @@ -173,7 +172,14 @@ public final class DigesterLoader
>      */
>     public DigesterLoader setUseContextClassLoader( boolean useContextClassLoader )
>     {
> -        this.useContextClassLoader = useContextClassLoader;
> +        if ( useContextClassLoader )
> +        {
> +            setClassLoader( Thread.currentThread().getContextClassLoader() );
> +        }
> +        else
> +        {
> +            setClassLoader( getClass().getClassLoader() );
> +        }
>         return this;
>     }
>
> @@ -185,6 +191,11 @@ public final class DigesterLoader
>      */
>     public DigesterLoader setClassLoader( ClassLoader classLoader )
>     {
> +        if ( classLoader == null )
> +        {
> +            throw new IllegalArgumentException( "Parameter 'classLoader' cannot
be null" );
> +        }
> +
>         this.classLoader = classLoader;
>         return this;
>     }
> @@ -539,6 +550,7 @@ public final class DigesterLoader
>         }
>
>         Digester digester = new Digester( reader );
> +        digester.setClassLoader( classLoader );
>         digester.setRules( rules );
>         digester.setSubstitutor( substitutor );
>         digester.registerAll( entityValidator );
> @@ -572,14 +584,9 @@ public final class DigesterLoader
>      */
>     public RuleSet createRuleSet()
>     {
> -        ClassLoader contextClassLoader =
> -            classLoader != null ? classLoader
> -                            : ( useContextClassLoader ? Thread.currentThread().getContextClassLoader()
> -                                            : getClass().getClassLoader()
);
> -
> -        if ( !contextClassLoader.equals( rulesBinder.getContextClassLoader() ) )
> +        if ( !classLoader.equals( rulesBinder.getContextClassLoader() ) )
>         {
> -            rulesBinder.initialize( contextClassLoader );
> +            rulesBinder.initialize( classLoader );
>             for ( RulesModule rulesModule : rulesModules )
>             {
>                 rulesModule.configure( rulesBinder );
>
> Modified: commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/binder/DigesterLoaderTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/binder/DigesterLoaderTestCase.java?rev=1197917&r1=1197916&r2=1197917&view=diff
> ==============================================================================
> --- commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/binder/DigesterLoaderTestCase.java
(original)
> +++ commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/binder/DigesterLoaderTestCase.java
Sat Nov  5 10:24:42 2011
> @@ -124,4 +124,25 @@ public final class DigesterLoaderTestCas
>         assertSame( expected, actual );
>     }
>
> +    @Test
> +    public void digester155()
> +    {
> +        ClassLoader expected = getClass().getClassLoader();
> +
> +        Digester digester = newLoader( new AbstractRulesModule()
> +        {
> +
> +            @Override
> +            protected void configure()
> +            {
> +                // do nothing
> +            }
> +
> +        } ).setClassLoader( expected ).newDigester();
> +
> +        ClassLoader actual = digester.getClassLoader();
> +
> +        assertSame( expected, actual );
> +    }
> +
>  }
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message