From 324ffa0fa2d38d761626ea6c2470ec10b1699be4 Mon Sep 17 00:00:00 2001 From: Dang Ly Date: Thu, 1 Feb 2024 17:58:16 +0700 Subject: [PATCH] Fix sonarqube fails --- src/main/java/com/rapiddweller/common/BeanUtil.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/rapiddweller/common/BeanUtil.java b/src/main/java/com/rapiddweller/common/BeanUtil.java index 060b0bd..0493c6c 100644 --- a/src/main/java/com/rapiddweller/common/BeanUtil.java +++ b/src/main/java/com/rapiddweller/common/BeanUtil.java @@ -1484,9 +1484,8 @@ private static void findClassesInNestedJar(String path, String packagePath, List URL nestedJarUrl = new URL("jar:file:" + outerJarFilePath + "!/" + nestedJarEntryName); // Create a custom class loader with the nested JAR in the classpath - URLClassLoader classLoader = new URLClassLoader(new URL[]{nestedJarUrl}, BeanUtil.class.getClassLoader()); - try (InputStream is = nestedJarUrl.openStream(); JarInputStream jarInputStream = new JarInputStream(is)) { + try (URLClassLoader classLoader = new URLClassLoader(new URL[]{nestedJarUrl}, BeanUtil.class.getClassLoader()); InputStream is = nestedJarUrl.openStream(); JarInputStream jarInputStream = new JarInputStream(is)) { JarEntry entry; while ((entry = jarInputStream.getNextJarEntry()) != null) { String entryName = entry.getName(); @@ -1500,13 +1499,12 @@ private static void findClassesInNestedJar(String path, String packagePath, List } } } else { - System.out.println("Nested JAR file not found in the outer JAR."); + logger.warn("Nested JAR file not found in the outer JAR."); } outerJarFile.close(); } catch (IOException | ClassNotFoundException e) { - e.printStackTrace(); - // Handle the exception as needed + logger.error(e.getMessage()); } }