< prev index next >
src/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java
Print this page
rev 13686 : 8216064: -XX:StartFlightRecording:settings= doesn't work properly
Reviewed-by: mgronlun
*** 22,31 ****
--- 22,32 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.jfr.internal.dcmd;
+ import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.Paths;
*** 103,125 ****
}
if (duration == null && Boolean.FALSE.equals(dumpOnExit) && path != null) {
throw new DCmdException("Filename can only be set for a time bound recording or if dumponexit=true. Set duration/dumponexit or omit filename.");
}
!
!
Map<String, String> s = new HashMap<>();
if (settings == null || settings.length == 0) {
settings = new String[] { "default" };
}
for (String configName : settings) {
try {
s.putAll(JFC.createKnown(configName).getSettings());
} catch (IOException | ParseException e) {
! throw new DCmdException("Could not parse setting " + settings[0], e);
}
}
OldObjectSample.updateSettingPathToGcRoots(s, pathToGcRoots);
--- 104,129 ----
}
if (duration == null && Boolean.FALSE.equals(dumpOnExit) && path != null) {
throw new DCmdException("Filename can only be set for a time bound recording or if dumponexit=true. Set duration/dumponexit or omit filename.");
}
! if (settings.length == 1 && settings[0].length() == 0) {
! throw new DCmdException("No settings specified. Use settings=none to start without any settings");
! }
Map<String, String> s = new HashMap<>();
if (settings == null || settings.length == 0) {
settings = new String[] { "default" };
}
for (String configName : settings) {
try {
s.putAll(JFC.createKnown(configName).getSettings());
+ } catch(FileNotFoundException e) {
+ throw new DCmdException("Could not find settings file'" + configName + "'", e);
} catch (IOException | ParseException e) {
! throw new DCmdException("Could not parse settings file '" + settings[0] + "'", e);
}
}
OldObjectSample.updateSettingPathToGcRoots(s, pathToGcRoots);
< prev index next >