Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48463

Jenkins should create xml 1.1 output in order to support control characters that are illegal in xml 1.0

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • core

      The current implementation of XmlFile.java emits an XML 1.0 header, which breaks things like Move/Copy/Promote if the user has included any characters that are illegal in XML 1.0 (such as Control-XX, etc) in their jobs.
      XStream, which is used for serialization/deserialization, deals with XML fragments, and doesn't have an issue reading/writing this non well-formed XML. Changing XmlFile.java so that it creates xml 1.1  here will allow jenkins config files to support these special characters. This also requires updating the underlying XML Pull Parser being used by XStream to something that support XML v1.1

          [JENKINS-48463] Jenkins should create xml 1.1 output in order to support control characters that are illegal in xml 1.0

          mike cirioli created issue -
          mike cirioli made changes -
          Remote Link New: This issue links to "Pull Request #3185 (Web Link)" [ 19332 ]

          mike cirioli added a comment - - edited

          Note:  Benchmarks comparing XML Parser performance can be found here:  http://x-stream.github.io/benchmarks.html

           

          Previously Jenkins was using XPP (Xpp3 min 1.1.4c), and has now been switched to XPP (kXML2 min 2.3.0).  Investigating the use of other drivers my be useful in the future for even greater performance gains (assuming they support XML v1.1).  Currently there are limitations in the drivers we can use because of forked XStream dependency.  

          mike cirioli added a comment - - edited Note:  Benchmarks comparing XML Parser performance can be found here:  http://x-stream.github.io/benchmarks.html   Previously Jenkins was using XPP (Xpp3 min 1.1.4c), and has now been switched to XPP (kXML2 min 2.3.0).  Investigating the use of other drivers my be useful in the future for even greater performance gains (assuming they support XML v1.1).  Currently there are limitations in the drivers we can use because of forked XStream dependency.  
          CloudBees Inc. made changes -
          Remote Link New: This issue links to "CloudBees Internal OSS-2590 (Web Link)" [ 19334 ]
          Oleg Nenashev made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Code changed in jenkins
          User: mike cirioli
          Path:
          core/src/main/java/hudson/Main.java
          core/src/main/java/hudson/XmlFile.java
          core/src/main/java/hudson/model/Fingerprint.java
          core/src/main/java/hudson/util/XStream2.java
          core/src/test/java/hudson/PluginManagerTest.java
          core/src/test/java/hudson/util/XStream2EncodingTest.java
          core/src/test/java/jenkins/model/RunIdMigratorTest.java
          core/src/test/java/jenkins/util/xstream/XStreamDOMTest.java
          core/src/test/java/jenkins/xml/XMLUtilsTest.java
          test/src/test/java/hudson/cli/GetNodeCommandTest.java
          test/src/test/java/hudson/cli/GetViewCommandTest.java
          test/src/test/java/hudson/model/AbstractItemSecurityTest.java
          test/src/test/java/hudson/model/ComputerConfigDotXmlTest.java
          test/src/test/java/hudson/model/ItemGroupMixInTest.java
          test/src/test/java/hudson/util/RobustReflectionConverterTest.java
          http://jenkins-ci.org/commit/jenkins/9a4a913e387c49d0c4cec602280e25c37196f83c
          Log:
          JENKINS-48463 - update jenkins core to use xml v1.1

          • switched to KxmlDriver (needed for xml 1.1 support)
          • updated to create xml v1.1 headers
          • updated test to use KXml2Driver explicitly
          • updated unit tests to support xml v1.1

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: mike cirioli Path: core/src/main/java/hudson/Main.java core/src/main/java/hudson/XmlFile.java core/src/main/java/hudson/model/Fingerprint.java core/src/main/java/hudson/util/XStream2.java core/src/test/java/hudson/PluginManagerTest.java core/src/test/java/hudson/util/XStream2EncodingTest.java core/src/test/java/jenkins/model/RunIdMigratorTest.java core/src/test/java/jenkins/util/xstream/XStreamDOMTest.java core/src/test/java/jenkins/xml/XMLUtilsTest.java test/src/test/java/hudson/cli/GetNodeCommandTest.java test/src/test/java/hudson/cli/GetViewCommandTest.java test/src/test/java/hudson/model/AbstractItemSecurityTest.java test/src/test/java/hudson/model/ComputerConfigDotXmlTest.java test/src/test/java/hudson/model/ItemGroupMixInTest.java test/src/test/java/hudson/util/RobustReflectionConverterTest.java http://jenkins-ci.org/commit/jenkins/9a4a913e387c49d0c4cec602280e25c37196f83c Log: JENKINS-48463 - update jenkins core to use xml v1.1 switched to KxmlDriver (needed for xml 1.1 support) updated to create xml v1.1 headers updated test to use KXml2Driver explicitly updated unit tests to support xml v1.1

          Code changed in jenkins
          User: mike cirioli
          Path:
          core/src/main/java/hudson/model/View.java
          core/src/main/java/jenkins/util/xstream/XStreamDOM.java
          http://jenkins-ci.org/commit/jenkins/37365eeca7e8683920dd0d13f039e36380f19e24
          Log:
          JENKINS-48463 update hard coded references of XPP3Driver to KXml2Driver in order to support XMLv1.1

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: mike cirioli Path: core/src/main/java/hudson/model/View.java core/src/main/java/jenkins/util/xstream/XStreamDOM.java http://jenkins-ci.org/commit/jenkins/37365eeca7e8683920dd0d13f039e36380f19e24 Log: JENKINS-48463 update hard coded references of XPP3Driver to KXml2Driver in order to support XMLv1.1

          Code changed in jenkins
          User: mike cirioli
          Path:
          core/src/main/java/hudson/XmlFile.java
          core/src/main/java/hudson/model/View.java
          core/src/main/java/hudson/util/XStream2.java
          core/src/main/java/jenkins/util/xstream/XStreamDOM.java
          core/src/test/java/hudson/PluginManagerTest.java
          core/src/test/java/hudson/util/XStream2EncodingTest.java
          core/src/test/java/jenkins/model/RunIdMigratorTest.java
          core/src/test/java/jenkins/util/xstream/XStreamDOMTest.java
          core/src/test/java/jenkins/xml/XMLUtilsTest.java
          test/src/test/java/hudson/model/AbstractItemSecurityTest.java
          test/src/test/java/hudson/model/ItemGroupMixInTest.java
          http://jenkins-ci.org/commit/jenkins/570b52dbcc4e6b2555bb8080994d30cc7228f9ca
          Log:
          JENKINS-48463 refactored XStream2 to default to KXml2Driver by default.
          Changed all explicit references of the hierarchical driver to use a static
          convinience method XStream2.getDefaultDriver() to ensure all XML operations
          are using the same driver.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: mike cirioli Path: core/src/main/java/hudson/XmlFile.java core/src/main/java/hudson/model/View.java core/src/main/java/hudson/util/XStream2.java core/src/main/java/jenkins/util/xstream/XStreamDOM.java core/src/test/java/hudson/PluginManagerTest.java core/src/test/java/hudson/util/XStream2EncodingTest.java core/src/test/java/jenkins/model/RunIdMigratorTest.java core/src/test/java/jenkins/util/xstream/XStreamDOMTest.java core/src/test/java/jenkins/xml/XMLUtilsTest.java test/src/test/java/hudson/model/AbstractItemSecurityTest.java test/src/test/java/hudson/model/ItemGroupMixInTest.java http://jenkins-ci.org/commit/jenkins/570b52dbcc4e6b2555bb8080994d30cc7228f9ca Log: JENKINS-48463 refactored XStream2 to default to KXml2Driver by default. Changed all explicit references of the hierarchical driver to use a static convinience method XStream2.getDefaultDriver() to ensure all XML operations are using the same driver.

          Code changed in jenkins
          User: mike cirioli
          Path:
          core/src/test/java/hudson/XmlFileTest.java
          core/src/test/resources/hudson/confg_1_1_with_special_chars.xml
          core/src/test/resources/hudson/config_1_0.xml
          core/src/test/resources/hudson/config_1_1.xml
          pom.xml
          test/src/test/java/hudson/XMLFileTest.java
          test/src/test/resources/hudson/XMLFileTest/canStartWithXml_1_1_ConfigsTest/config.xml
          http://jenkins-ci.org/commit/jenkins/24a1852fc2c9a74c59a25c3e0ed022e315894344
          Log:
          JENKINS-48463 Added additional unit tests for verifying xml v1.1 compatibility

          • verify can still read xml 1.0
          • verify can read xml 1.1
          • verify can read xml 1.1 with 'special' characters
          • verify that jenkins can start with a config.xml having
            <?xml version='1.1'> and special characters

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: mike cirioli Path: core/src/test/java/hudson/XmlFileTest.java core/src/test/resources/hudson/confg_1_1_with_special_chars.xml core/src/test/resources/hudson/config_1_0.xml core/src/test/resources/hudson/config_1_1.xml pom.xml test/src/test/java/hudson/XMLFileTest.java test/src/test/resources/hudson/XMLFileTest/canStartWithXml_1_1_ConfigsTest/config.xml http://jenkins-ci.org/commit/jenkins/24a1852fc2c9a74c59a25c3e0ed022e315894344 Log: JENKINS-48463 Added additional unit tests for verifying xml v1.1 compatibility verify can still read xml 1.0 verify can read xml 1.1 verify can read xml 1.1 with 'special' characters verify that jenkins can start with a config.xml having <?xml version='1.1'> and special characters

          Code changed in jenkins
          User: mike cirioli
          Path:
          core/src/test/java/hudson/XmlFileTest.java
          test/src/test/java/hudson/XMLFileTest.java
          test/src/test/resources/hudson/XMLFileTest/silentlyMigrateConfigsTest/config.xml
          http://jenkins-ci.org/commit/jenkins/b9c2148d6e53ef4c7f0f01fab591b0333b4c69f1
          Log:
          JENKINS-48463 Added a unit test that validates jenkins xml v1.0 configs
          are silently migrated to xml v1.1 as they are persisted

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: mike cirioli Path: core/src/test/java/hudson/XmlFileTest.java test/src/test/java/hudson/XMLFileTest.java test/src/test/resources/hudson/XMLFileTest/silentlyMigrateConfigsTest/config.xml http://jenkins-ci.org/commit/jenkins/b9c2148d6e53ef4c7f0f01fab591b0333b4c69f1 Log: JENKINS-48463 Added a unit test that validates jenkins xml v1.0 configs are silently migrated to xml v1.1 as they are persisted

            mikecirioli mike cirioli
            mikecirioli mike cirioli
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: