Use String.replace() with single char if possible

See gh-8089
This commit is contained in:
dreis
2017-01-24 19:39:17 +01:00
committed by Stephane Nicoll
parent 551bfb2c60
commit d58f38f6f6
19 changed files with 23 additions and 23 deletions

View File

@@ -132,8 +132,8 @@ public class LaunchedURLClassLoader extends URLClassLoader {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws ClassNotFoundException {
String packageEntryName = packageName.replace(".", "/") + "/";
String classEntryName = className.replace(".", "/") + ".class";
String packageEntryName = packageName.replace('.', '/') + "/";
String classEntryName = className.replace('.', '/') + ".class";
for (URL url : getURLs()) {
try {
URLConnection connection = url.openConnection();

View File

@@ -359,7 +359,7 @@ public class PropertiesLauncher extends Launcher {
private String getProperty(String propertyKey, String manifestKey) throws Exception {
if (manifestKey == null) {
manifestKey = propertyKey.replace(".", "-");
manifestKey = propertyKey.replace('.', '-');
manifestKey = toCamelCase(manifestKey);
}
String property = SystemPropertyUtils.getProperty(propertyKey);

View File

@@ -184,11 +184,11 @@ public abstract class SystemPropertyUtils {
}
if (propVal == null) {
// Try with underscores.
propVal = System.getenv(key.replace(".", "_"));
propVal = System.getenv(key.replace('.', '_'));
}
if (propVal == null) {
// Try uppercase with underscores as well.
propVal = System.getenv(key.toUpperCase().replace(".", "_"));
propVal = System.getenv(key.toUpperCase().replace('.', '_'));
}
if (propVal != null) {
return propVal;