提交 5571e430 编写于 作者: D Dave Brosius

remove wasteful duplicate method calls

上级 5abb4849
......@@ -227,8 +227,9 @@ public abstract class Plugin implements Saveable {
*/
public void save() throws IOException {
if(BulkChange.contains(this)) return;
getConfigXml().write(this);
SaveableListener.fireOnChange(this, getConfigXml());
XmlFile config = getConfigXml();
config.write(this);
SaveableListener.fireOnChange(this, config);
}
/**
......
......@@ -485,9 +485,10 @@ public class PluginWrapper implements Comparable<PluginWrapper> {
* or null if there's no back up.
*/
public String getBackupVersion() {
if (getBackupFile().exists()) {
File backup = getBackupFile();
if (backup.exists()) {
try {
JarFile backupPlugin = new JarFile(getBackupFile());
JarFile backupPlugin = new JarFile(backup);
return backupPlugin.getManifest().getMainAttributes().getValue("Plugin-Version");
} catch (IOException e) {
LOGGER.log(WARNING, "Failed to get backup version ", e);
......
......@@ -89,8 +89,9 @@ public final class ProxyConfiguration implements Saveable {
public void save() throws IOException {
if(BulkChange.contains(this)) return;
getXmlFile().write(this);
SaveableListener.fireOnChange(this, getXmlFile());
XmlFile config = getXmlFile();
config.write(this);
SaveableListener.fireOnChange(this, config);
}
public static XmlFile getXmlFile() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册