Config targetConfig = targetService.getConfig(target);
if (targetConfig != null) {
config = targetConfig;
}
JavaConfig jc = config.getJavaConfig();
final ActionReport report = context.getActionReport();
try {
JvmOptionBag bag;
if (addToProfiler) { //make sure profiler element exists before creating a JVM option for profiler
if (jc.getProfiler() == null) {
report.setMessage(lsm.getString("create.profiler.first"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
bag = jc.getProfiler();
} else
bag = jc;
ActionReport.MessagePart part = report.getTopMessagePart().addChild();
List<String> validOptions = new ArrayList<String>(jvmOptions);
validate(bag, validOptions, report); //Note: method mutates the given list