mirror of https://github.com/apache/lucene.git
LUCENE-3696: fix dictionary construction to work on java5
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1232012 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
49d3605946
commit
354a3be78f
|
@ -72,7 +72,7 @@
|
|||
<delete verbose="true">
|
||||
<fileset dir="src/resources/org/apache/lucene/analysis/kuromoji/dict" includes="**/*"/>
|
||||
</delete>
|
||||
<java fork="true" failonerror="true" maxmemory="512m" classname="org.apache.lucene.analysis.kuromoji.util.DictionaryBuilder">
|
||||
<java fork="true" failonerror="true" maxmemory="756m" classname="org.apache.lucene.analysis.kuromoji.util.DictionaryBuilder">
|
||||
<classpath>
|
||||
<path refid="tools.classpath"/>
|
||||
<pathelement path="${build.dir}/classes/tools"/>
|
||||
|
|
|
@ -54,7 +54,7 @@ public final class CSVUtil {
|
|||
String value = sb.toString();
|
||||
value = unQuoteUnEscape(value);
|
||||
result.add(value);
|
||||
sb = new StringBuilder();
|
||||
sb.setLength(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -75,13 +75,17 @@ public final class CSVUtil {
|
|||
String result = original;
|
||||
|
||||
// Unquote
|
||||
Matcher m = QUOTE_REPLACE_PATTERN.matcher(original);
|
||||
if(m.matches()) {
|
||||
result = m.group(1);
|
||||
}
|
||||
if (result.indexOf('\"') >= 0) {
|
||||
Matcher m = QUOTE_REPLACE_PATTERN.matcher(original);
|
||||
if(m.matches()) {
|
||||
result = m.group(1);
|
||||
}
|
||||
|
||||
// Unescape
|
||||
result = result.replaceAll(ESCAPED_QUOTE, "\"");
|
||||
// Unescape
|
||||
if (result.indexOf(ESCAPED_QUOTE) >= 0) {
|
||||
result = result.replace(ESCAPED_QUOTE, "\"");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
|
@ -92,7 +96,11 @@ public final class CSVUtil {
|
|||
* @param original
|
||||
*/
|
||||
public static String quoteEscape(String original) {
|
||||
String result = original.replaceAll("\"", ESCAPED_QUOTE);
|
||||
String result = original;
|
||||
|
||||
if (result.indexOf('\"') >= 0) {
|
||||
result.replace("\"", ESCAPED_QUOTE);
|
||||
}
|
||||
if(result.indexOf(COMMA) >= 0) {
|
||||
result = "\"" + result + "\"";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue