Skip to content

Commit 654a592

Browse files
authored
bugfix: IdRulesHandler, objects null check added. RmqHandler rabbit user & password activated. (#18)
1 parent d291e44 commit 654a592

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

src/main/java/com/ericsson/ei/handlers/IdRulesHandler.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,26 @@ public void setJmesPathInterface(JmesPathInterface jmesPathInterface) {
3838
}
3939

4040
public void runIdRules(RulesObject rulesObject, String event) {
41-
JsonNode idsJsonObj = getIds(rulesObject, event);
42-
ArrayList<String> objects = null;
43-
String id;
44-
if (idsJsonObj.isArray()) {
45-
for (final JsonNode idJsonObj : idsJsonObj) {
46-
id = idJsonObj.textValue();
47-
objects = matchIdRulesHandler.fetchObjectsById(rulesObject, id);
48-
for (String object:objects) {
49-
extractionHandler.runExtraction(rulesObject, id, event, object);
50-
}
51-
if (objects.size() == 0){
52-
if (rulesObject.isStartEventRules()) {
53-
extractionHandler.runExtraction(rulesObject, id, event, (JsonNode)null);
54-
} else {
55-
try {
56-
waitListStorageHandler.addEventToWaitList(event, rulesObject);
57-
} catch (Exception e) {
58-
log.info(e.getMessage(),e);
41+
if (rulesObject != null && event != null) {
42+
JsonNode idsJsonObj = getIds(rulesObject, event);
43+
ArrayList<String> objects = null;
44+
String id;
45+
if (idsJsonObj != null && idsJsonObj.isArray()) {
46+
for (final JsonNode idJsonObj : idsJsonObj) {
47+
id = idJsonObj.textValue();
48+
objects = matchIdRulesHandler.fetchObjectsById(rulesObject, id);
49+
for (String object : objects) {
50+
extractionHandler.runExtraction(rulesObject, id, event, object);
51+
}
52+
if (objects.size() == 0) {
53+
if (rulesObject.isStartEventRules()) {
54+
extractionHandler.runExtraction(rulesObject, id, event, (JsonNode) null);
55+
} else {
56+
try {
57+
waitListStorageHandler.addEventToWaitList(event, rulesObject);
58+
} catch (Exception e) {
59+
log.info(e.getMessage(), e);
60+
}
5961
}
6062
}
6163
}

src/main/java/com/ericsson/ei/rmqhandler/RmqHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ ConnectionFactory connectionFactory() {
151151
factory = new CachingConnectionFactory(host, port);
152152
factory.setPublisherConfirms(true);
153153
factory.setPublisherReturns(true);
154-
// factory.setUsername("guest");
155-
// factory.setPassword("guest");
154+
if(user != null && user.length() !=0 && password != null && password.length() !=0) {
155+
factory.setUsername(user);
156+
factory.setPassword(password);
157+
}
156158
return factory;
157159
}
158160

0 commit comments

Comments
 (0)