RFR: 8078519 Can't run SA tools from a non-images build
Staffan Larsen
staffan.larsen at oracle.com
Thu Apr 23 14:51:11 UTC 2015
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 at oracle.com> wrote:
>
> Please see description of the problem in the bug report: https://bugs.openjdk.java.net/browse/JDK-8078519 <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 " +
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20150423/5fe8132d/attachment-0001.html>
More information about the serviceability-dev
mailing list