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

java/lang/ProcessHandle/InfoTest.java fails on Windows when run as user with Administrator privileges

XMLWordPrintable

    • b14
    • windows

        The test java/lang/ProcessHandle/InfoTest.java can fail when run on Windows as user which is in the Administrators group.

        The test checks whether the child Process user as returned by the Process Handle matches the current user. It determines the current user by creating a file and reading its owner. However, in Windows, when a user belongs to the administrators group and runs elevated, the owner of a new file is "BUILTIN\Administrators", so it is not possible to determine the current user correctly in this way.

        The test failure will look like:

        test InfoTest.test2(): failure
        java.lang.AssertionError: User name expected [BUILTIN\\Administrators] but found [<MYDOMAIN>\\<MYUSER>]
        at org.testng.Assert.fail(Assert.java:99)
        at org.testng.Assert.failNotEquals(Assert.java:1037)
        at org.testng.Assert.assertEqualsImpl(Assert.java:140)
        at org.testng.Assert.assertEquals(Assert.java:122)
        at org.testng.Assert.assertEquals(Assert.java:629)
        at InfoTest.test2(InfoTest.java:166)

              clanger Christoph Langer
              clanger Christoph Langer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: