Skip to content

Commit

Permalink
Code update according to code review
Browse files Browse the repository at this point in the history
  • Loading branch information
taoliult committed Nov 5, 2024
1 parent 2852fd4 commit 0c2b4d9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,17 +344,17 @@ private static void getProfileID(Properties props) {
+ selectedProfile);
}
String defaultMatch = null;
Boolean profileExist = false;
boolean profileExists = false;
for (Object keyObject : props.keySet()) {
if (keyObject instanceof String key) {
if (key.startsWith(potentialProfileID)) {
profileExist = true;
profileExists = true;
if (key.endsWith(".desc.default")) {
// Check if property is set to true.
if (Boolean.parseBoolean(props.getProperty(key))) {
// Check if multiple defaults exist and act accordingly.
if (defaultMatch == null) {
defaultMatch = key.split("\\.desc")[0];
defaultMatch = key.substring(0, key.length() - ".desc.default".length());
} else {
printStackTraceAndExit("Multiple default RestrictedSecurity"
+ " profiles for " + selectedProfile);
Expand All @@ -364,7 +364,7 @@ private static void getProfileID(Properties props) {
}
}
}
if (!profileExist) {
if (!profileExists) {
printStackTraceAndExit(selectedProfile + " is not present in the java.security file.");
} else if (defaultMatch == null) {
printStackTraceAndExit("No default RestrictedSecurity profile was found for "
Expand Down

0 comments on commit 0c2b4d9

Please sign in to comment.