diff --git a/java/c/pom.xml b/java/c/pom.xml index 52962354047b1..fe57bd2ea0ec5 100644 --- a/java/c/pom.xml +++ b/java/c/pom.xml @@ -91,5 +91,16 @@ under the License. + + + org.apache.maven.plugins + maven-compiler-plugin + + + -Werror + + + + diff --git a/java/c/src/main/java/org/apache/arrow/c/ArrayExporter.java b/java/c/src/main/java/org/apache/arrow/c/ArrayExporter.java index 820a1522749c6..0c6b5de4486bc 100644 --- a/java/c/src/main/java/org/apache/arrow/c/ArrayExporter.java +++ b/java/c/src/main/java/org/apache/arrow/c/ArrayExporter.java @@ -90,7 +90,7 @@ void export(ArrowArray array, FieldVector vector, DictionaryProvider dictionaryP data.buffers = new ArrayList<>(vector.getExportedCDataBufferCount()); data.buffers_ptrs = - allocator.buffer((long) (vector.getExportedCDataBufferCount()) * Long.BYTES); + allocator.buffer((long) vector.getExportedCDataBufferCount() * Long.BYTES); vector.exportCDataBuffers(data.buffers, data.buffers_ptrs, NULL); if (dictionaryEncoding != null) { diff --git a/java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java b/java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java index 93fef6d7ca801..e47d27bf091ee 100644 --- a/java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java +++ b/java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java @@ -232,7 +232,7 @@ public List visit(ArrowType.Utf8 type) { private List visitVariableWidthView(ArrowType type) { final int viewBufferIndex = 1; final int variadicSizeBufferIndex = this.buffers.length - 1; - final long numOfVariadicBuffers = this.buffers.length - 3; + final long numOfVariadicBuffers = this.buffers.length - 3L; final long variadicSizeBufferCapacity = numOfVariadicBuffers * Long.BYTES; List buffers = new ArrayList<>(); diff --git a/java/c/src/test/java/org/apache/arrow/c/DictionaryTest.java b/java/c/src/test/java/org/apache/arrow/c/DictionaryTest.java index ce0e82586b766..8cd4913f22dd2 100644 --- a/java/c/src/test/java/org/apache/arrow/c/DictionaryTest.java +++ b/java/c/src/test/java/org/apache/arrow/c/DictionaryTest.java @@ -247,8 +247,8 @@ private void createStructVector(StructVector vector) { // Write the values to child 1 child1.allocateNew(); - child1.set(0, "01234567890".getBytes()); - child1.set(1, "012345678901234567".getBytes()); + child1.set(0, "01234567890".getBytes(StandardCharsets.UTF_8)); + child1.set(1, "012345678901234567".getBytes(StandardCharsets.UTF_8)); vector.setIndexDefined(0); // Write the values to child 2 @@ -269,8 +269,8 @@ private void createStructVectorInline(StructVector vector) { // Write the values to child 1 child1.allocateNew(); - child1.set(0, "012345678".getBytes()); - child1.set(1, "01234".getBytes()); + child1.set(0, "012345678".getBytes(StandardCharsets.UTF_8)); + child1.set(1, "01234".getBytes(StandardCharsets.UTF_8)); vector.setIndexDefined(0); // Write the values to child 2 diff --git a/java/c/src/test/java/org/apache/arrow/c/RoundtripTest.java b/java/c/src/test/java/org/apache/arrow/c/RoundtripTest.java index 18b2e94adde47..d8286465e475f 100644 --- a/java/c/src/test/java/org/apache/arrow/c/RoundtripTest.java +++ b/java/c/src/test/java/org/apache/arrow/c/RoundtripTest.java @@ -528,14 +528,6 @@ public void testVarBinaryVector() { } } - private String generateString(String str, int repetition) { - StringBuilder aRepeated = new StringBuilder(); - for (int i = 0; i < repetition; i++) { - aRepeated.append(str); - } - return aRepeated.toString(); - } - @Test public void testViewVector() { // ViewVarCharVector with short strings