From 189af5029addc72c91300e3e53466de5a1ca9894 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Mon, 27 Nov 2023 11:26:01 +0100 Subject: [PATCH] ensure JDK 8 compatibility Signed-off-by: Ceki Gulcu --- .../ch/qos/logback/classic/encoder/JsonEncoderTest.java | 3 ++- .../qos/logback/core/net/HardenedObjectInputStream.java | 8 +------- .../src/main/java/ch/qos/logback/core/util/EnvUtil.java | 2 -- pom.xml | 9 +-------- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/encoder/JsonEncoderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/encoder/JsonEncoderTest.java index a7ed08da6a..34e2a5a53f 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/encoder/JsonEncoderTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/encoder/JsonEncoderTest.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; @@ -318,7 +319,7 @@ void withJoran() throws JoranException, IOException { StatusPrinter.print(loggerContext); - Path configFilePath = Path.of(ClassicTestConstants.OUTPUT_DIR_PREFIX+"json/test-" + diff + ".json"); + Path configFilePath = FileSystems.getDefault().getPath(ClassicTestConstants.OUTPUT_DIR_PREFIX+"json/test-" + diff + ".json"); List lines = Files.readAllLines(configFilePath); int count = 4; assertEquals(count, lines.size()); diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/HardenedObjectInputStream.java b/logback-core/src/main/java/ch/qos/logback/core/net/HardenedObjectInputStream.java index 185d8fbd73..c01812f768 100755 --- a/logback-core/src/main/java/ch/qos/logback/core/net/HardenedObjectInputStream.java +++ b/logback-core/src/main/java/ch/qos/logback/core/net/HardenedObjectInputStream.java @@ -16,7 +16,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InvalidClassException; -import java.io.ObjectInputFilter; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; import java.util.ArrayList; @@ -44,7 +43,6 @@ public class HardenedObjectInputStream extends ObjectInputStream { public HardenedObjectInputStream(InputStream in, String[] whitelist) throws IOException { super(in); - this.initObjectFilter(); this.whitelistedClassNames = new ArrayList(); if (whitelist != null) { for (int i = 0; i < whitelist.length; i++) { @@ -53,11 +51,7 @@ public HardenedObjectInputStream(InputStream in, String[] whitelist) throws IOEx } } - private void initObjectFilter() { - this.setObjectInputFilter(ObjectInputFilter.Config.createFilter( - "maxarray=" + ARRAY_LIMIT + ";maxdepth=" + DEPTH_LIMIT + ";" - )); - } + public HardenedObjectInputStream(InputStream in, List whitelist) throws IOException { super(in); diff --git a/logback-core/src/main/java/ch/qos/logback/core/util/EnvUtil.java b/logback-core/src/main/java/ch/qos/logback/core/util/EnvUtil.java index 0fde0b7fe2..d4a3d12b14 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/util/EnvUtil.java +++ b/logback-core/src/main/java/ch/qos/logback/core/util/EnvUtil.java @@ -13,9 +13,7 @@ */ package ch.qos.logback.core.util; -import java.lang.module.ModuleDescriptor; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.Optional; /** diff --git a/pom.xml b/pom.xml index eed6bb198c..4e69c58d73 100755 --- a/pom.xml +++ b/pom.xml @@ -381,8 +381,7 @@ org.apache.maven.plugins maven-compiler-plugin -<<<<<<< HEAD - + default-compile @@ -410,12 +409,6 @@ -======= - - - ${jdk.version} - ->>>>>>> 9a1fc44f8 (add support for Virtual threads)