Java 类org.apache.hadoop.fs.PathExistsException 实例源码

项目:hadoop-oss    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-oss    文件:CommandWithDestination.java   
/**
 * If direct write is disabled ,copies the stream contents to a temporary
 * file "<target>._COPYING_". If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * if direct write is enabled , then creation temporary file is skipped.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = direct ? target : target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget, lazyPersist, direct);
    if (!direct) {
      targetFs.rename(tempTarget, target);
    }
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:hadoop    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop    文件:CommandWithDestination.java   
/**
 * Copies the stream contents to a temporary file.  If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget, lazyPersist);
    targetFs.rename(tempTarget, target);
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:aliyun-oss-hadoop-fs    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:aliyun-oss-hadoop-fs    文件:CommandWithDestination.java   
/**
 * If direct write is disabled ,copies the stream contents to a temporary
 * file "<target>._COPYING_". If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * if direct write is enabled , then creation temporary file is skipped.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = direct ? target : target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget, lazyPersist, direct);
    if (!direct) {
      targetFs.rename(tempTarget, target);
    }
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:big-c    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:big-c    文件:CommandWithDestination.java   
/**
 * Copies the stream contents to a temporary file.  If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget, lazyPersist);
    targetFs.rename(tempTarget, target);
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:CommandWithDestination.java   
/**
 * Copies the stream contents to a temporary file.  If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget, lazyPersist);
    targetFs.rename(tempTarget, target);
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:hadoop-plus    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-plus    文件:CommandWithDestination.java   
/**
 * Copies the stream contents to a temporary file.  If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget);
    targetFs.rename(tempTarget, target);
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:hops    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString())
        .withFullyQualifiedPath(dst.path.toUri().toString());
  }
  super.processArguments(args);
}
项目:hops    文件:CommandWithDestination.java   
/**
 * If direct write is disabled ,copies the stream contents to a temporary
 * file "<target>._COPYING_". If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * if direct write is enabled , then creation temporary file is skipped.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = direct ? target : target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget, lazyPersist, direct);
    if (!direct) {
      targetFs.rename(tempTarget, target);
    }
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:hops    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  String srcUri = src.fs.getUri().getScheme() + "://" +
      src.fs.getUri().getHost();
  String dstUri = target.fs.getUri().getScheme() + "://" +
      target.fs.getUri().getHost();
  if (!srcUri.equals(dstUri)) {
    throw new PathIOException(src.toString(),
        "Does not match target filesystem");
  }
  if (target.exists) {
    throw new PathExistsException(target.toString());
  }
  if (!target.fs.rename(src.path, target.path)) {
    // we have no way to know the actual error...
    throw new PathIOException(src.toString());
  }
}
项目:hadoop-TCP    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-TCP    文件:CommandWithDestination.java   
/**
 * Copies the stream contents to a temporary file.  If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget);
    targetFs.rename(tempTarget, target);
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:hardfs    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hardfs    文件:CommandWithDestination.java   
/**
 * Copies the stream contents to a temporary file.  If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget);
    targetFs.rename(tempTarget, target);
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:hadoop-on-lustre2    文件:CommandWithDestination.java   
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
  // if more than one arg, the destination must be a directory
  // if one arg, the dst must not exist or must be a directory
  if (args.size() > 1) {
    if (!dst.exists) {
      throw new PathNotFoundException(dst.toString());
    }
    if (!dst.stat.isDirectory()) {
      throw new PathIsNotDirectoryException(dst.toString());
    }
  } else if (dst.exists) {
    if (!dst.stat.isDirectory() && !overwrite) {
      throw new PathExistsException(dst.toString());
    }
  } else if (!dst.parentExists()) {
    throw new PathNotFoundException(dst.toString());
  }
  super.processArguments(args);
}
项目:hadoop-on-lustre2    文件:CommandWithDestination.java   
/**
 * Copies the stream contents to a temporary file.  If the copy is
 * successful, the temporary file will be renamed to the real path,
 * else the temporary file will be deleted.
 * @param in the input stream for the copy
 * @param target where to store the contents of the stream
 * @throws IOException if copy fails
 */ 
