提交 d2c9d734 编写于 作者: K Kohsuke Kawaguchi

[FIXED JENKINS-4525] XML encoding sniffing can fail with old JAXP.

Modified to assume UTF-8 if we fail to find it.
上级 787123cf
......@@ -55,6 +55,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=bug>
Fixed the XML encoding sniffing problem in environments that have old JAXP
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-4525">issue 4525</a>)
<li class=bug>
Suggestions for search do not work since 1.433
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11208">issue 11208</a>)
......
......@@ -261,8 +261,7 @@ public final class XmlFile {
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
attempt();
// if we still haven't found it at the first start element,
// there's something wrong.
// if we still haven't found it at the first start element, then we are not going to find it.
throw new Eureka(null);
}
......@@ -279,9 +278,11 @@ public final class XmlFile {
// can't reach here
throw new AssertionError();
} catch (Eureka e) {
if(e.encoding==null)
throw new IOException("Failed to detect encoding of "+file);
return e.encoding;
if(e.encoding!=null)
return e.encoding;
// the environment can contain old version of Xerces and others that do not support Locator2
// in such a case, assume UTF-8 rather than fail, since Jenkins internally always write XML in UTF-8
return "UTF-8";
} catch (SAXException e) {
throw new IOException2("Failed to detect encoding of "+file,e);
} catch (ParserConfigurationException e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册