Skip to content

Commit

Permalink
Fix using deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
yuokada committed Jan 8, 2024
1 parent ef7b5c3 commit 6c19e13
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import org.embulk.spi.Column;
import org.embulk.spi.ColumnVisitor;
import org.embulk.spi.PageBuilder;
import org.embulk.util.json.JsonParser;
import org.embulk.util.json.JsonValueParser;

import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
Expand Down Expand Up @@ -41,7 +42,6 @@ public class RandomjColumnVisitor
.filteredBy(CharacterPredicates.LETTERS, CharacterPredicates.DIGITS)
.build();
private final ZoneId zoneId = ZoneId.systemDefault();
private final JsonParser jsonParser = new JsonParser();
private final ObjectMapper mapper = new ObjectMapper();

private static final DateTimeFormatter formatter = DateTimeFormatter
Expand Down Expand Up @@ -236,11 +236,14 @@ public void jsonColumn(Column column)
}

try {
pageBuilder.setJson(column, jsonParser.parse(mapper.writeValueAsString(map)));
pageBuilder.setJson(column, JsonValueParser.builder().build(mapper.writeValueAsString(map)).readJsonValue());
}
catch (JsonProcessingException e) {
e.printStackTrace(); // NOSONAR
}
catch (IOException e) {
throw new RuntimeException(e);
}
}

private void visit(JsonNode node, JsonColumnVisitor visitor)
Expand Down

0 comments on commit 6c19e13

Please sign in to comment.