Community
Participate
Working Groups
In Windows when cloning to a network folder location, DirCacheCheckout can under certain circumstances throw an exception because of the way it constructs temp files. We have encountered network folders on Windows where files that start with the . character are being reported as hidden by java.io.File. When this happens DirCacheCheckout's checkoutEntry method will always throw an exception because the temp file that is created starts with a . character and new FileOutputStream(tmpFile) throws an exception when called on a hidden file (http://bugs.java.com/view_bug.do?bug_id=6401006). I would like to suggest two possible fixes that can be made to DirCacheCheckout to fix this problem. (https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java) tmpFile could be made to not start with a . character: File tmpFile = File.createTempFile( "._" + name, null, parentDir); //$NON-NLS-1$ becomes something like File tmpFile = File.createTempFile( "x_" + name, null, parentDir); //$NON-NLS-1$ As this file is a new temp file, another possibility would be to create the FileOutputStream of tmpFile using the append true flag. Unlike the default constructor, this way of constructing the FileOutputStream will not result in an exception being thrown even if the file is hidden. try (OutputStream channel = EolStreamTypeUtil.wrapOutputStream( new FileOutputStream(tmpFile), nonNullEolStreamType)) { could be changed to try (OutputStream channel = EolStreamTypeUtil.wrapOutputStream( new FileOutputStream(tmpFile, true), nonNullEolStreamType)) {