本文整理汇总了Java中org.jets3t.service.ServiceException.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceException.getCause方法的具体用法?Java ServiceException.getCause怎么用?Java ServiceException.getCause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jets3t.service.ServiceException
的用法示例。
在下文中一共展示了ServiceException.getCause方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleServiceException
import org.jets3t.service.ServiceException; //导入方法依赖的package包/类
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());
}
}
}
示例2: map
import org.jets3t.service.ServiceException; //导入方法依赖的package包/类
@Override
public BackgroundException map(final ServiceException e) {
if(e.getCause() instanceof ServiceException) {
return this.map((ServiceException) e.getCause());
}
final StringBuilder buffer = new StringBuilder();
if(StringUtils.isNotBlank(e.getErrorMessage())) {
// S3 protocol message parsed from XML
this.append(buffer, StringEscapeUtils.unescapeXml(e.getErrorMessage()));
}
else {
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":
case "InvalidClientTokenId":
case "InvalidSecurity":
case "MissingClientTokenId":
case "MissingAuthenticationToken":
return new LoginFailureException(buffer.toString(), e);
}
}
case HttpStatus.SC_BAD_REQUEST:
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);
}
return new HttpResponseExceptionMappingService().map(new HttpResponseException(e.getResponseCode(), buffer.toString()));
}