Commit 3b6e4256 by wutong

检查unknownHostException错误

parent c09887ad
...@@ -165,14 +165,15 @@ public class AmazonAdProductJob extends PointJob { ...@@ -165,14 +165,15 @@ public class AmazonAdProductJob extends PointJob {
private void handleReport(String reportLocationUrl, JobAccountLog jobAccountLog, AmazonAdAuth amazonAdAuth){ private void handleReport(String reportLocationUrl, JobAccountLog jobAccountLog, AmazonAdAuth amazonAdAuth){
Response response = null; Response response = null;
GZIPInputStream gzin = null; GZIPInputStream gzin = null;
try{
Request request = new Request.Builder() Request request = new Request.Builder()
.url(reportLocationUrl) .url(reportLocationUrl)
.get()
.addHeader("Authorization", amazonAdAuth.getAccessToken()) .addHeader("Authorization", amazonAdAuth.getAccessToken())
.addHeader("Amazon-Advertising-API-ClientId", amazonAdAuth.getClientId()) .addHeader("Amazon-Advertising-API-ClientId", amazonAdAuth.getClientId())
.addHeader("Amazon-Advertising-API-Scope", amazonAdAuth.getProfileId()) .addHeader("Amazon-Advertising-API-Scope", amazonAdAuth.getProfileId())
.addHeader("Content-Type", "application/json") .addHeader("Content-Type", "application/json")
.build(); .build();
try{
response = client.newCall(request).execute(); response = client.newCall(request).execute();
if (response.isSuccessful()) { if (response.isSuccessful()) {
gzin = new GZIPInputStream(response.body().byteStream()); gzin = new GZIPInputStream(response.body().byteStream());
...@@ -217,7 +218,7 @@ public class AmazonAdProductJob extends PointJob { ...@@ -217,7 +218,7 @@ public class AmazonAdProductJob extends PointJob {
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
log.error("调用获取AmazonADReportLocation错误:", e); log.error("调用获取AmazonADReportLocation错误:", e);
jobAccountLog.setMessage("调用获取AmazonADReportLocation错误:" + ExceptionUtil.transform(e)); jobAccountLog.setMessage(reportLocationUrl +"调用获取AmazonADReportLocation错误:"+ ExceptionUtil.transform(e));
} finally { } finally {
if(gzin != null) { if(gzin != null) {
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment