Skip to content

Commit

Permalink
[cucumber 5] npe fix
Browse files Browse the repository at this point in the history
  • Loading branch information
savkk committed Jun 14, 2024
1 parent 8a7c356 commit 34a153f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
Expand Down Expand Up @@ -59,8 +60,12 @@ private void testCaseStarted(TestStepStarted event) {
URI uri = testCase.getUri();
Parser<GherkinDocument> gherkinParser = new Parser<>(new AstBuilder());
try {
GherkinDocument gherkinDocument = gherkinParser.parse(new String(Files.readAllBytes(Paths.get(this.getClass().getClassLoader()
.getResource(uri.toString().replace("classpath:", "")).toURI()))));
URL resource = this.getClass().getClassLoader()
.getResource(uri.toString().replace("classpath:", ""));
if (resource == null) {
return;
}
GherkinDocument gherkinDocument = gherkinParser.parse(new String(Files.readAllBytes(Paths.get(resource.toURI()))));
parseExamples(uri, gherkinDocument);
} catch (URISyntaxException | IOException e) {
log.error(e.getMessage());
Expand Down

0 comments on commit 34a153f

Please sign in to comment.