summaryrefslogtreecommitdiffstats
path: root/aai-core/src
diff options
context:
space:
mode:
authorPavel Paroulek <pavel.paroulek@orange.com>2017-11-21 11:06:09 +0100
committerPavel Paroulek <pavel.paroulek@orange.com>2017-11-21 11:06:09 +0100
commit9f3d13ee1d6ad9c16bd4a9cd3c697e973bcd828b (patch)
treeac81e9d1145a86614fefdcef655fa14d5c89b618 /aai-core/src
parent722f59e75b5e8d6b2f7ade57c00db8c4b9e75078 (diff)
add aai exception when missing FromAppId header
adding an aai exception so that instead of NPE a 4009 exception is thrown in case of a missing FromAppId header Change-Id: Ie58f467c6e541e96a0f1cfdd4024c14bdf9aa565 Issue-ID: AAI-480 Signed-off-by: Pavel Paroulek <pavel.paroulek@orange.com>
Diffstat (limited to 'aai-core/src')
-rw-r--r--aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java b/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java
index 3895f626..f26ac197 100644
--- a/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java
+++ b/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java
@@ -249,17 +249,18 @@ public class RESTAPI {
throw new AAIException("AAI_3000", "uri and payload keys don't match");
}
}
-
- protected DBConnectionType determineConnectionType(String fromAppId, String realTime) {
- DBConnectionType type = DBConnectionType.REALTIME;
+
+ protected DBConnectionType determineConnectionType(String fromAppId, String realTime) throws AAIException {
+ if (fromAppId == null) {
+ throw new AAIException("AAI_4009", "X-FromAppId is not set");
+ }
+
boolean isRealTimeClient = AAIConfig.get("aai.realtime.clients", "").contains(fromAppId);
if (isRealTimeClient || realTime != null) {
- type = DBConnectionType.REALTIME;
+ return DBConnectionType.REALTIME;
} else {
- type = DBConnectionType.CACHED;
+ return DBConnectionType.CACHED;
}
-
- return type;
}
/**