提交 b99aea62 authored 作者: Thomas Mueller's avatar Thomas Mueller

Slightly simplified code, link to root cause

上级 46538a69
...@@ -272,29 +272,27 @@ public class FileSystemDisk extends FileSystem { ...@@ -272,29 +272,27 @@ public class FileSystemDisk extends FileSystem {
} }
private boolean canWriteInternal(File file) { private boolean canWriteInternal(File file) {
if (file.canWrite()) { if (!file.canWrite()) {
// Does not respect windows user permissions, return false;
// so we must try to open it mode "rw". }
// File.canWrite() does not respect windows user permissions,
// so we must try to open it using the mode "rw".
// See also http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4420020 // See also http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4420020
RandomAccessFile randomAccessFile = null; RandomAccessFile r = null;
try { try {
randomAccessFile = new RandomAccessFile(file, "rw"); r = new RandomAccessFile(file, "rw");
return true;
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
return false; return false;
} finally { } finally {
if (randomAccessFile != null) { if (r != null) {
try { try {
randomAccessFile.close(); r.close();
} catch (Exception e) { } catch (IOException e) {
// ignore // ignore
} }
} }
} }
return true;
} else {
return false;
}
} }
public void copy(String original, String copy) throws SQLException { public void copy(String original, String copy) throws SQLException {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论