Java 类org.apache.hadoop.fs.swift.exceptions.SwiftBadRequestException 实例源码

项目:hadoop    文件:TestSwiftFileSystemBasicOps.java   
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLongObjectNamesForbidden() throws Throwable {
  StringBuilder buffer = new StringBuilder(1200);
  buffer.append("/");
  for (int i = 0; i < (1200 / 4); i++) {
    buffer.append(String.format("%04x", i));
  }
  String pathString = buffer.toString();
  Path path = new Path(pathString);
  try {
    writeTextFile(fs, path, pathString, true);
    //if we get here, problems.
    fs.delete(path, false);
    fail("Managed to create an object with a name of length "
            + pathString.length());
  } catch (SwiftBadRequestException e) {
    //expected
    //LOG.debug("Caught exception " + e, e);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestSwiftFileSystemBasicOps.java   
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLongObjectNamesForbidden() throws Throwable {
  StringBuilder buffer = new StringBuilder(1200);
  buffer.append("/");
  for (int i = 0; i < (1200 / 4); i++) {
    buffer.append(String.format("%04x", i));
  }
  String pathString = buffer.toString();
  Path path = new Path(pathString);
  try {
    writeTextFile(fs, path, pathString, true);
    //if we get here, problems.
    fs.delete(path, false);
    fail("Managed to create an object with a name of length "
            + pathString.length());
  } catch (SwiftBadRequestException e) {
    //expected
    //LOG.debug("Caught exception " + e, e);
  }
}
项目:big-c    文件:TestSwiftFileSystemBasicOps.java   
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLongObjectNamesForbidden() throws Throwable {
  StringBuilder buffer = new StringBuilder(1200);
  buffer.append("/");
  for (int i = 0; i < (1200 / 4); i++) {
    buffer.append(String.format("%04x", i));
  }
  String pathString = buffer.toString();
  Path path = new Path(pathString);
  try {
    writeTextFile(fs, path, pathString, true);
    //if we get here, problems.
    fs.delete(path, false);
    fail("Managed to create an object with a name of length "
            + pathString.length());
  } catch (SwiftBadRequestException e) {
    //expected
    //LOG.debug("Caught exception " + e, e);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestSwiftFileSystemBasicOps.java   
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLongObjectNamesForbidden() throws Throwable {
  StringBuilder buffer = new StringBuilder(1200);
  buffer.append("/");
  for (int i = 0; i < (1200 / 4); i++) {
    buffer.append(String.format("%04x", i));
  }
  String pathString = buffer.toString();
  Path path = new Path(pathString);
  try {
    writeTextFile(fs, path, pathString, true);
    //if we get here, problems.
    fs.delete(path, false);
    fail("Managed to create an object with a name of length "
            + pathString.length());
  } catch (SwiftBadRequestException e) {
    //expected
    //LOG.debug("Caught exception " + e, e);
  }
}
项目:hops    文件:TestSwiftFileSystemBasicOps.java   
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLongObjectNamesForbidden() throws Throwable {
  StringBuilder buffer = new StringBuilder(1200);
  buffer.append("/");
  for (int i = 0; i < (1200 / 4); i++) {
    buffer.append(String.format("%04x", i));
  }
  String pathString = buffer.toString();
  Path path = new Path(pathString);
  try {
    writeTextFile(fs, path, pathString, true);
    //if we get here, problems.
    fs.delete(path, false);
    fail("Managed to create an object with a name of length "
            + pathString.length());
  } catch (SwiftBadRequestException e) {
    //expected
    //LOG.debug("Caught exception " + e, e);
  }
}
项目:hadoop-on-lustre2    文件:TestSwiftFileSystemBasicOps.java   
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLongObjectNamesForbidden() throws Throwable {
  StringBuilder buffer = new StringBuilder(1200);
  buffer.append("/");
  for (int i = 0; i < (1200 / 4); i++) {
    buffer.append(String.format("%04x", i));
  }
  String pathString = buffer.toString();
  Path path = new Path(pathString);
  try {
    writeTextFile(fs, path, pathString, true);
    //if we get here, problems.
    fs.delete(path, false);
    fail("Managed to create an object with a name of length "
            + pathString.length());
  } catch (SwiftBadRequestException e) {
    //expected
    //LOG.debug("Caught exception " + e, e);
  }
}
项目:sahara-extra    文件:TestSwiftFileSystemBasicOps.java   
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testLongObjectNamesForbidden() throws Throwable {
  StringBuilder buffer = new StringBuilder(1200);
  buffer.append("/");
  for (int i = 0; i < (1200 / 4); i++) {
    buffer.append(String.format("%04x", i));
  }
  String pathString = buffer.toString();
  Path path = new Path(pathString);
  try {
    writeTextFile(fs, path, pathString, true);
    //if we get here, problems.
    fs.delete(path, false);
    fail("Managed to create an object with a name of length "
            + pathString.length());
  } catch (SwiftBadRequestException e) {
    //expected
    //LOG.debug("Caught exception " + e, e);
  }
}
项目:hadoop    文件:SwiftRestClient.java   
/**
 * Create a container -if it already exists, do nothing
 *
 * @param containerName the container name
 * @throws IOException IO problems
 * @throws SwiftBadRequestException invalid container name
 * @throws SwiftInvalidResponseException error from the server
 */
public void createContainer(String containerName) throws IOException {
  SwiftObjectPath objectPath = new SwiftObjectPath(containerName, "");
  try {
    //see if the data is there
    headRequest("createContainer", objectPath, NEWEST);
  } catch (FileNotFoundException ex) {
    int status = 0;
    try {
      status = putRequest(objectPath);
    } catch (FileNotFoundException e) {
      //triggered by a very bad container name.
      //re-insert the 404 result into the status
      status = SC_NOT_FOUND;
    }
    if (status == SC_BAD_REQUEST) {
      throw new SwiftBadRequestException(
        "Bad request -authentication failure or bad container name?",
        status,
        "PUT",
        null);
    }
    if (!isStatusCodeExpected(status,
            SC_OK,
            SC_CREATED,
            SC_ACCEPTED,
            SC_NO_CONTENT)) {
      throw new SwiftInvalidResponseException("Couldn't create container "
              + containerName +
              " for storing data in Swift." +
              " Try to create container " +
              containerName + " manually ",
              status,
              "PUT",
              null);
    } else {
      throw ex;
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:SwiftRestClient.java   
/**
 * Create a container -if it already exists, do nothing
 *
 * @param containerName the container name
 * @throws IOException IO problems
 * @throws SwiftBadRequestException invalid container name
 * @throws SwiftInvalidResponseException error from the server
 */
public void createContainer(String containerName) throws IOException {
  SwiftObjectPath objectPath = new SwiftObjectPath(containerName, "");
  try {
    //see if the data is there
    headRequest("createContainer", objectPath, NEWEST);
  } catch (FileNotFoundException ex) {
    int status = 0;
    try {
      status = putRequest(objectPath);
    } catch (FileNotFoundException e) {
      //triggered by a very bad container name.
      //re-insert the 404 result into the status
      status = SC_NOT_FOUND;
    }
    if (status == SC_BAD_REQUEST) {
      throw new SwiftBadRequestException(
        "Bad request -authentication failure or bad container name?",
        status,
        "PUT",
        null);
    }
    if (!isStatusCodeExpected(status,
            SC_OK,
            SC_CREATED,
            SC_ACCEPTED,
            SC_NO_CONTENT)) {
      throw new SwiftInvalidResponseException("Couldn't create container "
              + containerName +
              " for storing data in Swift." +
              " Try to create container " +
              containerName + " manually ",
              status,
              "PUT",
              null);
    } else {
      throw ex;
    }
  }
}
项目:big-c    文件:SwiftRestClient.java   
/**
 * Create a container -if it already exists, do nothing
 *
 * @param containerName the container name
 * @throws IOException IO problems
 * @throws SwiftBadRequestException invalid container name
 * @throws SwiftInvalidResponseException error from the server
 */
public void createContainer(String containerName) throws IOException {
  SwiftObjectPath objectPath = new SwiftObjectPath(containerName, "");
  try {
    //see if the data is there
    headRequest("createContainer", objectPath, NEWEST);
  } catch (FileNotFoundException ex) {
    int status = 0;
    try {
      status = putRequest(objectPath);
    } catch (FileNotFoundException e) {
      //triggered by a very bad container name.
      //re-insert the 404 result into the status
      status = SC_NOT_FOUND;
    }
    if (status == SC_BAD_REQUEST) {
      throw new SwiftBadRequestException(
        "Bad request -authentication failure or bad container name?",
        status,
        "PUT",
        null);
    }
    if (!isStatusCodeExpected(status,
            SC_OK,
            SC_CREATED,
            SC_ACCEPTED,
            SC_NO_CONTENT)) {
      throw new SwiftInvalidResponseException("Couldn't create container "
              + containerName +
              " for storing data in Swift." +
              " Try to create container " +
              containerName + " manually ",
              status,
              "PUT",
              null);
    } else {
      throw ex;
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:SwiftRestClient.java   
/**
 * Create a container -if it already exists, do nothing
 *
 * @param containerName the container name
 * @throws IOException IO problems
 * @throws SwiftBadRequestException invalid container name
 * @throws SwiftInvalidResponseException error from the server
 */
public void createContainer(String containerName) throws IOException {
  SwiftObjectPath objectPath = new SwiftObjectPath(containerName, "");
  try {
    //see if the data is there
    headRequest("createContainer", objectPath, NEWEST);
  } catch (FileNotFoundException ex) {
    int status = 0;
    try {
      status = putRequest(objectPath);
    } catch (FileNotFoundException e) {
      //triggered by a very bad container name.
      //re-insert the 404 result into the status
      status = SC_NOT_FOUND;
    }
    if (status == SC_BAD_REQUEST) {
      throw new SwiftBadRequestException(
        "Bad request -authentication failure or bad container name?",
        status,
        "PUT",
        null);
    }
    if (!isStatusCodeExpected(status,
            SC_OK,
            SC_CREATED,
            SC_ACCEPTED,
            SC_NO_CONTENT)) {
      throw new SwiftInvalidResponseException("Couldn't create container "
              + containerName +
              " for storing data in Swift." +
              " Try to create container " +
              containerName + " manually ",
              status,
              "PUT",
              null);
    } else {
      throw ex;
    }
  }
}
项目:hops    文件:SwiftRestClient.java   
/**
 * Create a container -if it already exists, do nothing
 *
 * @param containerName the container name
 * @throws IOException IO problems
 * @throws SwiftBadRequestException invalid container name
 * @throws SwiftInvalidResponseException error from the server
 */
public void createContainer(String containerName) throws IOException {
  SwiftObjectPath objectPath = new SwiftObjectPath(containerName, "");
  try {
    //see if the data is there
    headRequest("createContainer", objectPath, NEWEST);
  } catch (FileNotFoundException ex) {
    int status = 0;
    try {
      status = putRequest(objectPath);
    } catch (FileNotFoundException e) {
      //triggered by a very bad container name.
      //re-insert the 404 result into the status
      status = SC_NOT_FOUND;
    }
    if (status == SC_BAD_REQUEST) {
      throw new SwiftBadRequestException(
        "Bad request -authentication failure or bad container name?",
        status,
        "PUT",
        null);
    }
    if (!isStatusCodeExpected(status,
            SC_OK,
            SC_CREATED,
            SC_ACCEPTED,
            SC_NO_CONTENT)) {
      throw new SwiftInvalidResponseException("Couldn't create container "
              + containerName +
              " for storing data in Swift." +
              " Try to create container " +
              containerName + " manually ",
              status,
              "PUT",
              null);
    } else {
      throw ex;
    }
  }
}
项目:hadoop-on-lustre2    文件:SwiftRestClient.java   
/**
 * Create a container -if it already exists, do nothing
 *
 * @param containerName the container name
 * @throws IOException IO problems
 * @throws SwiftBadRequestException invalid container name
 * @throws SwiftInvalidResponseException error from the server
 */
public void createContainer(String containerName) throws IOException {
  SwiftObjectPath objectPath = new SwiftObjectPath(containerName, "");
  try {
    //see if the data is there
    headRequest("createContainer", objectPath, NEWEST);
  } catch (FileNotFoundException ex) {
    int status = 0;
    try {
      status = putRequest(objectPath);
    } catch (FileNotFoundException e) {
      //triggered by a very bad container name.
      //re-insert the 404 result into the status
      status = SC_NOT_FOUND;
    }
    if (status == SC_BAD_REQUEST) {
      throw new SwiftBadRequestException(
        "Bad request -authentication failure or bad container name?",
        status,
        "PUT",
        null);
    }
    if (!isStatusCodeExpected(status,
            SC_OK,
            SC_CREATED,
            SC_ACCEPTED,
            SC_NO_CONTENT)) {
      throw new SwiftInvalidResponseException("Couldn't create container "
              + containerName +
              " for storing data in Swift." +
              " Try to create container " +
              containerName + " manually ",
              status,
              "PUT",
              null);
    } else {
      throw ex;
    }
  }
}
项目:sahara-extra    文件:SwiftRestClient.java   
/**
 * Create a container -if it already exists, do nothing
 *
 * @param containerName the container name
 * @throws IOException IO problems
 * @throws SwiftBadRequestException invalid container name
 * @throws SwiftInvalidResponseException error from the server
 */
public void createContainer(String containerName) throws IOException {
  SwiftObjectPath objectPath = new SwiftObjectPath(containerName, "");
  try {
    //see if the data is there
    headRequest("createContainer", objectPath, NEWEST);
  } catch (FileNotFoundException ex) {
    int status = 0;
    try {
      status = putRequest(objectPath);
    } catch (FileNotFoundException e) {
      //triggered by a very bad container name.
      //re-insert the 404 result into the status
      status = SC_NOT_FOUND;
    }
    if (status == SC_BAD_REQUEST) {
      throw new SwiftBadRequestException(
        "Bad request -authentication failure or bad container name?",
        status,
        "PUT",
        null);
    }
    if (!isStatusCodeExpected(status,
            SC_OK,
            SC_CREATED,
            SC_ACCEPTED,
            SC_NO_CONTENT)) {
      throw new SwiftInvalidResponseException("Couldn't create container "
              + containerName +
              " for storing data in Swift." +
              " Try to create container " +
              containerName + " manually ",
              status,
              "PUT",
              null);
    } else {
      throw ex;
    }
  }
}
项目:hadoop    文件:SwiftRestClient.java   
/**
 * Performs the HTTP request, validates the response code and returns
 * the received data. HTTP Status codes are converted into exceptions.
 *
 * @param uri URI to source
 * @param processor HttpMethodProcessor
 * @param <M> method
 * @param <R> result type
 * @return result of HTTP request
 * @throws IOException IO problems
 * @throws SwiftBadRequestException the status code indicated "Bad request"
 * @throws SwiftInvalidResponseException the status code is out of range
 * for the action (excluding 404 responses)
 * @throws SwiftInternalStateException the internal state of this client
 * is invalid
 * @throws FileNotFoundException a 404 response was returned
 */
private <M extends HttpMethod, R> R perform(URI uri,
                    HttpMethodProcessor<M, R> processor)
  throws IOException,
         SwiftBadRequestException,
         SwiftInternalStateException,
         SwiftInvalidResponseException,
         FileNotFoundException {
  return perform("",uri, processor);
}
项目:aliyun-oss-hadoop-fs    文件:SwiftRestClient.java   
/**
 * Performs the HTTP request, validates the response code and returns
 * the received data. HTTP Status codes are converted into exceptions.
 *
 * @param uri URI to source
 * @param processor HttpMethodProcessor
 * @param <M> method
 * @param <R> result type
 * @return result of HTTP request
 * @throws IOException IO problems
 * @throws SwiftBadRequestException the status code indicated "Bad request"
 * @throws SwiftInvalidResponseException the status code is out of range
 * for the action (excluding 404 responses)
 * @throws SwiftInternalStateException the internal state of this client
 * is invalid
 * @throws FileNotFoundException a 404 response was returned
 */
private <M extends HttpMethod, R> R perform(URI uri,
                    HttpMethodProcessor<M, R> processor)
  throws IOException,
         SwiftBadRequestException,
         SwiftInternalStateException,
         SwiftInvalidResponseException,
         FileNotFoundException {
  return perform("",uri, processor);
}
项目:big-c    文件:SwiftRestClient.java   
/**
 * Performs the HTTP request, validates the response code and returns
 * the received data. HTTP Status codes are converted into exceptions.
 *
 * @param uri URI to source
 * @param processor HttpMethodProcessor
 * @param <M> method
 * @param <R> result type
 * @return result of HTTP request
 * @throws IOException IO problems
 * @throws SwiftBadRequestException the status code indicated "Bad request"
 * @throws SwiftInvalidResponseException the status code is out of range
 * for the action (excluding 404 responses)
 * @throws SwiftInternalStateException the internal state of this client
 * is invalid
 * @throws FileNotFoundException a 404 response was returned
 */
private <M extends HttpMethod, R> R perform(URI uri,
                    HttpMethodProcessor<M, R> processor)
  throws IOException,
         SwiftBadRequestException,
         SwiftInternalStateException,
         SwiftInvalidResponseException,
         FileNotFoundException {
  return perform("",uri, processor);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:SwiftRestClient.java   
/**
 * Performs the HTTP request, validates the response code and returns
 * the received data. HTTP Status codes are converted into exceptions.
 *
 * @param uri URI to source
 * @param processor HttpMethodProcessor
 * @param <M> method
 * @param <R> result type
 * @return result of HTTP request
 * @throws IOException IO problems
 * @throws SwiftBadRequestException the status code indicated "Bad request"
 * @throws SwiftInvalidResponseException the status code is out of range
 * for the action (excluding 404 responses)
 * @throws SwiftInternalStateException the internal state of this client
 * is invalid
 * @throws FileNotFoundException a 404 response was returned
 */
private <M extends HttpMethod, R> R perform(URI uri,
                    HttpMethodProcessor<M, R> processor)
  throws IOException,
         SwiftBadRequestException,
         SwiftInternalStateException,
         SwiftInvalidResponseException,
         FileNotFoundException {
  return perform("",uri, processor);
}
项目:hops    文件:SwiftRestClient.java   
/**
 * Performs the HTTP request, validates the response code and returns
 * the received data. HTTP Status codes are converted into exceptions.
 *
 * @param uri URI to source
 * @param processor HttpMethodProcessor
 * @param <M> method
 * @param <R> result type
 * @return result of HTTP request
 * @throws IOException IO problems
 * @throws SwiftBadRequestException the status code indicated "Bad request"
 * @throws SwiftInvalidResponseException the status code is out of range
 * for the action (excluding 404 responses)
 * @throws SwiftInternalStateException the internal state of this client
 * is invalid
 * @throws FileNotFoundException a 404 response was returned
 */
private <M extends HttpMethod, R> R perform(URI uri,
                    HttpMethodProcessor<M, R> processor)
  throws IOException,
         SwiftBadRequestException,
         SwiftInternalStateException,
         SwiftInvalidResponseException,
         FileNotFoundException {
  return perform("",uri, processor);
}
项目:hadoop-on-lustre2    文件:SwiftRestClient.java   
/**
 * Performs the HTTP request, validates the response code and returns
 * the received data. HTTP Status codes are converted into exceptions.
 *
 * @param uri URI to source
 * @param processor HttpMethodProcessor
 * @param <M> method
 * @param <R> result type
 * @return result of HTTP request
 * @throws IOException IO problems
 * @throws SwiftBadRequestException the status code indicated "Bad request"
 * @throws SwiftInvalidResponseException the status code is out of range
 * for the action (excluding 404 responses)
 * @throws SwiftInternalStateException the internal state of this client
 * is invalid
 * @throws FileNotFoundException a 404 response was returned
 */
private <M extends HttpMethod, R> R perform(URI uri,
                    HttpMethodProcessor<M, R> processor)
  throws IOException,
         SwiftBadRequestException,
         SwiftInternalStateException,
         SwiftInvalidResponseException,
         FileNotFoundException {
  return perform("",uri, processor);
}
项目:sahara-extra    文件:SwiftRestClient.java   
/**
 * Performs the HTTP request, validates the response code and returns
 * the received data. HTTP Status codes are converted into exceptions.
 *
 * @param uri URI to source
 * @param processor HttpMethodProcessor
 * @param <M> method
 * @param <R> result type
 * @return result of HTTP request
 * @throws IOException IO problems
 * @throws SwiftBadRequestException the status code indicated "Bad request"
 * @throws SwiftInvalidResponseException the status code is out of range
 * for the action (excluding 404 responses)
 * @throws SwiftInternalStateException the internal state of this client
 * is invalid
 * @throws FileNotFoundException a 404 response was returned
 */
private <M extends HttpMethod, R> R perform(URI uri,
                    HttpMethodProcessor<M, R> processor)
  throws IOException,
         SwiftBadRequestException,
         SwiftInternalStateException,
         SwiftInvalidResponseException,
         FileNotFoundException {
  return perform("",uri, processor);
}