HADOOP-12856. FileUtil.checkDest() and RawLocalFileSystem.mkdirs() to throw stricter IOEs; RawLocalFS contract tests to verify. Contributed by Steve Loughran
This commit is contained in:
parent
475f933b41
commit
d11d280b8b
|
@ -492,11 +492,12 @@ public class FileUtil {
|
|||
if (null != sdst) {
|
||||
if (sdst.isDirectory()) {
|
||||
if (null == srcName) {
|
||||
throw new IOException("Target " + dst + " is a directory");
|
||||
throw new PathIsDirectoryException(dst.toString());
|
||||
}
|
||||
return checkDest(null, dstFS, new Path(dst, srcName), overwrite);
|
||||
} else if (!overwrite) {
|
||||
throw new IOException("Target " + dst + " already exists");
|
||||
throw new PathExistsException(dst.toString(),
|
||||
"Target " + dst + " already exists");
|
||||
}
|
||||
}
|
||||
return dst;
|
||||
|
|
|
@ -552,7 +552,7 @@ public class RawLocalFileSystem extends FileSystem {
|
|||
}
|
||||
}
|
||||
if (p2f.exists() && !p2f.isDirectory()) {
|
||||
throw new FileNotFoundException("Destination exists" +
|
||||
throw new FileAlreadyExistsException("Destination exists" +
|
||||
" and is not a directory: " + p2f.getCanonicalPath());
|
||||
}
|
||||
return (parent == null || parent2f.exists() || mkdirs(parent)) &&
|
||||
|
|
|
@ -34,7 +34,7 @@ public class RawlocalFSContract extends LocalFSContract {
|
|||
super(conf);
|
||||
}
|
||||
|
||||
public static final String RAW_CONTRACT_XML = "contract/localfs.xml";
|
||||
public static final String RAW_CONTRACT_XML = "contract/rawlocal.xml";
|
||||
|
||||
@Override
|
||||
protected String getContractXml() {
|
||||
|
|
|
@ -17,10 +17,24 @@
|
|||
-->
|
||||
|
||||
<configuration>
|
||||
|
||||
<!--
|
||||
Here are most of the local FS contract options.
|
||||
some of them may be overridden at run time based on the OS,
|
||||
others potentially generated.
|
||||
case sensitivity and permission options are determined at run time from OS type
|
||||
-->
|
||||
|
||||
<property>
|
||||
<name>fs.contract.is-case-sensitive</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
|
||||
<property>
|
||||
<name>fs.contract.supports-unix-permissions</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
<!--
|
||||
The remaining options are static
|
||||
-->
|
||||
|
||||
<property>
|
||||
|
@ -33,11 +47,6 @@
|
|||
<value>1000</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.contract.is-case-sensitive</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.contract.supports-append</name>
|
||||
<value>true</value>
|
||||
|
@ -73,6 +82,11 @@
|
|||
<value>true</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.contract.rename-remove-dest-if-empty-dir</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.contract.supports-seek</name>
|
||||
<value>true</value>
|
||||
|
|
Loading…
Reference in New Issue