This is an automated email from the ASF dual-hosted git repository. pdallig pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push: new 27e9b8fb50 [ZEPPELIN-6276] Replace Deprecated Number Constructors for Java 11 27e9b8fb50 is described below commit 27e9b8fb5010a79e939f9382a917d8d031fe181b Author: YeonKyung Ryu <80758099+celin...@users.noreply.github.com> AuthorDate: Tue Aug 19 23:20:59 2025 +0900 [ZEPPELIN-6276] Replace Deprecated Number Constructors for Java 11 ### What is this PR for? This PR removes usages of deprecated Number constructors (e.g., `new Integer()`, `new Double()`, `new Long()`) and replaces them with factory methods such as `valueOf()` or `parseXxx()` methods. The goal is to improve Java 11 compatibility and eliminate compiler warnings related to deprecated APIs. ### What type of PR is it? Refactoring ### Todos * [x] - Replace deprecated constructors * [x] - Verify compatibility with Java 11 ### What is the Jira issue? [ZEPPELIN-6276](https://issues.apache.org/jira/browse/ZEPPELIN-6276) ### How should this be tested? ### Screenshots (if appropriate) ### Questions: * Does the license files need to update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Closes #5027 from celinayk/feature/replace-constructors. Signed-off-by: Philipp Dallig <philipp.dal...@gmail.com> --- rlang/src/main/java/org/apache/zeppelin/r/ZeppelinR.java | 4 ++-- .../java/org/apache/zeppelin/interpreter/KerberosInterpreter.java | 4 ++-- .../test/java/org/apache/zeppelin/resource/ResourceSetTest.java | 4 ++-- .../apache/zeppelin/interpreter/remote/AppendOutputRunner.java | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rlang/src/main/java/org/apache/zeppelin/r/ZeppelinR.java b/rlang/src/main/java/org/apache/zeppelin/r/ZeppelinR.java index 436da00510..91871c39c3 100644 --- a/rlang/src/main/java/org/apache/zeppelin/r/ZeppelinR.java +++ b/rlang/src/main/java/org/apache/zeppelin/r/ZeppelinR.java @@ -49,14 +49,14 @@ public class ZeppelinR { * Request to R repl */ private Request rRequestObject = null; - private Integer rRequestNotifier = new Integer(0); + private Integer rRequestNotifier = Integer.valueOf(0); /** * Response from R repl */ private Object rResponseValue = null; private boolean rResponseError = false; - private Integer rResponseNotifier = new Integer(0); + private Integer rResponseNotifier = Integer.valueOf(0); public ZeppelinR(RInterpreter rInterpreter) { this.rInterpreter = rInterpreter; diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java index 807b9c195b..158f301261 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java @@ -95,8 +95,8 @@ public abstract class KerberosInterpreter extends AbstractInterpreter { //defined in zeppelin-env.sh, if not initialized then the default value is 5. if (System.getenv("KINIT_FAIL_THRESHOLD") != null) { try { - kinitFailThreshold = new Integer(System.getenv("KINIT_FAIL_THRESHOLD")); - } catch (Exception e) { + kinitFailThreshold = Integer.valueOf(System.getenv("KINIT_FAIL_THRESHOLD")); + } catch (NumberFormatException e) { LOGGER.error("Cannot get integer value from the given string, " + System .getenv("KINIT_FAIL_THRESHOLD") + " defaulting to " + kinitFailThreshold, e); } diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java index cb383b9ad8..8311cd468c 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java @@ -30,7 +30,7 @@ class ResourceSetTest { ResourceSet set = new ResourceSet(); set.add(new Resource(null, new ResourceId("poo1", "resource1"), "value1")); - set.add(new Resource(null, new ResourceId("poo1", "resource2"), new Integer(2))); + set.add(new Resource(null, new ResourceId("poo1", "resource2"), Integer.valueOf(2))); assertEquals(2, set.filterByNameRegex(".*").size()); assertEquals(1, set.filterByNameRegex("resource1").size()); assertEquals(1, set.filterByNameRegex("resource2").size()); @@ -43,7 +43,7 @@ class ResourceSetTest { ResourceSet set = new ResourceSet(); set.add(new Resource(null, new ResourceId("poo1", "resource1"), "value1")); - set.add(new Resource(null, new ResourceId("poo1", "resource2"), new Integer(2))); + set.add(new Resource(null, new ResourceId("poo1", "resource2"), Integer.valueOf(2))); assertEquals(1, set.filterByClassnameRegex(".*String").size()); assertEquals(1, set.filterByClassnameRegex(String.class.getName()).size()); diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/AppendOutputRunner.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/AppendOutputRunner.java index b300ed84c1..93dd328296 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/AppendOutputRunner.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/AppendOutputRunner.java @@ -37,9 +37,9 @@ import java.util.concurrent.LinkedBlockingQueue; public class AppendOutputRunner implements Runnable { private static final Logger LOGGER = LoggerFactory.getLogger(AppendOutputRunner.class); - public static final Long BUFFER_TIME_MS = new Long(100); - private static final Long SAFE_PROCESSING_TIME = new Long(10); - private static final Long SAFE_PROCESSING_STRING_SIZE = new Long(100000); + public static final Long BUFFER_TIME_MS = Long.valueOf(100); + private static final Long SAFE_PROCESSING_TIME = Long.valueOf(10); + private static final Long SAFE_PROCESSING_STRING_SIZE = Long.valueOf(100000); private final BlockingQueue<AppendOutputBuffer> queue = new LinkedBlockingQueue<>(); private final RemoteInterpreterProcessListener listener; @@ -90,7 +90,7 @@ public class AppendOutputRunner implements Runnable { LOGGER.debug("Processing time for append-output took {} milliseconds", processingTime); } - Long sizeProcessed = new Long(0); + Long sizeProcessed = Long.valueOf(0); for (Entry<String, StringBuilder> stringBufferMapEntry : stringBufferMap.entrySet()) { String stringBufferKey = stringBufferMapEntry.getKey(); StringBuilder buffer = stringBufferMapEntry.getValue();