Uploaded image for project: 'Metron'
  1. Metron
  2. METRON-614

Eliminate use of the default Charset

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Done
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: Next + 1
    • Labels:
      None

      Description

      During work on METRON-612, I noticed a lot of our warnings are from implicit use of the default Charset (e.g. when creating InputStreamReaders). Given that this value is platform dependent, we should at least consider explicitly using a particular Charset.

      In addition, after fixing this, I would like to see it upgraded to a compile error, because in my experience almost everyone tends to use methods that use the implicit default Charset. This can be done by changing the compiler arg in the pom to instead be

      <compilerArgs>
        <arg>-Xlint:unchecked</arg>
        <arg>-Xep:DefaultCharset:ERROR</arg>
      </compilerArgs>
      

      My assumption is that we'll want UTF-8, but given a lack of expertise and that usually there's a lot of opinions on character set issues, we may want to consider other options.

      http://errorprone.info/bugpattern/DefaultCharset
      https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html lists standard Charsets and provides more details.

      Charset	Description
      US-ASCII	Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set
      ISO-8859-1  	ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
      UTF-8	Eight-bit UCS Transformation Format
      UTF-16BE	Sixteen-bit UCS Transformation Format, big-endian byte order
      UTF-16LE	Sixteen-bit UCS Transformation Format, little-endian byte order
      UTF-16	Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                justinleet Justin Leet
                Reporter:
                justinleet Justin Leet
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 8h 40m
                  8h 40m