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>
throw new AAIException("AAI_3000", "uri and payload keys don't match");
}
}
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) {
boolean isRealTimeClient = AAIConfig.get("aai.realtime.clients", "").contains(fromAppId);
if (isRealTimeClient || realTime != null) {
- type = DBConnectionType.REALTIME;
+ return DBConnectionType.REALTIME;
- type = DBConnectionType.CACHED;
+ return DBConnectionType.CACHED;