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

GET .../config.xml -> 500 ("Failed to detect encoding") during hpi:run

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Platform: All, OS: All

      2009-09-22 16:54:51.519:/:WARN: Error while serving
      http://localhost:8080/job/hgtest/config.xml
      ...
      Caused by: java.io.IOException: Failed to detect encoding of
      /space/src/hudson/trunk/plugins/mercurial/./work/jobs/hgtest/config.xml
      at hudson.XmlFile.sniffEncoding(XmlFile.java:264)
      at hudson.XmlFile.readRaw(XmlFile.java:192)
      at hudson.XmlFile.writeRawTo(XmlFile.java:209)
      at hudson.model.Job.doConfigDotXml(Job.java:969)
      ...

      The file starts:

      <?xml version='1.0' encoding='UTF-8'?>
      <project>

      so I'm not sure what's wrong. Hudson 1.323.

      Anyway why is Hudson trying to find the file's encoding, reading it in a Reader,
      then writing it to a Writer from the servlet output which is set to UTF-8?
      Wouldn't it be simpler to just set content type to application/xml with no
      specified encoding and copy the file as a bytestream from disk? Then
      XmlFile.sniffEncoding, .readRaw, .writeRawTo, and .asString could all be deleted.

      XmlFile.read and .marshal also look suspicious. Why are they assuming UTF-8
      encoding and making a Reader? XStream accepts an InputStream, which would be
      easier and I presume safer.

            Unassigned Unassigned
            jglick Jesse Glick
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: