From db608422bc4f512a3f01b8a19ff34b03e2e6b3ab Mon Sep 17 00:00:00 2001 From: Alastair D'Silva Date: Thu, 10 Mar 2016 10:55:21 +1100 Subject: [PATCH] Fix JENKINS-33442: - Cppcheck plugin cannot find results file if the workspace path contains an encoded '/' (%2F) Opens the file directly in the Cppcheck plugin, and passes the stream to the XML parser, instead of passing the filename to the XML parser wihich incorrectly expands the encoded characters. --- .../org/jenkinsci/plugins/cppcheck/parser/CppcheckParser.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jenkinsci/plugins/cppcheck/parser/CppcheckParser.java b/src/main/java/org/jenkinsci/plugins/cppcheck/parser/CppcheckParser.java index 6b7197b..27f8f6a 100644 --- a/src/main/java/org/jenkinsci/plugins/cppcheck/parser/CppcheckParser.java +++ b/src/main/java/org/jenkinsci/plugins/cppcheck/parser/CppcheckParser.java @@ -11,6 +11,7 @@ import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; @@ -43,7 +44,8 @@ public CppcheckReport parse(final File file, BuildListener listener) throws IOEx org.jenkinsci.plugins.cppcheck.model.Cppcheck.class, org.jenkinsci.plugins.cppcheck.model.Results.class)); Unmarshaller unmarshaller = jc.get().createUnmarshaller(); - org.jenkinsci.plugins.cppcheck.model.Results results = (org.jenkinsci.plugins.cppcheck.model.Results) unmarshaller.unmarshal(file); + FileInputStream stream = new FileInputStream(file); + org.jenkinsci.plugins.cppcheck.model.Results results = (org.jenkinsci.plugins.cppcheck.model.Results) unmarshaller.unmarshal(stream); if (results.getCppcheck() == null) { throw new JAXBException("Test with versio 1"); }