提交 40c884a2 authored 作者: Thomas Mueller's avatar Thomas Mueller

Problems with JDK 1.6.0_18 have been reports in the class…

Problems with JDK 1.6.0_18 have been reports in the class StringUtils.quoteRemarkSQL. This method is now changed.
上级 b4f79143
......@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>The "small jar" distribution did not include the CompressTool,
<ul><li>Problems with JDK 1.6.0_18 have been reports in the class StringUtils.quoteRemarkSQL. This method is now changed.
</li><li>The "small jar" distribution did not include the CompressTool,
which was required for some operations. Fixed.
</li><li>The build tool now supports (minimalistic) shell mode, started using ./build.sh -
</li><li>IS NULL comparison with nested queries and linked tables did not work.
......
......@@ -700,16 +700,20 @@ public class StringUtils {
* @return the string with the before string replaced
*/
public static String replaceAll(String s, String before, String after) {
StringBuilder buff = new StringBuilder(s.length());
int next = s.indexOf(before);
if (next < 0) {
return s;
}
StringBuilder buff = new StringBuilder(s.length() - before.length() + after.length());
int index = 0;
while (true) {
int next = s.indexOf(before, index);
buff.append(s.substring(index, next)).append(after);
index = next + before.length();
next = s.indexOf(before, index);
if (next < 0) {
buff.append(s.substring(index));
break;
}
buff.append(s.substring(index, next)).append(after);
index = next + before.length();
}
return buff.toString();
}
......@@ -751,21 +755,8 @@ public class StringUtils {
* @return the resulting string
*/
public static String quoteRemarkSQL(String sql) {
while (true) {
int idx = sql.indexOf("*/");
if (idx < 0) {
break;
}
sql = sql.substring(0, idx) + "++/" + sql.substring(idx + 2);
}
while (true) {
int idx = sql.indexOf("/*");
if (idx < 0) {
break;
}
sql = sql.substring(0, idx) + "/++" + sql.substring(idx + 2);
}
return sql;
sql = replaceAll(sql, "*/", "++/");
return replaceAll(sql, "/*", "/++");
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论