Fix it if the transaction id is missing 63/22563/2
authorVenkata Harish K Kajur <vk250x@att.com>
Tue, 7 Nov 2017 16:36:08 +0000 (11:36 -0500)
committerVenkata Harish K Kajur <vk250x@att.com>
Tue, 7 Nov 2017 16:44:28 +0000 (11:44 -0500)
alert the client that they need to specify header

Issue-ID: AAI-454
Change-Id: I2032163172bbb987c060b41dcffc494d18c58b13
Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
aai-core/src/main/java/org/onap/aai/logging/LoggingContext.java
aai-core/src/test/java/org/onap/aai/logging/LoggingContextTest.java

index ed33228..627a2f8 100644 (file)
@@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
+import org.onap.aai.exceptions.AAIException;
 import org.slf4j.MDC;
 
 import com.att.eelf.configuration.EELFLogger;
@@ -114,7 +115,12 @@ public class LoggingContext {
                MDC.put(LoggingField.REQUEST_ID.toString(), requestId.toString());
        }
 
-       public static void requestId(String requestId) {
+       public static void requestId(String requestId) throws AAIException {
+
+               if(requestId == null){
+                       throw new AAIException("AAI_4010");
+               }
+
                try {
                        if (requestId.contains(":")) {
                                String[] uuidParts = requestId.split(":");
index 46ac599..7885410 100644 (file)
@@ -53,7 +53,7 @@ public class LoggingContextTest {
        }
 
        @Test
-       public void testRequestId() { //AKA Transaction ID
+       public void testRequestId() throws Exception { //AKA Transaction ID
                final String sUuid = "57d51eaa-edc6-4f50-a69d-f2d4d2445120";
 
                LoggingContext.requestId(sUuid);