Example usage for org.apache.hadoop.fs PathAccessDeniedException PathAccessDeniedException

List of usage examples for org.apache.hadoop.fs PathAccessDeniedException PathAccessDeniedException

Introduction

In this page you can find the example usage for org.apache.hadoop.fs PathAccessDeniedException PathAccessDeniedException.

Prototype

public PathAccessDeniedException(String path) 

Source Link

Usage

From source file:org.apache.slider.core.exceptions.ExceptionConverter.java

License:Apache License

/**
 * Convert a Jersey Exception into an IOE or subclass
 * @param targetURL URL being targeted /*from  w  w w  .j ava  2s  . c o  m*/
 * @param exception original exception
 * @return a new exception, the original one nested as a cause
 */
public static IOException convertJerseyException(String targetURL, UniformInterfaceException exception) {

    IOException ioe = null;
    ClientResponse response = exception.getResponse();
    if (response != null) {
        int status = response.getStatus();
        if (status == 401) {
            ioe = new PathAccessDeniedException(targetURL);
        }
        if (status >= 400 && status < 500) {
            ioe = new FileNotFoundException(targetURL);
        }
    }

    if (ioe == null) {
        ioe = new IOException("Failed to GET " + targetURL + ": " + exception);
    }
    ioe.initCause(exception);
    return ioe;
}