Skip to content

Commit

Permalink
Use Locale.ROOT to avoid the Turkish locale bug.
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Glavassevich <mrglavas@ca.ibm.com>
  • Loading branch information
mrglavas committed Nov 12, 2024
1 parent 3e3c97c commit 23612b7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4mp.commons.codeaction.CodeActionResolveData;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;

public class JDTUtils {
Expand Down Expand Up @@ -70,7 +67,9 @@ public static boolean isValidLevel1URI(String uriString) {
public static List<PsiMethod> getFieldAccessors(PsiJavaFile unit, PsiField field) {
List<PsiMethod> accessors = new ArrayList<PsiMethod>();
String fieldName = field.getName();
String accessorSuffix = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
// Use Locale.ROOT to avoid the "Turkish locale bug".
// See: https://github.com/OpenLiberty/liberty-tools-intellij/issues/1092
String accessorSuffix = fieldName.substring(0, 1).toUpperCase(Locale.ROOT) + fieldName.substring(1);
List<String> accessorNames = ACCESSOR_PREFIXES.stream().map(s -> s + accessorSuffix).collect(Collectors.toList());

for (PsiClass type : unit.getClasses()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.eclipse.lsp4mp.commons.metadata.ItemHint;
import org.eclipse.lsp4mp.commons.metadata.ValueHint;

import java.util.Locale;

import static io.openliberty.tools.intellij.lsp4mp4ij.psi.core.utils.AnnotationUtils.getAnnotationMemberValue;
import static io.openliberty.tools.intellij.lsp4mp4ij.psi.core.utils.AnnotationUtils.isMatchAnnotation;
import static io.openliberty.tools.intellij.lsp4mp4ij.psi.core.utils.PsiTypeUtils.*;
Expand Down Expand Up @@ -353,7 +355,9 @@ private static String getMPMessagingName(MessageType messageType, boolean dynami
String attributeName) {
StringBuilder propertyName = new StringBuilder("mp.messaging");
propertyName.append('.');
propertyName.append(messageType.name().toLowerCase());
// Use Locale.ROOT to avoid the "Turkish locale bug".
// See: https://github.com/OpenLiberty/liberty-tools-intellij/issues/1092
propertyName.append(messageType.name().toLowerCase(Locale.ROOT));
propertyName.append('.');
if (dynamic) {
propertyName.append("${");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;

import org.apache.maven.artifact.versioning.ComparableVersion;

Expand Down Expand Up @@ -313,7 +314,9 @@ private static String getMavenClassworldsJarPath(final String mavenHome) {
File[] files = mavenHomeBootAsFile.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().contains("classworlds") && file.getName().toLowerCase().endsWith(".jar")) {
// Use Locale.ROOT to avoid the "Turkish locale bug".
// See: https://github.com/OpenLiberty/liberty-tools-intellij/issues/1092
if (file.getName().contains("classworlds") && file.getName().toLowerCase(Locale.ROOT).endsWith(".jar")) {
return file.getAbsolutePath();
}
}
Expand Down

0 comments on commit 23612b7

Please sign in to comment.