提交 9806609c 编写于 作者: K kevinw

8021444: SA: ClassDump.run() should not ignore existing ClassFilter.

Reviewed-by: minqi, poonam
上级 e87d4ae8
/* /*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -74,23 +74,24 @@ public class ClassDump extends Tool { ...@@ -74,23 +74,24 @@ public class ClassDump extends Tool {
public void run() { public void run() {
// Ready to go with the database... // Ready to go with the database...
try { try {
// The name of the filter always comes from a System property. if (classFilter == null) {
// If we have a pkgList, pass it, otherwise let the filter read // If not already set, the name of the filter comes from a System property.
// its own System property for the list of classes. // If we have a pkgList, pass it, otherwise let the filter read
String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter", // its own System property for the list of classes.
"sun.jvm.hotspot.tools.jcore.PackageNameFilter"); String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter",
try { "sun.jvm.hotspot.tools.jcore.PackageNameFilter");
Class filterClass = Class.forName(filterClassName); try {
if (pkgList == null) { Class filterClass = Class.forName(filterClassName);
classFilter = (ClassFilter) filterClass.newInstance(); if (pkgList == null) {
} else { classFilter = (ClassFilter) filterClass.newInstance();
Constructor con = filterClass.getConstructor(String.class); } else {
classFilter = (ClassFilter) con.newInstance(pkgList); Constructor con = filterClass.getConstructor(String.class);
classFilter = (ClassFilter) con.newInstance(pkgList);
}
} catch(Exception exp) {
System.err.println("Warning: Can not create class filter!");
} }
} catch(Exception exp) {
System.err.println("Warning: Can not create class filter!");
} }
String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir", "."); String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir", ".");
setOutputDirectory(outputDirectory); setOutputDirectory(outputDirectory);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册