You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2011/04/10 01:26:07 UTC

Re: svn commit: r1090700 - in /commons/proper/discovery/trunk: RELEASE-NOTES.txt src/changes/changes.xml src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java

On 9 April 2011 23:48,  <si...@apache.org> wrote:
> Author: simonetripodi
> Date: Sat Apr  9 22:48:40 2011
> New Revision: 1090700
>
> URL: http://svn.apache.org/viewvc?rev=1090700&view=rev
> Log:
> DISCOVERY-13: Problem with Oracle JVM classLoader

[...]

>
> Modified: commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
> URL: http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java?rev=1090700&r1=1090699&r2=1090700&view=diff
> ==============================================================================
> --- commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java (original)
> +++ commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java Sat Apr  9 22:48:40 2011
> @@ -99,9 +99,15 @@ public class DiscoverClasses<T> extends
>                     ClassLoader loader = getClassLoaders().get(idx++);
>
>                     URL url = null;
> +                    boolean getResourceUnsupported = false;
> +
>                     try {
>                         url = loader.getResource(resourceName);
>                     } catch (UnsupportedOperationException e) {
> +                        getResourceUnsupported = true;
> +                    }
> +
> +                    if (url == null || getResourceUnsupported) {
>                         try {
>                             CodeSource codeSource = loader.loadClass(className)
>                                 .getProtectionDomain()

Surely the boolean getResourceUnsupported is not needed?

If the catch block is triggered, url will be null anyway.

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


Re: svn commit: r1090700 - in /commons/proper/discovery/trunk: RELEASE-NOTES.txt src/changes/changes.xml src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java

Posted by Simone Tripodi <si...@apache.org>.
right, I originally intended handling different situation, but the
null check is more than enough
thanks!
Simo

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



On Sun, Apr 10, 2011 at 1:26 AM, sebb <se...@gmail.com> wrote:
> On 9 April 2011 23:48,  <si...@apache.org> wrote:
>> Author: simonetripodi
>> Date: Sat Apr  9 22:48:40 2011
>> New Revision: 1090700
>>
>> URL: http://svn.apache.org/viewvc?rev=1090700&view=rev
>> Log:
>> DISCOVERY-13: Problem with Oracle JVM classLoader
>
> [...]
>
>>
>> Modified: commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
>> URL: http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java?rev=1090700&r1=1090699&r2=1090700&view=diff
>> ==============================================================================
>> --- commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java (original)
>> +++ commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java Sat Apr  9 22:48:40 2011
>> @@ -99,9 +99,15 @@ public class DiscoverClasses<T> extends
>>                     ClassLoader loader = getClassLoaders().get(idx++);
>>
>>                     URL url = null;
>> +                    boolean getResourceUnsupported = false;
>> +
>>                     try {
>>                         url = loader.getResource(resourceName);
>>                     } catch (UnsupportedOperationException e) {
>> +                        getResourceUnsupported = true;
>> +                    }
>> +
>> +                    if (url == null || getResourceUnsupported) {
>>                         try {
>>                             CodeSource codeSource = loader.loadClass(className)
>>                                 .getProtectionDomain()
>
> Surely the boolean getResourceUnsupported is not needed?
>
> If the catch block is triggered, url will be null anyway.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

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