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

StringIndexOutOfBoundsException when running external jobs that output non-ASCII characters

XMLWordPrintable

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

      When running an external job through "java jar .../hudson-core*.jar jobname
      job.sh", I get a StringIndexOutOfBoundsException if the external program
      outputs non-ASCII characters:

      Exception in thread "/backup/rundar asimov asimov-home: stdout copier"
      java.lang.StringIndexOutOfBoundsException: String index out of range: -3
      at java.lang.String.charAt(String.java:686)
      at hudson.util.EncodingStream.write(EncodingStream.java:45)
      at java.io.FilterOutputStream.write(FilterOutputStream.java:108)
      at hudson.util.DualOutputStream.write(DualOutputStream.java:54)
      at hudson.util.StreamCopyThread.run(StreamCopyThread.java:58)

      I assume this is caused by the following code in EncodingStream.java (b will
      probably be larger than 255 for non-ASCII characters):

      public void write(int b) throws IOException

      { out.write(chars.charAt(b/16)); out.write(chars.charAt(b%16)); }

      private static final String chars = "0123456789ABCDEF";

            mindless Alan Harder
            rickynils rickynils
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: