* Fix for Issue##549 Catch ClientProtocolException and Update Error Logs * Fix indentation, checkstyle errors
This commit is contained in:
parent
933de30d42
commit
60171e3c87
@ -22,6 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.aggregator.microservices;
|
package com.iluwatar.aggregator.microservices;
|
||||||
|
|
||||||
|
import org.apache.http.client.ClientProtocolException;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
@ -49,8 +50,10 @@ public class ProductInformationClientImpl implements ProductInformationClient {
|
|||||||
try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) {
|
try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) {
|
||||||
response = EntityUtils.toString(httpResponse.getEntity());
|
response = EntityUtils.toString(httpResponse.getEntity());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (ClientProtocolException cpe) {
|
||||||
LOGGER.error("Exception caught.", e);
|
LOGGER.error("ClientProtocolException Occured", cpe);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
LOGGER.error("IOException Occurred", ioe);
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.aggregator.microservices;
|
package com.iluwatar.aggregator.microservices;
|
||||||
|
|
||||||
|
import org.apache.http.client.ClientProtocolException;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
@ -49,8 +50,10 @@ public class ProductInventoryClientImpl implements ProductInventoryClient {
|
|||||||
try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) {
|
try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) {
|
||||||
response = EntityUtils.toString(httpResponse.getEntity());
|
response = EntityUtils.toString(httpResponse.getEntity());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (ClientProtocolException cpe) {
|
||||||
LOGGER.error("Exception caught.", e);
|
LOGGER.error("ClientProtocolException Occured", cpe);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
LOGGER.error("IOException Occurred", ioe);
|
||||||
}
|
}
|
||||||
return Integer.parseInt(response);
|
return Integer.parseInt(response);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user