提交 39c76672 编写于 作者: T Tom Huybrechts

singleton NullChangeLogParser to reduce memory footprint

上级 f4b68262
......@@ -563,7 +563,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
// for historical reasons, null in the scm field means CVS, so we need to explicitly set this to something
// in case check out fails and leaves a broken changelog.xml behind.
// see http://www.nabble.com/CVSChangeLogSet.parse-yields-SAXParseExceptions-when-parsing-bad-*AccuRev*-changelog.xml-files-td22213663.html
AbstractBuild.this.scm = new NullChangeLogParser();
AbstractBuild.this.scm = NullChangeLogParser.INSTANCE;
try {
if (project.checkout(AbstractBuild.this,launcher,listener,new File(getRootDir(),"changelog.xml"))) {
......
......@@ -34,7 +34,14 @@ import java.io.IOException;
* @author Kohsuke Kawaguchi
*/
public class NullChangeLogParser extends ChangeLogParser {
public static final NullChangeLogParser INSTANCE = new NullChangeLogParser();
public ChangeLogSet<? extends ChangeLogSet.Entry> parse(AbstractBuild build, File changelogFile) throws IOException, SAXException {
return ChangeLogSet.createEmpty(build);
}
public Object readResolve() {
return INSTANCE;
}
}
......@@ -55,7 +55,7 @@ public class NullSCM extends SCM {
}
public ChangeLogParser createChangeLogParser() {
return new NullChangeLogParser();
return NullChangeLogParser.INSTANCE;
}
@Extension
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册