diff options
Diffstat (limited to 'src/main/java/com/att/dmf/mr/service/impl')
3 files changed, 12 insertions, 7 deletions
diff --git a/src/main/java/com/att/dmf/mr/service/impl/MMServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/MMServiceImpl.java index e55f510..387d8b1 100644 --- a/src/main/java/com/att/dmf/mr/service/impl/MMServiceImpl.java +++ b/src/main/java/com/att/dmf/mr/service/impl/MMServiceImpl.java @@ -404,7 +404,7 @@ public class MMServiceImpl implements MMService { int status = HttpStatus.SC_NOT_FOUND; String errorMsg = null; - if (excp instanceof CambriaApiException) { + if (excp.getClass().toString().contains("CambriaApiException")) { status = ((CambriaApiException) excp).getStatus(); JSONTokener jsonTokener = new JSONTokener(((CambriaApiException) excp).getBody()); JSONObject errObject = new JSONObject(jsonTokener); @@ -496,7 +496,7 @@ public class MMServiceImpl implements MMService { int status = HttpStatus.SC_NOT_FOUND; String errorMsg = null; - if (excp instanceof CambriaApiException) { + if (excp.getClass().toString().contains("CambriaApiException")) { status = ((CambriaApiException) excp).getStatus(); JSONTokener jsonTokener = new JSONTokener(((CambriaApiException) excp).getBody()); JSONObject errObject = new JSONObject(jsonTokener); @@ -541,7 +541,7 @@ public class MMServiceImpl implements MMService { } catch (Exception excp) { int status = HttpStatus.SC_NOT_FOUND; String errorMsg = null; - if (excp instanceof CambriaApiException) { + if (excp.getClass().toString().contains("CambriaApiException")) { status = ((CambriaApiException) excp).getStatus(); JSONTokener jsonTokener = new JSONTokener(((CambriaApiException) excp).getBody()); JSONObject errObject = new JSONObject(jsonTokener); @@ -581,7 +581,7 @@ public class MMServiceImpl implements MMService { } catch (Exception excp) { int status = HttpStatus.SC_NOT_FOUND; String errorMsg = null; - if (excp instanceof CambriaApiException) { + if (excp.getClass().toString().contains("CambriaApiException")) { status = ((CambriaApiException) excp).getStatus(); JSONTokener jsonTokener = new JSONTokener(((CambriaApiException) excp).getBody()); JSONObject errObject = new JSONObject(jsonTokener); diff --git a/src/main/java/com/att/dmf/mr/service/impl/TopicServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/TopicServiceImpl.java index 4c872ad..f6d7b21 100644 --- a/src/main/java/com/att/dmf/mr/service/impl/TopicServiceImpl.java +++ b/src/main/java/com/att/dmf/mr/service/impl/TopicServiceImpl.java @@ -314,7 +314,7 @@ public class TopicServiceImpl implements TopicService { throw new CambriaApiException(errRes); } catch (com.att.dmf.mr.metabroker.Broker1.TopicExistsException e) { // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.error( e.getMessage()); } } diff --git a/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java index b624a39..73ad83b 100644 --- a/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java +++ b/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java @@ -30,9 +30,11 @@ import java.util.Map.Entry; import org.apache.kafka.common.errors.TopicExistsException; import org.json.JSONArray; +import org.json.JSONException; import org.json.JSONObject; import org.springframework.stereotype.Service; +import com.att.dmf.mr.CambriaApiException; import com.att.dmf.mr.beans.DMaaPContext; import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker; import com.att.dmf.mr.metabroker.Topic; @@ -100,10 +102,13 @@ public class UIServiceImpl implements UIService { /** * @param dmaapContext * @param apiKey + * @throws ConfigDbException + * @throws IOException + * @throws JSONException * @throws Exception */ @Override - public void getApiKey(DMaaPContext dmaapContext, String apiKey) throws Exception { + public void getApiKey(DMaaPContext dmaapContext, String apiKey) throws CambriaApiException, ConfigDbException, JSONException, IOException { // TODO - We need to work on the templates and how data will be set in // the template LOGGER.info("Fetching detials of apikey: " + apiKey); @@ -114,7 +119,7 @@ public class UIServiceImpl implements UIService { DMaaPResponseBuilder.respondOk(dmaapContext, key.asJsonObject()); } else { LOGGER.info("Details of apikey [" + apiKey + "] not found. Returning response"); - throw new Exception("Key [" + apiKey + "] not found."); + throw new CambriaApiException(400,"Key [" + apiKey + "] not found."); } } |