List of usage examples for org.apache.hadoop.fs ParentNotDirectoryException ParentNotDirectoryException
public ParentNotDirectoryException(String msg)
From source file:com.aliyun.odps.fs.VolumeFileSystem.java
License:Apache License
private IOException wrapExceptions(String path, VolumeException e) { if (VolumeFSErrorCode.NoSuchPath.equalsIgnoreCase(e.getErrCode())) { return new FileNotFoundException(VolumeFSErrorMessageGenerator.noSuchFileOrDirectory(path)); }//ww w.j a v a 2 s . c o m if (VolumeFSErrorCode.InvalidPath.equalsIgnoreCase(e.getErrCode())) { throw new IllegalArgumentException(VolumeFSErrorMessageGenerator.isNotAValidODPSVolumeFSFilename(path)); } if (VolumeFSErrorCode.NotAcceptableOperation.equalsIgnoreCase(e.getErrCode())) { throw new UnsupportedOperationException(e.getMessage()); } if (VolumeFSErrorCode.PathAlreadyExists.equalsIgnoreCase(e.getErrCode())) { return new FileAlreadyExistsException(e.getMessage()); } if (VolumeFSErrorCode.ParentNotDirectory.equalsIgnoreCase(e.getErrCode())) { return new ParentNotDirectoryException(e.getMessage()); } else { return new IOException(e.getMessage(), e); } }
From source file:org.apache.ignite.internal.igfs.hadoop.IgfsHadoopUtils.java
License:Apache License
/** * Cast GG exception to appropriate IO exception. * * @param e Exception to cast./*from ww w . j ava 2 s. c om*/ * @param path Path for exceptions. * @return Casted exception. */ @SuppressWarnings("unchecked") public static IOException cast(IgniteCheckedException e, @Nullable String path) { assert e != null; // First check for any nested IOException; if exists - re-throw it. if (e.hasCause(IOException.class)) return e.getCause(IOException.class); else if (e.hasCause(IgfsFileNotFoundException.class)) return new FileNotFoundException(path); // TODO: Or PathNotFoundException? else if (e.hasCause(IgfsParentNotDirectoryException.class)) return new ParentNotDirectoryException(path); else if (path != null && e.hasCause(IgfsDirectoryNotEmptyException.class)) return new PathIsNotEmptyDirectoryException(path); else if (path != null && e.hasCause(IgfsPathAlreadyExistsException.class)) return new PathExistsException(path); else return new IOException(e); }
From source file:org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsUtils.java
License:Apache License
/** * Cast Ignite exception to appropriate IO exception. * * @param e Exception to cast./* w ww.j a v a 2s . co m*/ * @param path Path for exceptions. * @return Casted exception. */ @SuppressWarnings("unchecked") public static IOException cast(IgniteCheckedException e, @Nullable String path) { assert e != null; // First check for any nested IOException; if exists - re-throw it. if (e.hasCause(IOException.class)) return e.getCause(IOException.class); else if (e.hasCause(IgfsPathNotFoundException.class)) return new FileNotFoundException(path); // TODO: Or PathNotFoundException? else if (e.hasCause(IgfsParentNotDirectoryException.class)) return new ParentNotDirectoryException(path); else if (path != null && e.hasCause(IgfsDirectoryNotEmptyException.class)) return new PathIsNotEmptyDirectoryException(path); else if (path != null && e.hasCause(IgfsPathAlreadyExistsException.class)) return new PathExistsException(path); else { String msg = e.getMessage(); return msg == null ? new IOException(e) : new IOException(msg, e); } }
From source file:org.gridgain.grid.kernal.ggfs.hadoop.GridGgfsHadoopUtils.java
License:Open Source License
/** * Cast GG exception to appropriate IO exception. * * @param e Exception to cast./* w w w .j av a 2 s. c om*/ * @param path Path for exceptions. * @return Casted exception. */ @SuppressWarnings("unchecked") public static IOException cast(GridException e, @Nullable String path) { assert e != null; // First check for any nested IOException; if exists - re-throw it. if (e.hasCause(IOException.class)) return e.getCause(IOException.class); else if (e instanceof GridGgfsFileNotFoundException) return new FileNotFoundException(path); // TODO: Or PathNotFoundException? else if (e instanceof GridGgfsParentNotDirectoryException) return new ParentNotDirectoryException(path); else if (path != null && e instanceof GridGgfsDirectoryNotEmptyException) return new PathIsNotEmptyDirectoryException(path); else if (path != null && e instanceof GridGgfsPathAlreadyExistsException) return new PathExistsException(path); else return new IOException(e); }