Skip to content

Commit 97c9ede

Browse files
Update identity-apps-core/apps/authentication-portal/src/main/webapp/includes/localize.jsp
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 0ac30ab commit 97c9ede

File tree

1 file changed

+11
-2
lines changed
  • identity-apps-core/apps/authentication-portal/src/main/webapp/includes

1 file changed

+11
-2
lines changed

identity-apps-core/apps/authentication-portal/src/main/webapp/includes/localize.jsp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,23 @@
132132
// Ignore comments and empty lines
133133
if (!line.trim().startsWith("#") && !line.trim().isEmpty()) {
134134
// Split the line into key and value using '=' as the delimiter
135-
String[] keyValue = line.split("=");
135+
String[] keyValue = line.split("=", 2);
136+
if (keyValue.length < 2) {
137+
continue; // Skip malformed lines
138+
}
136139
// Split the key further using '.' as the delimiter
137140
String[] parts = keyValue[0].split("\\.");
141+
if (parts.length == 0) {
142+
continue;
143+
}
138144
String languageCode = parts[parts.length - 1];
139145
// Split the value further using ',' as the delimiter
140146
String[] values = keyValue[1].split(",");
147+
if (values.length < 2) {
148+
continue; // Skip lines without proper country,displayName format
149+
}
141150
String country = values[0];
142-
String displayName = values[1];
151+
// displayName is available in values[1] if needed in the future
143152
// Add the values to the list.
144153
supportedLanguages.put(languageCode, country);
145154
if (!languageSupportedCountries.contains(country)) {

0 commit comments

Comments
 (0)