Skip to content

Commit

Permalink
fix fortify issues (#645)
Browse files Browse the repository at this point in the history
Signed-off-by: Meina Zhou <[email protected]>
  • Loading branch information
zhoumeina authored Jan 7, 2019
1 parent 97bb683 commit 79ca99f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
18 changes: 10 additions & 8 deletions h5c/vic-service/src/main/java/com/vmware/vic/PropFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,17 @@ private static VimPortType initializeVimPort() {
_logger.error(e);
}

javax.net.ssl.SSLSessionContext sslsc = sc.getServerSessionContext();
sslsc.setSessionTimeout(0);
try {
sc.init(null, tms, null);
} catch (KeyManagementException e) {
_logger.error(e);
if (null != sc) {
javax.net.ssl.SSLSessionContext sslsc = sc.getServerSessionContext();
sslsc.setSessionTimeout(0);
try {
sc.init(null, tms, null);
} catch (KeyManagementException e) {
_logger.error(e);
}
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(
sc.getSocketFactory());
}
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(
sc.getSocketFactory());
}

public PropFetcher(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ public class ConfigLoader {
private final Properties prop;

public ConfigLoader(String configFile) throws IOException {
prop = new Properties();
InputStream is = getClass().getClassLoader().getResourceAsStream(configFile);
if (is != null) {
prop.load(is);
} else {
throw new FileNotFoundException("'" + configFile + "' was not found");
InputStream is = null;
try {
prop = new Properties();
is = getClass().getClassLoader().getResourceAsStream(configFile);
if (is != null) {
prop.load(is);
} else {
throw new FileNotFoundException("'" + configFile + "' was not found");
}
} finally {
if(is != null) {
is.close();
}
}
}

Expand Down

0 comments on commit 79ca99f

Please sign in to comment.