Tabnine Logo
ServiceException
Code IndexAdd Tabnine to your IDE (free)

How to use
ServiceException
in
org.jets3t.service

Best Java code snippets using org.jets3t.service.ServiceException (Showing top 20 results out of 315)

origin: Alluxio/alluxio

 @Override
 protected InputStream openObject(String key, OpenOptions options) throws IOException {
  try {
   return new GCSInputStream(mBucketName, key, mClient, options.getOffset());
  } catch (ServiceException e) {
   throw new IOException(e.getMessage());
  }
 }
}
origin: ch.cern.hadoop/hadoop-aws

private void handleServiceException(ServiceException e) throws IOException {
  if (e.getCause() instanceof IOException) {
   throw (IOException) e.getCause();
  }
  else {
   if(LOG.isDebugEnabled()) {
    LOG.debug("Got ServiceException with Error code: " + e.getErrorCode() + ";and Error message: " + e.getErrorMessage());
   }
  }
 }
origin: net.java.dev.jets3t/jets3t

public ServiceException getServiceException() {
  String fullMessage = message
    + ": PartNumber=" + partNumber
    + ", MinSizeAllowed=" + minSizeAllowed
    + ", ProposedSize=" + proposedSize
    + ", ETag=" + etag;
  ServiceException e = new ServiceException(fullMessage);
  e.setErrorCode(code);
  e.setErrorMessage(message);
  e.setErrorHostId(hostId);
  e.setErrorRequestId(requestId);
  return e;
}
origin: io.druid.extensions/druid-s3-extensions

public static boolean isServiceExceptionRecoverable(ServiceException ex)
{
 final boolean isIOException = ex.getCause() instanceof IOException;
 final boolean isTimeout = "RequestTimeout".equals(((ServiceException) ex).getErrorCode());
 return isIOException || isTimeout;
}
origin: net.java.dev.jets3t/jets3t

/**
 * Wrap a ServiceException as an S3ServiceException.
 * @param se
 */
