COMMONS_COMPRESS=/usr/share/java/commons-compress-1.13.jar
JAVA=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
test -x "$JAVA" || JAVA=java
-"$JAVA" -classpath src:../Util/src/:../Dictionary/src/:"$ICU4J":"$XERCES":"$COMMONS_COMPRESS" com.hughes.android.dictionary.engine.WiktionarySplitter "$@"
+"$JAVA" -Xverify:none -classpath src:../Util/src/:../Dictionary/src/:"$ICU4J":"$XERCES":"$COMMONS_COMPRESS" com.hughes.android.dictionary.engine.WiktionarySplitter "$@"
String text = textBuilder.toString();
String translingual = "";
+ int start = 0;
+ final Matcher startMatcher = headingStart.matcher(text);
- while (text.length() > 0) {
+ while (start < text.length()) {
// Find start.
- final Matcher startMatcher = headingStart.matcher(text);
- if (!startMatcher.find()) {
+ if (!startMatcher.find(start)) {
return;
}
- text = text.substring(startMatcher.end());
+ start = startMatcher.end();
final String heading = startMatcher.group();
final Pattern endPattern = getEndPattern(depth);
final Matcher endMatcher = endPattern.matcher(text);
- if (endMatcher.find()) {
+ if (endMatcher.find(start)) {
int end = endMatcher.start();
- translingual = text.substring(0, endMatcher.start());
- text = text.substring(end);
+ translingual = text.substring(start, end);
+ start = end;
continue;
}
}
final Matcher endMatcher = endPattern.matcher(text);
final int end;
- if (endMatcher.find()) {
+ if (endMatcher.find(start)) {
end = endMatcher.start();
} else {
end = text.length();
}
- String sectionText = text.substring(0, end);
+ String sectionText = text.substring(start, end);
// Hack to remove empty dummy section from French
if (sectionText.startsWith("\n=== {{S|étymologie}} ===\n: {{ébauche-étym")) {
int dummy_end = sectionText.indexOf("}}", 41) + 2;
throw new RuntimeException(e);
}
- text = text.substring(end);
+ start = end;
break;
}
}