Skip to content

Commit

Permalink
Update according to code review
Browse files Browse the repository at this point in the history
  • Loading branch information
taoliult committed Mar 21, 2023
1 parent c8a907e commit 691714e
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,8 @@ private void initConstraints() {
debug.println("Loading constraints for security provider: " + providerName);
}

// Check if the provider has constraints
if (providerInfo.indexOf('[') < 0 && providerInfo.indexOf(']') < 0) {
// Check if the provider has constraints.
if (providerInfo.indexOf('[') < 0) {
if (debug != null) {
debug.println("No constraints for security provider: " + providerName);
}
Expand All @@ -675,15 +675,15 @@ private void initConstraints() {

// Remove the whitespaces in the format separator if there are.
providerInfo = providerInfo.trim()
.replaceAll("\\[\\s*\\{", "[{")
.replaceAll("\\}\\s*\\]", "}]")
.replaceAll("\\[\\s+\\{", "[{")
.replaceAll("\\}\\s+\\]", "}]")
.replaceAll("\\}\\s*,\\s*\\{", "},{");

int startIndex = providerInfo.indexOf("[{");
int startIndex = providerInfo.lastIndexOf("[{");
int endIndex = providerInfo.indexOf("}]");

// Provider with constraints.
if ((startIndex > 0) && (endIndex > 0)) {
if ((startIndex > 0) && (endIndex > startIndex)) {
String[] constrArray = providerInfo
.substring(startIndex + 2, endIndex).split("\\},\\{");

Expand Down

0 comments on commit 691714e

Please sign in to comment.