|
|
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.web.client.RestClientException;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
@@ -511,15 +512,21 @@ public class EigeneaiApi {
|
|
|
log.info("requestUrl: {}", requestUrl);
|
|
|
URI url = URI.create(requestUrl);
|
|
|
|
|
|
- // GET방식으로 호출
|
|
|
- ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
|
|
|
- log.info("responseEntity.getStatusCode(): {} ", responseEntity.getStatusCode());
|
|
|
+ String responseJson = null;
|
|
|
+
|
|
|
+ try {
|
|
|
+ // GET방식으로 호출
|
|
|
+ ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
|
|
|
+ log.info("responseEntity.getStatusCode(): {} ", responseEntity.getStatusCode());
|
|
|
|
|
|
- String responseJson = responseEntity.getBody();
|
|
|
- // log.info("responseEntity.getBody(): {}", responseJson);
|
|
|
+ responseJson = responseEntity.getBody();
|
|
|
+ // log.info("responseEntity.getBody(): {}", responseJson);
|
|
|
|
|
|
- if (!responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
|
|
- return null;
|
|
|
+ if (!responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
|
|
+ return new Eigeneai();
|
|
|
+ }
|
|
|
+ } catch (RestClientException e) {
|
|
|
+ return new Eigeneai();
|
|
|
}
|
|
|
|
|
|
Gson gson = new Gson();
|