diff options
-rw-r--r-- | src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java | 4 | ||||
-rw-r--r-- | src/main/java/org/onap/music/eelf/logging/MusicLoggingServletFilter.java | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java b/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java index cf4b2bc9..fbfc0de6 100644 --- a/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java +++ b/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java @@ -32,7 +32,6 @@ import org.onap.music.eelf.logging.EELFLoggerDelegate; import org.onap.music.eelf.logging.format.AppMessages; import org.onap.music.eelf.logging.format.ErrorSeverity; import org.onap.music.eelf.logging.format.ErrorTypes; -import org.onap.music.exceptions.MusicLockingException; import org.onap.music.exceptions.MusicQueryException; import org.onap.music.exceptions.MusicServiceException; import org.onap.music.main.MusicUtil; @@ -68,7 +67,7 @@ public class MusicHealthCheck { result = getAdminKeySpace(consistency, randomUUID); } } catch (MusicServiceException e1) { - logger.error(EELFLoggerDelegate.errorLogger, e1.getMessage(), AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN); + logger.error(EELFLoggerDelegate.errorLogger, e1.getMessage(), AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN, e1); } catch (MusicQueryException e1) { logger.error(EELFLoggerDelegate.errorLogger, e1.getMessage(), AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN,e1); } @@ -80,7 +79,6 @@ public class MusicHealthCheck { try { cleanHealthCheckId(randomUUID); } catch (MusicServiceException | MusicQueryException e) { - // TODO Auto-generated catch block logger.error("Error while cleaning healthcheck record id...", e); } if (result) { diff --git a/src/main/java/org/onap/music/eelf/logging/MusicLoggingServletFilter.java b/src/main/java/org/onap/music/eelf/logging/MusicLoggingServletFilter.java index 7eca73e1..0f078a97 100644 --- a/src/main/java/org/onap/music/eelf/logging/MusicLoggingServletFilter.java +++ b/src/main/java/org/onap/music/eelf/logging/MusicLoggingServletFilter.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property * =================================================================== + * Modifications Copyright (C) 2019 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 @@ -107,44 +109,44 @@ public class MusicLoggingServletFilter implements Filter { .collect(Collectors.toMap(entry -> entry.getKey().toUpperCase(), entry -> entry.getValue())); // Enable/disable keys are present in /opt/app/music/etc/music.properties - if (Boolean.valueOf(MusicUtil.getTransIdRequired()) + if (MusicUtil.getTransIdRequired() && !upperCaseHeaderMap.containsKey(TRANSACTION_ID.toUpperCase())) { populateError(httpResponse, "Transaction id '" + TRANSACTION_ID + "' required on http header"); return; } else { populateMDCAndResponseHeader(upperCaseHeaderMap, TRANSACTION_ID, "transactionId", - Boolean.valueOf(MusicUtil.getTransIdRequired()), httpResponse); + MusicUtil.getTransIdRequired(), httpResponse); } - if (Boolean.valueOf(MusicUtil.getConversationIdRequired()) + if (MusicUtil.getConversationIdRequired() && !upperCaseHeaderMap.containsKey(CONVERSATION_ID.toUpperCase())) { populateError(httpResponse, "Conversation Id '" + CONVERSATION_ID + "' required on http header"); return; } else { populateMDCAndResponseHeader(upperCaseHeaderMap, CONVERSATION_ID, "conversationId", - Boolean.valueOf(MusicUtil.getConversationIdRequired()), httpResponse); + MusicUtil.getConversationIdRequired(), httpResponse); } - if (Boolean.valueOf(MusicUtil.getMessageIdRequired()) + if (MusicUtil.getMessageIdRequired() && !upperCaseHeaderMap.containsKey(MESSAGE_ID.toUpperCase())) { populateError(httpResponse, "Message Id '" + MESSAGE_ID + "' required on http header"); return; } else { populateMDCAndResponseHeader(upperCaseHeaderMap, MESSAGE_ID, "messageId", - Boolean.valueOf(MusicUtil.getMessageIdRequired()), httpResponse); + MusicUtil.getMessageIdRequired(), httpResponse); } - if (Boolean.valueOf(MusicUtil.getClientIdRequired()) + if (MusicUtil.getClientIdRequired() && !upperCaseHeaderMap.containsKey(CLIENT_ID.toUpperCase())) { populateError(httpResponse, "Client Id '" + CLIENT_ID + "' required on http header"); return; } else { populateMDCAndResponseHeader(upperCaseHeaderMap, CLIENT_ID, "clientId", - Boolean.valueOf(MusicUtil.getClientIdRequired()), httpResponse); + MusicUtil.getClientIdRequired(), httpResponse); } } |