diff options
author | Nail Samatov <sanail@yandex.ru> | 2019-08-15 20:15:40 +0300 |
---|---|---|
committer | Nail Samatov <sanail@yandex.ru> | 2019-08-23 20:38:26 +0300 |
commit | b9d2926df44a47116d2b0f56a16fc1b39e466dc2 (patch) | |
tree | 7ff99e69c1b55c19f96adc321d7305863efe3ff1 /org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java | |
parent | 2d0f1c1dc11fd445d3137b1f2fa49f88bbd48bb5 (diff) | |
download | jgit-b9d2926df44a47116d2b0f56a16fc1b39e466dc2.tar.gz jgit-b9d2926df44a47116d2b0f56a16fc1b39e466dc2.zip |
Fix error occurring when SecurityManager is enabled
It's expected that jgit should work without native git installation.
In such case Security Manager can be configured to deny access to the
files outside of git repository. JGit tries to find cygwin
installation. If Security manager restricts access to some folders
in PATH, it should be considered that those folders are absent
for jgit.
Also JGit tries to detect if symbolic links are supported by OS. If
security manager forbids creation of symlinks, it should be assumed
that symlinks aren't supported.
Bug: 550115
Change-Id: Ic4b243cada604bc1090db6cc1cfd74f0fa324b98
Signed-off-by: Nail Samatov <sanail@yandex.ru>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java index 7fe80bb21a..1e64a38bb1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java @@ -74,8 +74,6 @@ import org.slf4j.LoggerFactory; public class FS_Win32 extends FS { private final static Logger LOG = LoggerFactory.getLogger(FS_Win32.class); - private volatile Boolean supportSymlinks; - /** * Constructor */ @@ -239,37 +237,6 @@ public class FS_Win32 extends FS { /** {@inheritDoc} */ @Override - public boolean supportsSymlinks() { - if (supportSymlinks == null) { - detectSymlinkSupport(); - } - return Boolean.TRUE.equals(supportSymlinks); - } - - private void detectSymlinkSupport() { - File tempFile = null; - try { - tempFile = File.createTempFile("tempsymlinktarget", ""); //$NON-NLS-1$ //$NON-NLS-2$ - File linkName = new File(tempFile.getParentFile(), "tempsymlink"); //$NON-NLS-1$ - createSymLink(linkName, tempFile.getPath()); - supportSymlinks = Boolean.TRUE; - linkName.delete(); - } catch (IOException | UnsupportedOperationException - | InternalError e) { - supportSymlinks = Boolean.FALSE; - } finally { - if (tempFile != null) { - try { - FileUtils.delete(tempFile); - } catch (IOException e) { - throw new RuntimeException(e); // panic - } - } - } - } - - /** {@inheritDoc} */ - @Override public Attributes getAttributes(File path) { return FileUtils.getFileAttributesBasic(this, path); } |