Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Locale.ROOT to avoid the Turkish locale bug. #1094

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading