diff --git a/core/pom.xml b/core/pom.xml index a8cafd883..99844ad7a 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -119,7 +119,8 @@ com.github.haifengl smile-data 1.5.2 - provided + true + provided tech.tablesaw diff --git a/core/src/test/java/tech/tablesaw/io/html/HtmlWriterTest.java b/core/src/test/java/tech/tablesaw/io/html/HtmlWriterTest.java index 048fb5f26..c20048564 100644 --- a/core/src/test/java/tech/tablesaw/io/html/HtmlWriterTest.java +++ b/core/src/test/java/tech/tablesaw/io/html/HtmlWriterTest.java @@ -14,6 +14,7 @@ package tech.tablesaw.io.html; +import java.io.IOException; import java.io.StringWriter; import org.junit.jupiter.api.BeforeEach; @@ -37,7 +38,7 @@ public void setUp() throws Exception { } @Test - public void testWrite() { + public void testWrite() throws IOException { StringColumn byColumn = table.stringColumn("who"); TableSliceGroup group = StandardTableSliceGroup.create(table, byColumn); Table result = group.aggregate("approval", AggregateFunctions.mean); diff --git a/excel/pom.xml b/excel/pom.xml index fcd2bffeb..060258eb9 100644 --- a/excel/pom.xml +++ b/excel/pom.xml @@ -75,7 +75,7 @@ tech.tablesaw tablesaw-core - 0.32.1 + 0.32.2 provided diff --git a/html/pom.xml b/html/pom.xml index 7ad4ba617..28e86fb0a 100644 --- a/html/pom.xml +++ b/html/pom.xml @@ -75,7 +75,7 @@ tech.tablesaw tablesaw-core - 0.32.1 + 0.32.2 provided diff --git a/html/src/main/java/tech/tablesaw/io/html/HtmlWriter.java b/html/src/main/java/tech/tablesaw/io/html/HtmlWriter.java index 97e203a6f..81e0b96f6 100644 --- a/html/src/main/java/tech/tablesaw/io/html/HtmlWriter.java +++ b/html/src/main/java/tech/tablesaw/io/html/HtmlWriter.java @@ -40,7 +40,7 @@ public static void register(WriterRegistry registry) { registry.registerOptions(HtmlWriteOptions.class, INSTANCE); } - public void write(Table table, HtmlWriteOptions options) { + public void write(Table table, HtmlWriteOptions options) throws IOException { StringBuilder builder = new StringBuilder(); builder.append("").append(System.lineSeparator()); builder.append(header(table.columnNames())); @@ -51,13 +51,10 @@ public void write(Table table, HtmlWriteOptions options) { builder.append("").append(System.lineSeparator()); builder.append("
"); String str = builder.toString(); - try { - Writer writer = options.destination().createWriter(); - writer.write(str); - writer.flush(); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } + + Writer writer = options.destination().createWriter(); + writer.write(str); + writer.flush(); } /** @@ -100,7 +97,7 @@ private static String header(List columnNames) { } @Override - public void write(Table table, Destination dest) { + public void write(Table table, Destination dest) throws IOException { write(table, HtmlWriteOptions.build(dest).build()); } } \ No newline at end of file diff --git a/json/pom.xml b/json/pom.xml index 610c56f1b..46bfa8947 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -75,7 +75,7 @@ tech.tablesaw tablesaw-core - 0.32.1 + 0.32.2 provided diff --git a/json/src/main/java/tech/tablesaw/io/json/JsonWriter.java b/json/src/main/java/tech/tablesaw/io/json/JsonWriter.java index ec59b8d82..57f3735db 100644 --- a/json/src/main/java/tech/tablesaw/io/json/JsonWriter.java +++ b/json/src/main/java/tech/tablesaw/io/json/JsonWriter.java @@ -41,7 +41,7 @@ public static void register(WriterRegistry registry) { registry.registerOptions(JsonWriteOptions.class, INSTANCE); } - public void write(Table table, JsonWriteOptions options) { + public void write(Table table, JsonWriteOptions options) throws IOException { ArrayNode output = mapper.createArrayNode(); if (options.asObjects()) { for (int r = 0; r < table.rowCount(); r++) { @@ -67,18 +67,15 @@ public void write(Table table, JsonWriteOptions options) { output.add(row); } } - try { - String str = mapper.writeValueAsString(output); - Writer writer = options.destination().createWriter(); - writer.write(str); - writer.flush(); - } catch (IOException e) { - throw new IllegalStateException(e); - } + + String str = mapper.writeValueAsString(output); + Writer writer = options.destination().createWriter(); + writer.write(str); + writer.flush(); } @Override - public void write(Table table, Destination dest) { + public void write(Table table, Destination dest) throws IOException { write(table, JsonWriteOptions.builder(dest).build()); }