Skip to content

Commit

Permalink
fix: Ensure retrievePomProperties always returns non-null (#5512)
Browse files Browse the repository at this point in the history
  • Loading branch information
aikebah authored Feb 28, 2023
2 parents c6566c5 + 7591497 commit 905f74f
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,11 @@ protected boolean analyzePOM(Dependency dependency, List<ClassNameInformation> c
* @return a Properties object or null if no pom.properties was found
*/
private Properties retrievePomProperties(String path, final JarFile jar) {
Properties pomProperties = null;
final Properties pomProperties = new Properties();
final String propPath = path.substring(0, path.length() - 7) + "pom.properties";
final ZipEntry propEntry = jar.getEntry(propPath);
if (propEntry != null) {
try (Reader reader = new InputStreamReader(jar.getInputStream(propEntry), StandardCharsets.UTF_8)) {
pomProperties = new Properties();
pomProperties.load(reader);
LOGGER.debug("Read pom.properties: {}", propPath);
} catch (UnsupportedEncodingException ex) {
Expand Down

0 comments on commit 905f74f

Please sign in to comment.