src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java
changeset 55302 686dedba1d9a
parent 52413 6372f5af9612
child 58154 060d9d139109
child 58863 c16ac7a2eba4
equal deleted inserted replaced
55301:a9188ba494a3 55302:686dedba1d9a
    22  * or visit www.oracle.com if you need additional information or have any
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 package jdk.jfr.internal.dcmd;
    25 package jdk.jfr.internal.dcmd;
    26 
    26 
       
    27 import java.io.FileNotFoundException;
    27 import java.io.IOException;
    28 import java.io.IOException;
    28 import java.nio.file.Files;
    29 import java.nio.file.Files;
    29 import java.nio.file.InvalidPathException;
    30 import java.nio.file.InvalidPathException;
    30 import java.nio.file.Path;
    31 import java.nio.file.Path;
    31 import java.nio.file.Paths;
    32 import java.nio.file.Paths;
   103         }
   104         }
   104 
   105 
   105         if (duration == null && Boolean.FALSE.equals(dumpOnExit) && path != null) {
   106         if (duration == null && Boolean.FALSE.equals(dumpOnExit) && path != null) {
   106             throw new DCmdException("Filename can only be set for a time bound recording or if dumponexit=true. Set duration/dumponexit or omit filename.");
   107             throw new DCmdException("Filename can only be set for a time bound recording or if dumponexit=true. Set duration/dumponexit or omit filename.");
   107         }
   108         }
   108 
   109         if (settings.length == 1 && settings[0].length() == 0) {
       
   110             throw new DCmdException("No settings specified. Use settings=none to start without any settings");
       
   111         }
   109         Map<String, String> s = new HashMap<>();
   112         Map<String, String> s = new HashMap<>();
   110         for (String configName : settings) {
   113         for (String configName : settings) {
   111             try {
   114             try {
   112                 s.putAll(JFC.createKnown(configName).getSettings());
   115                 s.putAll(JFC.createKnown(configName).getSettings());
       
   116             } catch(FileNotFoundException e) {
       
   117                 throw new DCmdException("Could not find settings file'" + configName + "'", e);
   113             } catch (IOException | ParseException e) {
   118             } catch (IOException | ParseException e) {
   114                 throw new DCmdException("Could not parse setting " + settings[0], e);
   119                 throw new DCmdException("Could not parse settings file '" + settings[0] + "'", e);
   115             }
   120             }
   116         }
   121         }
   117 
   122 
   118         OldObjectSample.updateSettingPathToGcRoots(s, pathToGcRoots);
   123         OldObjectSample.updateSettingPathToGcRoots(s, pathToGcRoots);
   119 
   124