[#6077] Reverted fast-path regular expressions on split() usage

This commit is contained in:
lukaseder 2017-05-23 13:47:21 +02:00
parent c63c696317
commit 89539ecbf3
4 changed files with 4 additions and 12 deletions

View File

@ -2218,8 +2218,6 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
}
}
private static final Pattern WHITESPACE = Pattern.compile(" ");
private static final long parse(Class<? extends java.util.Date> type, String date) throws SQLException {
// Try reading a plain number first
@ -2235,7 +2233,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
// Dates may come with " 00:00:00". This is safely trimming time information
if (type == Date.class)
return Date.valueOf(WHITESPACE.split(date)[0]).getTime();
return Date.valueOf(date.split(" ")[0]).getTime();
if (type == Time.class)
return Time.valueOf(date).getTime();

View File

@ -44,7 +44,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.regex.Pattern;
import org.jooq.Configuration;
import org.jooq.ExecuteContext;
@ -194,10 +193,8 @@ public class LoggerListener extends DefaultExecuteListener {
return result;
}
private static final Pattern NEW_LINE = Pattern.compile("\n");
private void logMultiline(String comment, String message, Level level) {
for (String line : NEW_LINE.split(message)) {
for (String line : message.split("\n")) {
if (level == Level.FINE) {
log.debug(comment, line);
}

View File

@ -1262,8 +1262,6 @@ public final class StringUtils {
// XXX: The following methods are not part of Apache's commons-lang library
// -------------------------------------------------------------------------
private static final Pattern UNDERSCORE = Pattern.compile("_");
/**
* Convert a string to camel case
*/
@ -1271,7 +1269,7 @@ public final class StringUtils {
StringBuilder result = new StringBuilder();
// [#2515] - Keep trailing underscores
for (String word : UNDERSCORE.split(string, -1)) {
for (String word : string.split("_", -1)) {
// Uppercase first letter of a word
if (word.length() > 0) {

View File

@ -172,7 +172,6 @@ public class MockFileDatabase implements MockDataProvider {
}
private static final Pattern END_OF_STATEMENT = Pattern.compile("^(.*?);[ \t]*$");
private static final Pattern NEW_LINE = Pattern.compile("\n");
private void load() throws FileNotFoundException, IOException {
@ -286,7 +285,7 @@ public class MockFileDatabase implements MockDataProvider {
if (log.isDebugEnabled()) {
String comment = "Loaded Result";
for (String l : NEW_LINE.split(mock.data.format(5))) {
for (String l : mock.data.format(5).split("\n")) {
log.debug(comment, l);
comment = "";
}