You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/09/02 09:14:22 UTC
[inlong] 02/02: [INLONG-5767][Sort] Fix IOUtils interface is incompatible in JDK 17 (#5768)
This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch release-1.3.0
in repository https://gitbox.apache.org/repos/asf/inlong.git
commit 8149441fb74e18afda89e18b60301df8899f66dd
Author: xuesongxs <54...@users.noreply.github.com>
AuthorDate: Fri Sep 2 15:20:26 2022 +0800
[INLONG-5767][Sort] Fix IOUtils interface is incompatible in JDK 17 (#5768)
---
.../org/apache/inlong/sort/tests/utils/FlinkContainerTestEnv.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/inlong-sort/sort-end-to-end-tests/src/test/java/org/apache/inlong/sort/tests/utils/FlinkContainerTestEnv.java b/inlong-sort/sort-end-to-end-tests/src/test/java/org/apache/inlong/sort/tests/utils/FlinkContainerTestEnv.java
index 914ac7285..bfe3bc6b1 100644
--- a/inlong-sort/sort-end-to-end-tests/src/test/java/org/apache/inlong/sort/tests/utils/FlinkContainerTestEnv.java
+++ b/inlong-sort/sort-end-to-end-tests/src/test/java/org/apache/inlong/sort/tests/utils/FlinkContainerTestEnv.java
@@ -18,6 +18,7 @@
package org.apache.inlong.sort.tests.utils;
+import org.apache.commons.io.IOUtils;
import org.apache.flink.api.common.JobStatus;
import org.apache.flink.api.common.time.Deadline;
import org.apache.flink.client.deployment.StandaloneClusterId;
@@ -42,7 +43,6 @@ import org.testcontainers.containers.Network;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.images.builder.Transferable;
import org.testcontainers.lifecycle.Startables;
-import sun.misc.IOUtils;
import javax.annotation.Nullable;
import java.io.File;
@@ -283,7 +283,7 @@ public abstract class FlinkContainerTestEnv extends TestLogger {
jarFile.stream().forEach(entry -> {
try (InputStream is = jarFile.getInputStream(entry)) {
jos.putNextEntry(entry);
- jos.write(IOUtils.readNBytes(is, is.available()));
+ jos.write(IOUtils.toByteArray(is));
jos.closeEntry();
} catch (IOException e) {
throw new RuntimeException(e);
@@ -293,8 +293,10 @@ public abstract class FlinkContainerTestEnv extends TestLogger {
for (Path jar : jars) {
try (InputStream is = new FileInputStream(jar.toFile())) {
jos.putNextEntry(new JarEntry("lib/" + jar.getFileName().toString()));
- jos.write(IOUtils.readNBytes(is, is.available()));
+ jos.write(IOUtils.toByteArray(is));
jos.closeEntry();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}