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

Git plugin uses default encoding to read change log file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      Windows Server 2003 R2, Cygwin 1.7.2, git 1.7.0.4, Hudson 1.353, GIT plugin 0.8.2
    • Similar Issues:

      Description

      [Problem]
      When we look at changes, commit log is garbled.

      [Cause]
      Git assumes that commit log is written by utf-8, if we don't set "i18n.commitencoding" property.

      hudson.plugins.git.GitChangeLogParser class uses java.io.FileReader class at 27.
      java.io.FileReader class uses the default character encoding to read file.
      Japanese version of Windows uses "MS932" as default character encoding.

      So we run hudson on it, commit log is garbled.

      [Solution]
      use java.io.FileInputStream and java.io.InputStreamReader classes instead of java.io.FileReader class.
      java.io.InputStreamReader class has a constructor that is able to set the encoding.

      [Example]
      BufferedReader rdr = null;
      try {
      // fetch encoding out of configuration
      rdr = new BufferedReader(new InputStreamReader(new FileInputStream(changelogFile), encoding));
      /* ... */
      } finally {
      // close rdr whether constructors throw exception or not
      if (rdr != null) rdr.close();
      }

        Attachments

          Issue Links

            Activity

            bleis bleis created issue -
            sogabe sogabe made changes -
            Field Original Value New Value
            Assignee magnayn [ magnayn ]
            abayer Andrew Bayer made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            adept Anton Smirnov made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            adept Anton Smirnov made changes -
            Assignee magnayn [ magnayn ] Anton Smirnov [ adept ]
            adept Anton Smirnov made changes -
            Resolution Not A Defect [ 7 ]
            Status Reopened [ 4 ] Resolved [ 5 ]
            adept Anton Smirnov made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            shadowcat Dmitry Salashnik made changes -
            Assignee Anton Smirnov [ adept ] Dmitry Salashnik [ shadowcat ]
            Resolution Not A Defect [ 7 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            shadowcat Dmitry Salashnik made changes -
            Assignee Dmitry Salashnik [ shadowcat ] abayer [ abayer ]
            ndeloof Nicolas De Loof made changes -
            Assignee abayer [ abayer ] Nicolas De Loof [ ndeloof ]
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Resolved [ 5 ]
            mr_const Konst Kolesnichenko made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            eratolekov Era Tolekov made changes -
            Link This issue is related to JENKINS-23091 [ JENKINS-23091 ]
            markewaite Mark Waite made changes -
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Resolved [ 5 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 136296 ] JNJira + In-Review [ 187164 ]
            markewaite Mark Waite made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              People

              Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              bleis bleis
              Votes:
              10 Vote for this issue
              Watchers:
              22 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: