@Override protected Command doRun(Task task, Map<String, String> prefs) throws PackageException { Config rollback = new Config(); ConfigurationGenerator cg = new ConfigurationGenerator(); cg.init(); try { if (addtemplate != null) { cg.addTemplate(addtemplate); rollback.rmtemplate = addtemplate; } if (rmtemplate != null) { cg.rmTemplate(rmtemplate); rollback.addtemplate = rmtemplate; } if (set != null) { String[] newValue = set.split("=", 2); String previousValue = cg.setProperty(newValue[0], (newValue[1].length() > 0 ? newValue[1] : null)); if (previousValue == null) { previousValue = ""; } rollback.set = newValue[0] + "=" + previousValue; } } catch (ConfigurationException e) { throw new PackageException(e); } return rollback; }