public S3ServiceException(ServiceException se) {
  super(se.getMessage(), se.getXmlMessage(), se.getCause());
  this.setResponseHeaders(se.getResponseHeaders());
  this.setResponseCode(se.getResponseCode());
  this.setResponseStatus(se.getResponseStatus());
  this.setResponseDate(se.getResponseDate());
  this.setRequestVerb(se.getRequestVerb());
  this.setRequestPath(se.getRequestPath());
  this.setRequestHost(se.getRequestHost());
}
origin: net.java.dev.jets3t/jets3t

  exception = new ServiceException("Service Error Message.", sb.toString());
} else {
  if(log.isDebugEnabled()) {
  exception = new ServiceException(
    "Request Error" + (responseText != null ? " [" + responseText + "]." : "."),
    httpException);
exception.setResponseCode(responseCode);
exception.setResponseHeaders(RestUtils.convertHeadersToMap(response.getAllHeaders()));
else if("RequestTimeout".equals(exception.getErrorCode())) {
  if(requestTimeoutErrorCount >= retryMaxCount) {
    throw exception;
else if("RequestTimeTooSkewed".equals(exception.getErrorCode())) {
  if(requestTimeTooSkewedErrorCount >= retryMaxCount) {
    throw exception;
    && "NoSuchKey".equals(exception.getErrorCode())
else if ("InvalidRequest".equals(exception.getErrorCode())
     && exception.getErrorMessage().contains("Please use AWS4-HMAC-SHA256"))
else if("AuthorizationHeaderMalformed".equals(exception.getErrorCode())) {
  String expectedRegion = null;
  try {
    expectedRegion = exception.getXmlMessageAsBuilder()
      .xpathFind("/Error/Region").getElement().getTextContent();
origin: iterate-ch/cyberduck

@Override
public BackgroundException map(final ServiceException e) {
  if(e.getCause() instanceof ServiceException) {
    return this.map((ServiceException) e.getCause());
  if(StringUtils.isNotBlank(e.getErrorMessage())) {
    this.append(buffer, StringEscapeUtils.unescapeXml(e.getErrorMessage()));
    this.append(buffer, e.getResponseStatus());
    this.append(buffer, e.getMessage());
  switch(e.getResponseCode()) {
    case HttpStatus.SC_FORBIDDEN:
      if(StringUtils.isNotBlank(e.getErrorCode())) {
        switch(e.getErrorCode()) {
          case "SignatureDoesNotMatch":
          case "InvalidAccessKeyId":
      if(StringUtils.isNotBlank(e.getErrorCode())) {
        switch(e.getErrorCode()) {
          case "RequestTimeout":
            return new ConnectionTimeoutException(buffer.toString(), e);
  if(e.getCause() instanceof IOException) {
    return new DefaultIOExceptionMappingService().map((IOException) e.getCause());
  if(e.getCause() instanceof SAXException) {
    return new InteroperabilityException(buffer.toString(), e);
origin: net.java.dev.jets3t/jets3t

/**
 * Throws an exception if an object's key name is null or empty.
 * @param key
 * An object's key name.
 * @param action
 * the action being attempted which this assertion is applied, for debugging purposes.
 * @throws ServiceException
 */
protected void assertValidObject(String key, String action) throws ServiceException {
  if (key == null || key.length() == 0) {
    throw new ServiceException("The action " + action
      + " cannot be performed with an invalid object key name: " + key);
  }
}
origin: io.druid.extensions/druid-s3-extensions

public static boolean isObjectInBucket(RestS3Service s3Client, String bucketName, String objectKey)
  throws ServiceException
{
 try {
  s3Client.getObjectDetails(bucketName, objectKey);
 }
 catch (ServiceException e) {
  if (404 == e.getResponseCode()
    || "NoSuchKey".equals(e.getErrorCode())
    || "NoSuchBucket".equals(e.getErrorCode())) {
   return false;
  }
  if ("AccessDenied".equals(e.getErrorCode())) {
   // Object is inaccessible to current user, but does exist.
   return true;
  }
  // Something else has gone wrong
  throw e;
 }
 return true;
}
origin: net.java.dev.jets3t/jets3t

  ioErrorRetryCount = 0;
} catch (ServiceException e) {
  if (e.getCause() instanceof IOException
    && ioErrorRetryCount < ioErrorRetryMaxCount)
    throw new ServiceException("Unable to retrieve paginated "
      + "ListMultipartUploadsResult without valid NextKeyMarker "
      + " or NextUploadIdMarker value.");
origin: io.druid.extensions/druid-s3-extensions

 @Override
 public InputStream openStream() throws IOException
 {
  try {
   return buildFileObject(uri, s3Client).openInputStream();
  }
  catch (ServiceException e) {
   if (e.getCause() != null) {
    if (S3Utils.S3RETRY.apply(e)) {
     throw new IOException("Recoverable exception", e);
    }
   }
   throw Throwables.propagate(e);
  }
 }
};
origin: iterate-ch/cyberduck

final ServiceException failure = new ServiceException();
failure.setErrorCode(error.getErrorCode());
failure.setErrorMessage(error.getMessage());
throw new S3ExceptionMappingService().map("Cannot delete {0}", failure,
  new Path(container, error.getKey(), EnumSet.of(Path.Type.file)));
  final ServiceException failure = new ServiceException();
  failure.setErrorCode(error.getErrorCode());
  failure.setErrorMessage(error.getMessage());
  throw new S3ExceptionMappingService().map("Cannot delete {0}", failure,
    new Path(container, error.getKey(), EnumSet.of(Path.Type.file)));
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

/**
 * Create a service exception that includes a specific message, an optional XML error
 * document returned by service, and an optional underlying cause exception.
 *
 * @param message
 * @param xmlMessage
 * @param cause
 */
public ServiceException(String message, String xmlMessage, Throwable cause) {
  super(message, cause);
  if (xmlMessage != null) {
    parseXmlMessage(xmlMessage);
  }
  MxDelegate.getInstance().registerS3ServiceExceptionEvent(getErrorCode());
}
origin: iterate-ch/cyberduck

if(null != e.getResponseHeaders()) {
  if(e.getResponseHeaders().containsKey(AMZ_DELETE_MARKER)) {
    final S3Object marker = new S3Object();
    marker.addMetadata(S3_VERSION_ID, e.getResponseHeaders().get(AMZ_VERSION_ID));
    return marker;
  log.warn(String.format("Missing permission to read object details for %s %s", file, e.getMessage()));
  final StorageObject object = new StorageObject(containerService.getKey(file));
  object.setBucketName(container);
origin: iterate-ch/cyberduck

throw new IOException(e.getErrorMessage(), new S3ExceptionMappingService().map(e));
origin: net.java.dev.jets3t/jets3t

if(e.getResponseCode() == 403) {
  if(log.isDebugEnabled()) {
    log.debug("Bucket named '" + bucketName + "' exists but is inaccessible, "
else if(e.getResponseCode() == 404) {
  if(log.isDebugEnabled()) {
    log.debug("Bucket does not exist: " + bucketName, e);
origin: ch.cern.hadoop/hadoop-aws

 ServiceException se = (ServiceException) thrown;
 LOG.debug("S3ServiceException: {}: {} : {}",
   se.getErrorCode(), se.toString(), se, se);
 result = new S3Exception(se);
} else if (thrown instanceof IOException) {
origin: opendedup/sdfs

  System.out.println("Bucket [" + bucketName + "] deleted");
} catch (ServiceException e) {
  e.printStackTrace();
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

/**
 * Wrap a ServiceException as an S3ServiceException.
 * @param se
 */
public S3ServiceException(ServiceException se) {
  super(se.getMessage(), se.getXmlMessage(), se.getCause());
  this.setResponseHeaders(se.getResponseHeaders());
  this.setResponseCode(se.getResponseCode());
  this.setResponseStatus(se.getResponseStatus());
  this.setResponseDate(se.getResponseDate());
  this.setRequestVerb(se.getRequestVerb());
  this.setRequestPath(se.getRequestPath());
  this.setRequestHost(se.getRequestHost());
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

  exception = new ServiceException("Service Error Message.", sb.toString());
} else {
  if(log.isDebugEnabled()) {
  exception = new ServiceException(
    "Request Error" + (responseText != null ? " [" + responseText + "]." : "."),
    httpException);
exception.setResponseCode(responseCode);
exception.setResponseHeaders(RestUtils.convertHeadersToMap(response.getAllHeaders()));
else if("RequestTimeout".equals(exception.getErrorCode())) {
  if(requestTimeoutErrorCount >= retryMaxCount) {
    throw exception;
else if("RequestTimeTooSkewed".equals(exception.getErrorCode())) {
  if(requestTimeTooSkewedErrorCount >= retryMaxCount) {
    throw exception;
    && "NoSuchKey".equals(exception.getErrorCode())
else if ("InvalidRequest".equals(exception.getErrorCode())
     && exception.getErrorMessage().contains("Please use AWS4-HMAC-SHA256"))
else if("AuthorizationHeaderMalformed".equals(exception.getErrorCode())) {
  String expectedRegion = null;
  try {
    expectedRegion = exception.getXmlMessageAsBuilder()
      .xpathFind("/Error/Region").getElement().getTextContent();
org.jets3t.serviceServiceException

Javadoc

Exception for use by StorageService and related utilities. This exception can hold useful additional information about errors that occur when communicating with a service.

Most used methods

  • getMessage
  • getCause
  • getErrorCode
  • getErrorMessage
  • <init>
    Create a service exception that includes an underlying cause exception.
  • getResponseCode
  • getResponseHeaders
  • getResponseStatus
  • printStackTrace
  • setErrorCode
    Set the exception's error code; for internal use only.
  • setErrorMessage
    Set the exception's error message; for internal use only.
  • findXmlElementText
  • setErrorMessage,
  • findXmlElementText,
  • getRequestHost,
  • getRequestPath,
  • getRequestVerb,
  • getResponseDate,
  • getXmlMessage,
  • getXmlMessageAsBuilder,
  • isParsedFromXmlMessage,
  • parseXmlMessage

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSharedPreferences (Context)
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • Kernel (java.awt.image)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now