Skip to content

Commit

Permalink
Merge pull request #2663 from bstansberry/WFCORE-3115
Browse files Browse the repository at this point in the history
[WFCORE-3115] Close the stream used to read the manifest
  • Loading branch information
bstansberry committed Jul 27, 2017
2 parents 340f798 + 8ee8e34 commit b29fa72
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions version/src/main/java/org/jboss/as/version/ProductConfig.java
Expand Up @@ -72,15 +72,16 @@ private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Ma
String productVersion = null;
String consoleSlot = null;

InputStream manifestStream = null;
try {

if (productConfProps.productModuleId != null) {
Module module = loader.loadModule(productConfProps.productModuleId);

InputStream stream = module.getClassLoader().getResourceAsStream("META-INF/MANIFEST.MF");
manifestStream = module.getClassLoader().getResourceAsStream("META-INF/MANIFEST.MF");
Manifest manifest = null;
if (stream != null) {
manifest = new Manifest(stream);
if (manifestStream != null) {
manifest = new Manifest(manifestStream);
}

if (manifest != null) {
Expand All @@ -94,6 +95,8 @@ private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Ma
setSystemProperties(productConfProps.miscProperties, providedProperties);
} catch (Exception e) {
// Don't care
} finally {
safeClose(manifestStream);
}
isProduct = productName != null && !productName.isEmpty() && projectName == null;
name = isProduct ? productName : projectName;
Expand Down

0 comments on commit b29fa72

Please sign in to comment.