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

Use unsigned random long in a temp directory name

    Details

    • Subcomponent:
    • Resolved In Build:
      b144
    • Verification:
      Not verified

      Description

      When File.createTempFile() is called, a random long value is generated, which is then made positive with Math.abs() and then used as a part of the directory name.

      Instead, it would be better to use Long.toUnsignedString():
      1) no need to deal with the corner case Long.MIN_VALUE,
      2) increase the space of random values by the factor of 2.

        Activity

        Hide
        alanb Alan Bateman added a comment -
        The code in java.io.File predates toUnsignedString. Worth changing but low priority.
        Show
        alanb Alan Bateman added a comment - The code in java.io.File predates toUnsignedString. Worth changing but low priority.
        Hide
        hgupdate HG Updates added a comment -
        URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/0fa4b5647f3e
        User: igerasim
        Date: 2016-11-02 15:46:40 +0000
        Show
        hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/0fa4b5647f3e User: igerasim Date: 2016-11-02 15:46:40 +0000
        Hide
        hgupdate HG Updates added a comment -
        URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/0fa4b5647f3e
        User: lana
        Date: 2016-11-09 22:58:42 +0000
        Show
        hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/0fa4b5647f3e User: lana Date: 2016-11-09 22:58:42 +0000

          People

          • Assignee:
            igerasim Ivan Gerasimov
            Reporter:
            igerasim Ivan Gerasimov
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: