Skip to content

Commit

Permalink
Merge pull request modcluster#756 from rhusar/MODCLUSTER-803
Browse files Browse the repository at this point in the history
MODCLUSTER-803 Force a locale when calling toUpperCase() and toLowerC…
  • Loading branch information
rhusar authored Dec 12, 2023
2 parents c00521a + e8b7566 commit 8e545b9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.jboss.modcluster.container;

import java.net.InetAddress;
import java.util.Locale;

/**
* SPI for a connector, defined as a communication end-point for a client or proxy.
Expand Down Expand Up @@ -38,7 +39,7 @@ public int getDefaultPort() {
*/
@Override
public String toString() {
return this.name().toLowerCase();
return this.name().toLowerCase(Locale.ENGLISH);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.nio.channels.DatagramChannel;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Locale;

import org.jboss.logging.Logger;
import org.jboss.modcluster.ModClusterLogger;
Expand Down Expand Up @@ -42,7 +43,7 @@ public class DatagramChannelFactoryImpl implements DatagramChannelFactory {

public DatagramChannelFactoryImpl() {
String value = this.getSystemProperty("os.name");
this.canBindToMulticastAddress = (value != null) && (value.toLowerCase().startsWith("linux") || value.toLowerCase().startsWith("mac") || value.toLowerCase().startsWith("hp"));
this.canBindToMulticastAddress = (value != null) && (value.toLowerCase(Locale.ENGLISH).startsWith("linux") || value.toLowerCase(Locale.ENGLISH).startsWith("mac") || value.toLowerCase(Locale.ENGLISH).startsWith("hp"));
}

private String getSystemProperty(final String key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;

import javax.net.SocketFactory;
Expand Down Expand Up @@ -243,7 +244,7 @@ protected KeyManager[] getKeyManagers() throws GeneralSecurityException, IOExcep
KeyManager[] kms = kmf.getKeyManagers();
if (alias != null) {
if ("JKS".equals(this.config.getSslKeyStoreType())) {
alias = alias.toLowerCase();
alias = alias.toLowerCase(Locale.ENGLISH);
}
for (int i = 0; i < kms.length; i++) {
kms[i] = new JSSEKeyManager((X509KeyManager) kms[i], alias);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.Executors;

import org.jboss.modcluster.TestUtils;
Expand Down Expand Up @@ -109,7 +110,7 @@ public void testBasicOperation() throws Exception {

assertFalse(this.channel.isConnected());

if (!System.getProperty("os.name").toLowerCase().startsWith("mac")) {
if (!System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("mac")) {
listener.close();
} else {
try {
Expand Down

0 comments on commit 8e545b9

Please sign in to comment.