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

Use unsigned random long in a temp directory name

XMLWordPrintable

    • b144
    • Not verified

      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.

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

              Created:
              Updated:
              Resolved: