Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8301332

[8u] Fix writing of test files after the cgroups v2 backport

XMLWordPrintable

    • b02
    • generic
    • linux

      During the 8u backport review of JDK-8287107 this came up. Andrew Hughes pointed out that:

      [...] it should be Files.writeString(a, b) => Files.write(a, b.getBytes(StandardCharsets.UTF_8)) rather than Files.writeString(a, b) => Files.write(a, b.getBytes()). Files.writeString(a,b) is a shorthand for Files.writeString(a, b, StandardCharsets.UTF_8), while getBytes() with no arguments will use the platform default character set. This could lead to different behaviour with the default character set is not ASCII or UTF-8.

      There are at least 50 occurrences of this pattern in test code:

      $ grep -rn 'Files.write(' jdk/test/jdk/internal/platform/ hotspot/test/runtime/containers/ | grep 'getBytes()' | wc -l
      50

      We should fix this in one sweep.

            sgehwolf Severin Gehwolf
            sgehwolf Severin Gehwolf
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: