Skip to content

Commit a208d99

Browse files
committed
used isNull and nonNull in OAIIndexEventConsumer
1 parent bccc4fd commit a208d99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dspace-oai/src/main/java/org/dspace/event/OAIIndexEventConsumer.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void initialize() throws Exception {
5858
*/
5959
public void consume(Context ctx, Event event) throws Exception {
6060

61-
if (itemsToUpdate == null) {
61+
if (Objects.isNull(itemsToUpdate)) {
6262
itemsToUpdate = new HashSet<Item>();
6363
}
6464

@@ -76,7 +76,7 @@ public void consume(Context ctx, Event event) throws Exception {
7676

7777
int et = event.getEventType();
7878

79-
if (object != null && event.getObjectType() == Constants.ITEM) {
79+
if (Objects.nonNull(object) && event.getObjectType() == Constants.ITEM) {
8080
//just update the object
8181
itemsToUpdate.add((Item)object);
8282
return;
@@ -134,7 +134,7 @@ public void end(Context ctx) throws Exception {
134134

135135
Set<Item> filtered = new HashSet<Item>(itemsToUpdate.size());
136136
for (Item item : itemsToUpdate) {
137-
if (item.getHandle() == null) {
137+
if (Objects.isNull(item.getHandle())) {
138138
// probably submission item, skip
139139
continue;
140140
}
@@ -156,7 +156,7 @@ public void end(Context ctx) throws Exception {
156156
itemsToUpdate = null;
157157
throw e;
158158
} finally {
159-
if (anonymousContext != null) {
159+
if (Objects.nonNull(anonymousContext)) {
160160
anonymousContext.complete();
161161
}
162162
}

0 commit comments

Comments
 (0)