mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-11 11:06:25 +00:00
[FIXED JENKINS-4525] XML encoding sniffing can fail with old JAXP.
Modified to assume UTF-8 if we fail to find it.
This commit is contained in:
1 parent
787123cf2d
commit
d2c9d7346f
2 files changed
+9
-5
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user