Skip to content

Commit

Permalink
Fix sonarqube fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Dang Ly committed Feb 1, 2024
1 parent 0051a32 commit 324ffa0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/java/com/rapiddweller/common/BeanUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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());
}
}

Expand Down

0 comments on commit 324ffa0

Please sign in to comment.