diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java index 16849d529..131fbf869 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java @@ -22,6 +22,7 @@ */ package com.iluwatar.aggregator.microservices; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; @@ -49,8 +50,10 @@ public class ProductInformationClientImpl implements ProductInformationClient { try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { response = EntityUtils.toString(httpResponse.getEntity()); } - } catch (IOException e) { - LOGGER.error("Exception caught.", e); + } catch (ClientProtocolException cpe) { + LOGGER.error("ClientProtocolException Occured", cpe); + } catch (IOException ioe) { + LOGGER.error("IOException Occurred", ioe); } return response; } diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java index 89f1a25e0..780dccb78 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java @@ -22,6 +22,7 @@ */ package com.iluwatar.aggregator.microservices; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; @@ -49,8 +50,10 @@ public class ProductInventoryClientImpl implements ProductInventoryClient { try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { response = EntityUtils.toString(httpResponse.getEntity()); } - } catch (IOException e) { - LOGGER.error("Exception caught.", e); + } catch (ClientProtocolException cpe) { + LOGGER.error("ClientProtocolException Occured", cpe); + } catch (IOException ioe) { + LOGGER.error("IOException Occurred", ioe); } return Integer.parseInt(response); }