Staffan,

Looks good for me.

-Dmitry

On 2015-04-23 17:51, Staffan Larsen wrote:
> Here is an improved and simplified patch:
> 
> diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
> b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
> --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
> +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
> @@ -259,8 +259,7 @@
>       saProps = new Properties();
>       URL url = null;
>       try {
> -       url = VM.class.getClassLoader().getResource("sa.properties");
> -       saProps.load(new BufferedInputStream(url.openStream()));
> +       saProps.load(VM.class.getResourceAsStream("/sa.properties"));
>       } catch (Exception e) {
>         System.err.println("Unable to load properties  " +
>                                    (url == null ? "null" : url.toString()) +
> 
> 
>> On 23 apr 2015, at 16:13, Staffan Larsen <staffan.lar...@oracle.com
>> <mailto:staffan.lar...@oracle.com>> wrote:
>>
>> Please see description of the problem in the bug
>> report: https://bugs.openjdk.java.net/browse/JDK-8078519
>>
>> The simple fix is included below.
>>
>> Thanks,
>> /Staffan
>>
>>
>> diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
>> b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
>> --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
>> +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
>> @@ -259,7 +259,12 @@
>>       saProps = new Properties();
>>       URL url = null;
>>       try {
>> -       url = VM.class.getClassLoader().getResource("sa.properties");
>> +       if (VM.class.getClassLoader() == null) {
>> +         url  = ClassLoader.getSystemResource("sa.properties");
>> +       }
>> +       else {
>> +         url = VM.class.getClassLoader().getResource("sa.properties");
>> +       }
>>         saProps.load(new BufferedInputStream(url.openStream()));
>>       } catch (Exception e) {
>>         System.err.println("Unable to load properties  " +
> 


-- 
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.

Reply via email to