List of usage examples for org.apache.hadoop.fs PathExistsException PathExistsException
public PathExistsException(String path)
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 a v a 2 s . 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(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 w w . j ava 2s. com*/ * @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./*from w w w . java 2 s . c o m*/ * @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); }