[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: RFR: 8078519 Can't run SA tools from a non-images build
From:       Dmitry Samersoff <dmitry.samersoff () oracle ! com>
Date:       2015-04-23 16:44:06
Message-ID: 55392156.9070505 () oracle ! com
[Download RAW message or body]

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.larsen@oracle.com
>> <mailto:staffan.larsen@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.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic