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

(fs) Files.CreateSymbolicLink failed with InternalError "Should not get here" (win)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • tbd
    • 8u5
    • core-libs
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_05"
      Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
      Java HotSpot(TM) Client VM (build 25.5-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      java.lang.InternalError: Should not get here
      at sun.nio.fs.WindowsNativeDispatcher.CreateSymbolicLink0(Native Method)
      at sun.nio.fs.WindowsNativeDispatcher.CreateSymbolicLink(Unknown Source)
      at sun.nio.fs.WindowsFileSystemProvider.createSymbolicLink(Unknown Source)
      at java.nio.file.Files.createSymbolicLink(Unknown Source)
      at org.eclipse.jgit.util.FileUtil.createSymLink(FileUtil.java:96)
      at org.eclipse.jgit.util.FS_Win32_Java7.detectSymlinkSupport(FS_Win32_Java7.java:80)
      at org.eclipse.jgit.util.FS_Win32_Java7.supportsSymlinks(FS_Win32_Java7.java:71)
      at org.eclipse.egit.core.ContainerTreeIterator$ResourceEntry.<init>(ContainerTreeIterator.java:295)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached sample code on windows platform.

      When I run it as Administrator - no problem. When I run it as user in administrator group - it doesn´t work.

      I checked the setting in temporary folder - my user has FULL Access to targed directory.

      Other informations could be found in https://bugs.eclipse.org/bugs/show_bug.cgi?id=436137
       

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Link created or some IOException about bad rights, or root cause of the problem.
      ACTUAL -
      Exception in thread "main" java.lang.InternalError: Should not get here
      at sun.nio.fs.WindowsNativeDispatcher.CreateSymbolicLink0(Native Method)


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.InternalError: Should not get here
      at sun.nio.fs.WindowsNativeDispatcher.CreateSymbolicLink0(Native Method)
      at sun.nio.fs.WindowsNativeDispatcher.CreateSymbolicLink(Unknown Source)
      at sun.nio.fs.WindowsFileSystemProvider.createSymbolicLink(Unknown Source)
      at java.nio.file.Files.createSymbolicLink(Unknown Source)
      at uu.os.samples.TestSimlink.createSymLink(TestSimlink.java:47)
      at uu.os.samples.TestSimlink.detectSymlinkSupport(TestSimlink.java:29)
      at uu.os.samples.TestSimlink.main(TestSimlink.java:19)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package uu.os.samples;

      import java.io.File;
      import java.io.IOException;
      import java.nio.file.Files;
      import java.nio.file.LinkOption;
      import java.nio.file.Path;

      public class TestSimlink {
        
        static boolean supportSymlinks = false;

        public static void main(String[] args) {

          TestSimlink tsm = new TestSimlink();
          tsm.detectSymlinkSupport();
          System.out.println("Result: " + supportSymlinks);
        }

        private void detectSymlinkSupport() {
          File tempFile = null;
          try {
            tempFile = File.createTempFile("tempsymlinktarget2", ""); //$NON-NLS-1$ //$NON-NLS-2$
            File linkName = new File(tempFile.getParentFile(), "tempsymlink2"); //$NON-NLS-1$
            createSymLink(linkName, tempFile.getPath());
            supportSymlinks = Boolean.TRUE;
            linkName.delete();
          } catch (IOException e) {
            supportSymlinks = Boolean.FALSE;
          } finally {
            if (tempFile != null)
              tempFile.delete();
          }
        }

        public static void createSymLink(File path, String target) throws IOException {
          Path nioPath = path.toPath();
          if (Files.exists(nioPath, LinkOption.NOFOLLOW_LINKS))
            Files.delete(nioPath);
          if (true)
            target = target.replace('/', '\\');
          Path nioTarget = new File(target).toPath();
          Files.createSymbolicLink(nioPath, nioTarget);
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Run java as Administrator

            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: