Skip to content

Commit

Permalink
cdxj output: Ensure writer isn't closed by JsonGenerator
Browse files Browse the repository at this point in the history
This was causing the output to cut short after the first CDXJ record.
  • Loading branch information
ato committed Jun 1, 2023
1 parent 0515e38 commit d2370cf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/outbackcdx/WbCdxApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ public void writeCapture(Capture capture) throws IOException {
writer.write(String.valueOf(capture.timestamp));
writer.write(' ');
try (JsonGenerator generator = Json.JSON_MAPPER.createGenerator(writer)) {
generator.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
List<String> filteredFields = Arrays.stream(query.fields).filter(f -> !f.equals("urlkey") && !f.equals("timestamp")).collect(toList());
generator.writeStartObject();
for (String field : filteredFields) {
Expand Down

0 comments on commit d2370cf

Please # to comment.