Uploaded image for project: 'Maven Changes Plugin'
  1. Maven Changes Plugin
  2. MCHANGES-236

Configured outputEncoding not used for writing changes-report.html file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4
    • 2.5
    • changes.xml
    • None
    • found on mac OS
    • Patch

    Description

      Writing Java Strings to changes-report.html file ignores outputEncoding and uses system default encoding instead.

      Details:
      org/apache/maven/plugin/changes/AbstractChangesReport.java uses a FileWriter, which uses the default encoding of the environment instead of the configured output encoding for writing strings to the file.
      This creates some problems with german umlaut characters on my mac for example, because the environment default is not utf-8 but mac-OS roman.
      The content type header of the html file claims utf-8, thus some characters are invalid.

      This may also be related to MCHANGES-168, where there is a problem with greek characters.

      From the javadoc of FileWriter :

      • Convenience class for writing character files. The constructors of this
      • class assume that the default character encoding and the default byte-buffer
      • size are acceptable. To specify these values yourself, construct an
      • OutputStreamWriter on a FileOutputStream.

      To Reproduce, run the changes plugin with the changes.xml file under src/test/unit with a german locale on a german mac with current java-developer package. Opening this file in safari leads to the attached result.

      Supposed Fix: use the specified output Encoding also for writing to the file

      change line 188 : from

      Writer writer = new FileWriter( new File( outputDirectory, getOutputName() + ".html" ) );

      To

      File file = new File(outputDirectory, getOutputName() + ".html");
      Writer writer = new OutputStreamWriter(new FileOutputStream(file), getOutputEncoding());

      That worked fine on mac and linux.

      Attachments

        1. systemProperties.txt
          3 kB
          Oliver Schmitz-Hennemann
        2. changes-encoding-patch.txt
          1 kB
          Oliver Schmitz-Hennemann
        3. Bildschirmfoto 2011-04-20 um 11.16.01.png
          41 kB
          Oliver Schmitz-Hennemann

        Activity

          People

            dennisl@apache.org Dennis Lundberg
            oli99sc Oliver Schmitz-Hennemann
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: