Skip to content

Commit 2e92e93

Browse files
Refactor code in 'Dispatcher' class where calling .get() followed by .toString() will throw a NPE by calling String.valueOf() which can handle NPEs
1 parent 797bb0e commit 2e92e93

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/edu/ucsb/nceas/mdqengine/dispatch/Dispatcher.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,9 @@ public Result dispatch(Map<String, Object> variables, String code) throws Script
184184
ArrayList<?> out_ids_l = (ArrayList<?>) out_ids;
185185

186186
for (int i = 0; i < out_py_l.size(); i++) {
187-
Output o = new Output(out_py_l.get(i).toString());
188-
189-
String id = out_ids_l.get(i).toString();
190-
String type = out_type_l.get(i).toString();
187+
Output o = new Output(String.valueOf(out_py_l.get(i)));
188+
String id = String.valueOf(out_ids_l.get(i));
189+
String type = String.valueOf(out_type_l.get(i));
191190

192191
o.setIdentifier(id);
193192
o.setType(type);

0 commit comments

Comments
 (0)