} catch (ClientException e) { log.error("初始化SDK 异常", e); e.printStackTrace(); } catch (ClientException e) { log.error("发送异常"); e.printStackTrace();
private ClientException newUnmarshalException(Class<?> clazz, String xmlContent, Exception e) { return new ClientException("SDK.UnmarshalFailed", "unmarshal response from xml content failed, clazz = " + clazz.getSimpleName() + ", origin response = " + xmlContent, e); } }
if (e.getErrCode().equals("InvalidAccessKeyId.NotFound")) { logger.error("PullMessageTask_execute_error,messageType:" + messageType + ",queueName:" + queueName + ",please check AccessKeyId", e); if (e.getErrCode().equals("SignatureDoesNotMatch")) { logger.error("PullMessageTask_execute_error,messageType:" + messageType + ",queueName:" + queueName
private static AcsResponse getResponse(final String proxyHost, final String proxyPort, final String proxyUsername, final String proxyPassword, final IAcsClient client, final AcsRequest request) { try { if (!isEmpty(proxyHost)) { // Set JVM proxies during runtime ProxyUtil.setProxies(proxyHost, proxyPort, proxyUsername, proxyPassword); //Thread.sleep(30000); } return client.getAcsResponse(request); } catch (ClientException e) { throw new RuntimeException(e.getMessage()); } finally { if (!isEmpty(proxyHost)) { //Clear proxies ProxyUtil.clearProxy(); } } }
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain); } catch (ClientException e) { e.printStackTrace(); e.printStackTrace(); result.setCode(-1); result.setMsg(e.getErrMsg());
public ClientException(String errCode, String errMsg, String requestId) { this(errCode, errMsg); this.requestId = requestId; this.setErrorType(ErrorType.Client); }
response = client.getAcsResponse(describeEndpointsRequest); } catch (ClientException e) { if ("InvalidRegionId".equals(e.getErrCode()) && "The specified region does not exist.".equals(e.getErrMsg())) { } else if ("Illegal Parameter".equals(e.getErrCode()) && "Please check the parameters".equals(e.getErrMsg())) {
@Override public String getMessage() { return super.getMessage() + (null == getRequestId() ? "" : "\r\nRequestId : " + getRequestId()); } }
@Override public boolean send(SendSmsRequest request) { try { IAcsClient acsClient = new DefaultAcsClient(profile); request.setMethod(MethodType.POST); SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request); if (sendSmsResponse.getCode() != null && sendSmsResponse.getCode(). equals("OK")) { return true; } } catch (ClientException e) { log.error(e.getMessage()); return false; } return false; } }
public ClientException(String errCode, String errMsg) { super(errCode + " : " + errMsg); this.errCode = errCode; this.errMsg = errMsg; this.setErrorType(ErrorType.Client); }
@Override public String getMessage() { return super.getMessage() + (null == getRequestId() ? "" : "\r\nRequestId : " + getRequestId()); } }
public AliSmsService(String accessKeyId, String accessKeySecret) { try { //初始化ascClient,暂时不支持多region(请勿修改) profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret); DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Dysmsapi", "dysmsapi.aliyuncs.com"); } catch (ClientException e) { e.printStackTrace(); } }
private ClientException newUnmarshalException(Class<?> clazz, String content, Exception e) { return new ClientException("SDK.UnmarshalFailed", "unmarshal response from json content failed, clazz = " + clazz.getSimpleName() + ", origin response = " + content, e); } }
@Override public boolean send(SendSmsRequest request) { try { IAcsClient acsClient = new DefaultAcsClient(profile); request.setMethod(MethodType.POST); SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request); if (sendSmsResponse.getCode() != null && sendSmsResponse.getCode(). equals("OK")) { return true; } } catch (ClientException e) { log.error(e.getMessage()); return false; } return false; } }
public ClientException(String message) { super(message); this.setErrorType(ErrorType.Client); }
public AliSmsService(String accessKeyId, String accessKeySecret) { try { //初始化ascClient,暂时不支持多region(请勿修改) profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret); DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Dysmsapi", "dysmsapi.aliyuncs.com"); } catch (ClientException e) { e.printStackTrace(); } }
public String getHttpContentString() throws ClientException { String stringContent = ""; if (this.httpContent != null) { try { if (this.encoding == null) { stringContent = new String(this.httpContent); } else { stringContent = new String(this.httpContent, this.encoding); } } catch (UnsupportedEncodingException exp) { throw new ClientException("SDK.UnsupportedEncoding", "Can not parse response due to unsupported encoding."); } } return stringContent; }
return e.getMessage();
public ClientException(String errCode, String errMsg, Throwable cause) { super(errCode + " : " + errMsg, cause); this.errCode = errCode; this.errMsg = errMsg; this.setErrorType(ErrorType.Client); }
private DescribeRegionsResponse sampleDescribeRegionsResponse(DescribeRegionsRequest describe) { IAcsClient client = acqIAcsClient(EcsServiceImpl.regionIdCnHangzhou); try { DescribeRegionsResponse response = client.getAcsResponse(describe); return response; } catch (ServerException e) { e.printStackTrace(); return null; } catch (ClientException e) { e.printStackTrace(); return null; } }