From d74a925452d8c5a45e1a5be7182a2dc6b6368e5f Mon Sep 17 00:00:00 2001 From: Oscar Westra van Holthe - Kind Date: Thu, 9 Nov 2023 10:18:17 +0100 Subject: [PATCH] AVRO-3666: Debug ARM build Fix the compile error by disabling the cache for the Hadoop2 build. This cannot be code related, as the other test builds succeed. --- .github/workflows/test-lang-java.yml | 2 +- .mvn/extensions.xml | 2 +- lang/java/build.sh | 3 ++- .../tools/src/main/java/org/apache/avro/tool/IdlTool.java | 7 ++++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-lang-java.yml b/.github/workflows/test-lang-java.yml index 7aaf1b9ce77..3fcc8a5dcb6 100644 --- a/.github/workflows/test-lang-java.yml +++ b/.github/workflows/test-lang-java.yml @@ -181,4 +181,4 @@ jobs: java -version mvn -version #MAVEN_OPTS="-Dsurefire.excludes=*TestCustomCodec*,*TestAllCodecs*,*TestNettyServer*" ./build.sh clean test - ./build.sh clean test \ No newline at end of file + ./build.sh clean test diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index c6000969d38..e2e84018d96 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -20,6 +20,6 @@ org.apache.maven.extensions maven-build-cache-extension - 1.0.0 + 1.0.1 diff --git a/lang/java/build.sh b/lang/java/build.sh index 96fdb3489cb..976f67dab4e 100755 --- a/lang/java/build.sh +++ b/lang/java/build.sh @@ -16,6 +16,7 @@ # limitations under the License. set -e +set -x usage() { echo "Usage: $0 {lint|test|dist|clean}" @@ -33,7 +34,7 @@ main() { test) mvn -B test # Test the modules that depend on hadoop using Hadoop 2 - mvn -B test -Phadoop2 + mvn -Dmaven.build.cache.enabled=false -B test -Phadoop2 ;; dist) mvn -P dist package -DskipTests javadoc:aggregate diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/IdlTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/IdlTool.java index a0acd520199..6ef82714678 100644 --- a/lang/java/tools/src/main/java/org/apache/avro/tool/IdlTool.java +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/IdlTool.java @@ -25,9 +25,9 @@ import org.apache.avro.idl.IdlReader; import java.io.File; -import java.io.FileOutputStream; import java.io.InputStream; import java.io.PrintStream; +import java.nio.file.Files; import java.util.List; /** @@ -56,8 +56,9 @@ public int run(InputStream in, PrintStream out, PrintStream err, List ar File outputFile = "-".equals(outputName) ? null : new File(outputName); Schema m = null; - Protocol p = null; + Protocol p; if (useJavaCC) { + // noinspection deprecation try (Idl parser = new Idl(inputFile)) { p = parser.CompilationUnit(); for (String warning : parser.getWarningsAfterParsing()) { @@ -77,7 +78,7 @@ public int run(InputStream in, PrintStream out, PrintStream err, List ar PrintStream parseOut = out; if (outputFile != null) { - parseOut = new PrintStream(new FileOutputStream(outputFile)); + parseOut = new PrintStream(Files.newOutputStream(outputFile.toPath())); } if (m == null && p == null) {