Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.PathIOException


      if (item.stat.isDirectory()) {
        // TODO: handle this
        throw new PathIsDirectoryException(item.toString());
      }
      if (item.stat.getLen() != 0) {
        throw new PathIOException(item.toString(), "Not a zero-length file");
      }
      touchz(item);
    }
View Full Code Here


   
    @Override
    protected void postProcessPath(PathData src) throws IOException {
      if (!src.fs.delete(src.path, false)) {
        // we have no way to know the actual error...
        PathIOException e = new PathIOException(src.toString());
        e.setOperation("remove");
        throw e;
      }
    }
View Full Code Here

    }

    @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.fs.rename(src.path, target.path)) {
        // we have no way to know the actual error...
        throw new PathIOException(src.toString());
      }
    }
View Full Code Here

      // false and it falls thru to fs.delete.  this doesn't seem right
      if (moveToTrash(item)) {
        return;
      }
      if (!item.fs.delete(item.path, deleteDirs)) {
        throw new PathIOException(item.toString());
      }
      out.println("Deleted " + item);
    }
View Full Code Here

      if (!item.stat.isDirectory()) {
        throw new PathIsNotDirectoryException(item.toString());
      }     
      if (item.fs.listStatus(item.path).length == 0) {
        if (!item.fs.delete(item.path, false)) {
          throw new PathIOException(item.toString());
        }
      } else if (!ignoreNonEmpty) {
        throw new PathIsNotEmptyDirectoryException(item.toString());
      }
    }
View Full Code Here

  protected String path = "some/file";
  protected String error = "KABOOM";

  @Test
  public void testWithDefaultString() throws Exception {
    PathIOException pe = new PathIOException(path);
    assertEquals(new Path(path), pe.getPath());
    assertEquals("`" + path + "': Input/output error", pe.getMessage());
  }
View Full Code Here

  }

  @Test
  public void testWithThrowable() throws Exception {
    IOException ioe = new IOException("KABOOM");   
    PathIOException pe = new PathIOException(path, ioe);
    assertEquals(new Path(path), pe.getPath());
    assertEquals("`" + path + "': Input/output error: " + error, pe.getMessage());
  }
View Full Code Here

    assertEquals("`" + path + "': Input/output error: " + error, pe.getMessage());
  }

  @Test
  public void testWithCustomString() throws Exception {
    PathIOException pe = new PathIOException(path, error);
    assertEquals(new Path(path), pe.getPath());
    assertEquals("`" + path + "': " + error, pe.getMessage());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.PathIOException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.