일부 수정
This commit is contained in:
+8
-9
@@ -81,7 +81,7 @@ public class DJBErpNsmapiAccessTokenService implements HttpClientAccessTokenServ
|
||||
}
|
||||
String connectionTimeoutTemp = adapterProp.getProperty("CONNECTION_TIMEOUT");
|
||||
if (StringUtils.isBlank(connectionTimeoutTemp)) {
|
||||
connectionTimeoutTemp = "30000";
|
||||
connectionTimeoutTemp = "3000";
|
||||
}
|
||||
|
||||
int timeout = Integer.parseInt(timeoutTemp);
|
||||
@@ -245,7 +245,7 @@ public class DJBErpNsmapiAccessTokenService implements HttpClientAccessTokenServ
|
||||
logger.debug("contentType = [" + contentType + "]");
|
||||
logger.debug("encode = [" + encode + "]");
|
||||
|
||||
OAuth2AccessTokenVO accessToken = new OAuth2AccessTokenVO();
|
||||
OAuth2AccessTokenVO accessToken = null;
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
if (response.getCode() != 200) {
|
||||
throw new Exception("OAuth token receive status fail value= " + response.getCode());
|
||||
@@ -266,7 +266,11 @@ public class DJBErpNsmapiAccessTokenService implements HttpClientAccessTokenServ
|
||||
JsonNode data = responseJSON.path("data");
|
||||
if(data.has("token")) {
|
||||
String token = data.path("token").asText();
|
||||
accessToken = new OAuth2AccessTokenVO();
|
||||
accessToken.setAccessToken(token);
|
||||
accessToken.setExpiration(new Date(currentTime + 30_000L));
|
||||
logger.debug("oauthToken =" + accessToken.toString());
|
||||
return accessToken;
|
||||
} else {
|
||||
throw new Exception("oauth token return null");
|
||||
}
|
||||
@@ -274,18 +278,13 @@ public class DJBErpNsmapiAccessTokenService implements HttpClientAccessTokenServ
|
||||
throw new Exception("oauth token return null");
|
||||
}
|
||||
// accessToken.setExpiration(new Date(currentTime + oAuthCredentialVo.getIntervalSec() * 1000L));
|
||||
accessToken.setExpiration(new Date(currentTime + 30_000L));
|
||||
|
||||
logger.debug("oauthToken =" + accessToken.toString());
|
||||
|
||||
return accessToken;
|
||||
} else {
|
||||
throw new Exception("oauth token return null");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("[DJBErpNsmapiAccessTokenService] retrieve accessToken exception :" + e.getMessage(), e);
|
||||
return accessToken;
|
||||
logger.error("[DJBErpNsmapiAccessTokenService] retrieve accessToken exception :" + e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user