protected void copyStreamToTarget(InputStream in, PathData target)
throws IOException {
  if (target.exists && (target.stat.isDirectory() || !overwrite)) {
    throw new PathExistsException(target.toString());
  }
  TargetFileSystem targetFs = new TargetFileSystem(target.fs);
  try {
    PathData tempTarget = target.suffix("._COPYING_");
    targetFs.setWriteChecksum(writeChecksum);
    targetFs.writeStreamToFile(in, tempTarget);
    targetFs.rename(tempTarget, target);
  } finally {
    targetFs.close(); // last ditch effort to ensure temp file is removed
  }
}
项目:hadoop-oss    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  // unlike copy, don't merge existing dirs during move
  if (target.exists && target.stat.isDirectory()) {
    throw new PathExistsException(target.toString());
  }
  super.processPath(src, target);
}
项目:hadoop-oss    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  if (!src.fs.getUri().equals(target.fs.getUri())) {
    throw new PathIOException(src.toString(),
        "Does not match target filesystem");
  }
  if (target.exists) {
    throw new PathExistsException(target.toString());
  }
  if (!target.fs.rename(src.path, target.path)) {
    // we have no way to know the actual error...
    throw new PathIOException(src.toString());
  }
}
项目:hadoop-oss    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
项目:hadoop    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  // unlike copy, don't merge existing dirs during move
  if (target.exists && target.stat.isDirectory()) {
    throw new PathExistsException(target.toString());
  }
  super.processPath(src, target);
}
项目:hadoop    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  if (!src.fs.getUri().equals(target.fs.getUri())) {
    throw new PathIOException(src.toString(),
        "Does not match target filesystem");
  }
  if (target.exists) {
    throw new PathExistsException(target.toString());
  }
  if (!target.fs.rename(src.path, target.path)) {
    // we have no way to know the actual error...
    throw new PathIOException(src.toString());
  }
}
项目:hadoop    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
项目:aliyun-oss-hadoop-fs    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  // unlike copy, don't merge existing dirs during move
  if (target.exists && target.stat.isDirectory()) {
    throw new PathExistsException(target.toString());
  }
  super.processPath(src, target);
}
项目:aliyun-oss-hadoop-fs    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  if (!src.fs.getUri().equals(target.fs.getUri())) {
    throw new PathIOException(src.toString(),
        "Does not match target filesystem");
  }
  if (target.exists) {
    throw new PathExistsException(target.toString());
  }
  if (!target.fs.rename(src.path, target.path)) {
    // we have no way to know the actual error...
    throw new PathIOException(src.toString());
  }
}
项目:aliyun-oss-hadoop-fs    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
项目:big-c    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  // unlike copy, don't merge existing dirs during move
  if (target.exists && target.stat.isDirectory()) {
    throw new PathExistsException(target.toString());
  }
  super.processPath(src, target);
}
项目:big-c    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  if (!src.fs.getUri().equals(target.fs.getUri())) {
    throw new PathIOException(src.toString(),
        "Does not match target filesystem");
  }
  if (target.exists) {
    throw new PathExistsException(target.toString());
  }
  if (!target.fs.rename(src.path, target.path)) {
    // we have no way to know the actual error...
    throw new PathIOException(src.toString());
  }
}
项目:big-c    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  // unlike copy, don't merge existing dirs during move
  if (target.exists && target.stat.isDirectory()) {
    throw new PathExistsException(target.toString());
  }
  super.processPath(src, target);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  if (!src.fs.getUri().equals(target.fs.getUri())) {
    throw new PathIOException(src.toString(),
        "Does not match target filesystem");
  }
  if (target.exists) {
    throw new PathExistsException(target.toString());
  }
  if (!target.fs.rename(src.path, target.path)) {
    // we have no way to know the actual error...
    throw new PathIOException(src.toString());
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
项目:hadoop-plus    文件:MoveCommands.java   
@Override
protected void processPath(PathData src, PathData target) throws IOException {
  // unlike copy, don't merge existing dirs during move
  if (target.exists && target.stat.isDirectory()) {
    throw new PathExistsException(target.toString());
  }
  super.processPath(src, target);
}
项目:hadoop-plus    文件:Mkdir.java   
@Override
protected void processPath(PathData item) throws IOException {
  if (item.stat.isDirectory()) {
    if (!createParents) {
      throw new PathExistsException(item.toString());
    }
  } else {
    throw new PathIsNotDirectoryException(item.toString());
  }
}
项目:ignite    文件:HadoopIgfsSecondaryFileSystemDelegateImpl.java   
/**
 * Cast IO exception to IGFS exception.
 *
 * @param msg Error message.
 * @param e IO exception.
 * @return IGFS exception.
 */
public static IgfsException cast(String msg, IOException e) {
    if (e instanceof FileNotFoundException)
        return new IgfsPathNotFoundException(e);
    else if (e instanceof ParentNotDirectoryException)
        return new IgfsParentNotDirectoryException(msg, e);
    else if (e instanceof PathIsNotEmptyDirectoryException)
        return new IgfsDirectoryNotEmptyException(e);
    else if (e instanceof PathExistsException)
        return new IgfsPathAlreadyExistsException(msg, e);
    else
        return new IgfsException(msg, e);
}
项目:ignite    文件:HadoopIgfs20FileSystemAbstractSelfTest.java   
/** @throws Exception If failed. */
public void testCreateCheckOverwrite() throws Exception {
    Path fsHome = new Path(primaryFsUri);
    Path dir = new Path(fsHome, "/someDir1/someDir2/someDir3");
    final Path file = new Path(dir, "someFile");

    FSDataOutputStream out = fs.create(file, EnumSet.noneOf(CreateFlag.class),
        Options.CreateOpts.perms(FsPermission.getDefault()));

    out.close();

    // Check intermediate directory permissions.
    assertEquals(FsPermission.getDefault(), fs.getFileStatus(dir).getPermission());
    assertEquals(FsPermission.getDefault(), fs.getFileStatus(dir.getParent()).getPermission());
    assertEquals(FsPermission.getDefault(), fs.getFileStatus(dir.getParent().getParent()).getPermission());

    GridTestUtils.assertThrows(log, new Callable<Object>() {
        @Override public Object call() throws Exception {
            return fs.create(file, EnumSet.noneOf(CreateFlag.class),
                Options.CreateOpts.perms(FsPermission.getDefault()));
        }
    }, PathExistsException.class, null);

    // Overwrite should be successful.
    FSDataOutputStream out1 = fs.create(file, EnumSet.of(CreateFlag.OVERWRITE),
        Options.CreateOpts.perms(FsPermission.getDefault()));

    out1.close();
}