Merge "AafLurAndFish.java-logged exception"
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / resources / BridgeResource.java
index f1466ee..192b63d 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -35,7 +37,6 @@ import javax.ws.rs.core.Response.Status;
 import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
 import org.onap.dmaap.dbcapi.model.ApiError;
 import org.onap.dmaap.dbcapi.model.BrTopic;
-import org.onap.dmaap.dbcapi.model.Dmaap;
 import org.onap.dmaap.dbcapi.model.MirrorMaker;
 import org.onap.dmaap.dbcapi.service.ApiService;
 import org.onap.dmaap.dbcapi.service.MirrorMakerService;
@@ -60,7 +61,7 @@ public class BridgeResource extends BaseLoggingClass {
                        + "If detail param is true, list topics names, else just a count is returned.", 
        response = BrTopic.class)
 @ApiResponses( value = {
-    @ApiResponse( code = 200, message = "Success", response = Dmaap.class),
+    @ApiResponse( code = 200, message = "Success", response = BrTopic.class),
     @ApiResponse( code = 400, message = "Error", response = ApiError.class )
 })
        public Response getBridgedTopics(@QueryParam("mmagent") String mmagent,
@@ -122,7 +123,7 @@ public class BridgeResource extends BaseLoggingClass {
                        }
                        logger.info( "Count for "+ key + ": " + mCnt);
                        totCnt += mCnt;
-                       if (showDetail) {
+                       if (showDetail && mm!=null) {
                                brTopic[s] =  new BrTopic();
                                brTopic[s].setBrSource( mm.getSourceCluster());
                                brTopic[s].setBrTarget(mm.getTargetCluster());
@@ -148,7 +149,7 @@ public class BridgeResource extends BaseLoggingClass {
                                + "If split param is true, spread whitelist over smaller mmagents.", 
                response = MirrorMaker.class)
        @ApiResponses( value = {
-           @ApiResponse( code = 200, message = "Success", response = Dmaap.class),
+           @ApiResponse( code = 200, message = "Success", response = BrTopic.class),
            @ApiResponse( code = 400, message = "Error", response = ApiError.class )
        })
        public Response putBridgedTopics(@QueryParam("mmagent") String mmagent,