Skip to content

Commit 694aa2d

Browse files
committed
null safe
1 parent 3c8dd70 commit 694aa2d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

json-schema-validator/src/test/java/io/openapiprocessor/jsonschema/example/SetupExampleTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.junit.jupiter.api.Test;
1414

1515
import java.net.URI;
16+
import java.util.Collection;
1617

1718
import static io.openapiprocessor.jsonschema.support.Uris.createUri;
1819

@@ -81,10 +82,11 @@ void setupExample() throws ConverterException {
8182
boolean valid = result.isValid ();
8283

8384
// 7. print errors with error location
84-
if (!valid && result.getErrors () != null) {
85+
Collection<OutputUnit> errors = result.getErrors();
86+
if (!valid && errors != null) {
8587
System.out.println ("validation failed!");
8688

87-
for (OutputUnit error : result.getErrors ()) {
89+
for (OutputUnit error : errors) {
8890
String schemaLocation = error.getAbsoluteKeywordLocation ();
8991
schemaLocation = schemaLocation.substring (schemaLocation.indexOf ('#'));
9092

@@ -98,4 +100,4 @@ void setupExample() throws ConverterException {
98100
}
99101
}
100102
}
101-
}
103+
}

0 commit comments

Comments
 (0)