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

TEST_BUG: java/nio/file/Files/StreamTest.java fails when sym links not supported

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 8
    • core-libs
    • b94
    • Verified

    Description


      This test has been failing on some Windows machines since it was pushed.

      In testSecurityException is has:

                  try (CloseableStream<Path> s = Files.list(fakeRoot.resolve("dir"))) {
                      String[] result = s.map(path -> path.getFileName().toString())
                                         .toArray(String[]::new);
                      assertEqualsNoOrder(result, new String[] { "d1","f1", "lnDir2", "SecurityException", "sample" });
                  }

      but this assumes that lnDir2 is one of the entries. This is not the case when sym links aren't supported.

      While fixing this test then we should also consider cleaning up many of the Paths.get and resolve usages, eg:

              Path triggerFile = testFolder.resolve(Paths.get("dir", "SecurityException"));
              Files.createFile(triggerFile);
              Path sampleFile = testFolder.resolve(Paths.get("dir", "sample"));
              Files.createFile(sampleFile);

      can be changed to:

              Path dir = Paths.get("dir");
              Path triggerFile = Files.createFile(dir.resolve("SecurityException"));
              Path sampleFile = Files.createFile(dir.resolve("sample"));


      --------------------------------------------------
      TEST: java/nio/file/Files/StreamTest.java
      JDK under test: (C:\jprt\T\P1\113150~1.ALB\TESTPR~1\WINDOW~1.2-P)
      java version "1.8.0-internal"
      Java(TM) SE Runtime Environment (build 1.8.0-internal-jprtadm_2013_05_19_04_54-b00)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b31, mixed mode)



      ACTION: build -- Passed. Build successful
      REASON: User specified action: run build PassThroughFileSystem FaultyFileSystem
      TIME: 0.124 seconds
      messages:
      command: build PassThroughFileSystem FaultyFileSystem
      reason: User specified action: run build PassThroughFileSystem FaultyFileSystem
      elapsed time (seconds): 0.124

      ACTION: compile -- Passed. Compilation successful
      REASON: .class file out of date or does not exist
      TIME: 0.124 seconds
      messages:
      command: compile -XDignore.symbol.file=true C:\jprt\T\P1\113150.albatem\s\jdk\test\java\nio\file\Files\FaultyFileSystem.java
      reason: .class file out of date or does not exist
      elapsed time (seconds): 0.124

      ACTION: build -- Passed. Build successful
      REASON: Named class compiled on demand
      TIME: 0.281 seconds
      messages:
      command: build StreamTest
      reason: Named class compiled on demand
      elapsed time (seconds): 0.281

      ACTION: compile -- Passed. Compilation successful
      REASON: .class file out of date or does not exist
      TIME: 0.281 seconds
      messages:
      command: compile -XDignore.symbol.file=true C:\jprt\T\P1\113150.albatem\s\jdk\test\java\nio\file\Files\StreamTest.java
      reason: .class file out of date or does not exist
      elapsed time (seconds): 0.281

      ACTION: testng -- Failed. Execution failed: `main' threw exception: java.lang.Exception: failures: 1
      REASON: User specified action: run testng StreamTest
      TIME: 0.312 seconds
      messages:
      command: testng StreamTest
      reason: User specified action: run testng StreamTest
      elapsed time (seconds): 0.312
      STDOUT:
      [TestNG] Running:
        java/nio/file/Files/StreamTest.java

      config void StreamTest.setupTestFolder() throws java.io.IOException: success
      test public void StreamTest.testBasic(): success
      test public void StreamTest.testClosedStream() throws java.io.IOException: success
      test public void StreamTest.testConstructException(): success
      test public void StreamTest.testDirectoryIteratorException() throws java.io.IOException: success
      test public void StreamTest.testFind() throws java.io.IOException: success
      test public void StreamTest.testLines() throws java.io.IOException: success
      test public void StreamTest.testSecurityException() throws java.io.IOException: failure
      java.lang.AssertionError: Arrays do not have the same size:4 != 5
      at org.testng.Assert.fail(Assert.java:89)
      at org.testng.Assert.failAssertNoEqual(Assert.java:612)
      at org.testng.Assert.assertEqualsNoOrder(Assert.java:589)
      at org.testng.Assert.assertEqualsNoOrder(Assert.java:634)
      at StreamTest.testSecurityException(StreamTest.java:498)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:491)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:715)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:907)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1237)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      at org.testng.TestRunner.privateRun(TestRunner.java:767)
      at org.testng.TestRunner.run(TestRunner.java:617)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:51)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:85)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1197)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1122)
      at org.testng.TestNG.run(TestNG.java:1030)
      at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:155)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:491)
      at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:728)
      at java.lang.Thread.run(Thread.java:724)
      test public void StreamTest.testUncheckedIOException() throws java.io.IOException: success
      test public void StreamTest.testWalk(): success
      test public void StreamTest.testWalkFollowLink(): success
      test public void StreamTest.testWalkFollowLinkLoop(): success
      test public void StreamTest.testWalkOneLevel(): success
      config void StreamTest.cleanupTestFolder() throws java.io.IOException: success

      ===============================================
      java/nio/file/Files/StreamTest.java
      Total tests run: 12, Failures: 1, Skips: 0
      ===============================================

      STDERR:
      java.nio.file.NoSuchFileException: C:\jprt\T\P1\113150.albatem\io\windows_x64-product-c2-jdk_nio\name2361705136379712065\notExist
      at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
      at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
      at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
      at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
      at java.nio.file.Files.newByteChannel(Files.java:322)
      at java.nio.file.Files.newByteChannel(Files.java:368)
      at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:382)
      at java.nio.file.Files.newInputStream(Files.java:113)
      at java.nio.file.Files.newBufferedReader(Files.java:2724)
      at java.nio.file.Files.lines(Files.java:3513)
      at StreamTest.testConstructException(StreamTest.java:589)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:491)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:715)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:907)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1237)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      at org.testng.TestRunner.privateRun(TestRunner.java:767)
      at org.testng.TestRunner.run(TestRunner.java:617)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:51)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:85)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1197)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1122)
      at org.testng.TestNG.run(TestNG.java:1030)
      at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:155)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:491)
      at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:728)
      at java.lang.Thread.run(Thread.java:724)
      java.lang.Exception: failures: 1
      at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:158)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:491)
      at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:728)
      at java.lang.Thread.run(Thread.java:724)

      JavaTest Message: Test threw exception: java.lang.Exception
      JavaTest Message: shutting down test


      TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.Exception: failures: 1
      --------------------------------------------------

      Attachments

        Activity

          People

            henryjen Henry Jen
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: