using precompiled pattern CommonPattern.SEMICOLON for splits

pull/1/head
Michael Peter Christen 10 years ago
parent a8a2b7a803
commit 1f5047b15f

@ -31,6 +31,7 @@ import java.util.Iterator;
import java.util.Map;
import net.yacy.cora.protocol.ResponseHeader;
import net.yacy.cora.util.CommonPattern;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import net.yacy.server.servletProperties;
@ -56,7 +57,7 @@ public class CookieTest_p {
while (it.hasNext()) {
e = it.next();
if ("Cookie".equals(e.getKey())) {
final String cookies[] = e.getValue().split(";");
final String cookies[] = CommonPattern.SEMICOLON.split(e.getValue());
for(final String cookie : cookies)
{
final String nameValue[] = cookie.split("=");

@ -40,6 +40,7 @@ import net.yacy.cora.lod.vocabulary.DCTerms;
import net.yacy.cora.lod.vocabulary.Tagging;
import net.yacy.cora.lod.vocabulary.Tagging.SOTuple;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.data.WorkTables;
import net.yacy.document.LibraryProvider;
@ -170,7 +171,7 @@ public class Vocabulary_p {
table.put(s, new Tagging.SOTuple(Tagging.normalizeTerm(s), u0));
}
} else if (discoverFromAuthor) {
String[] ts = t.split(";"); // author names are often separated by ';'
String[] ts = CommonPattern.SEMICOLON.split(t); // author names are often separated by ';'
for (String s: ts) {
if (s.isEmpty()) continue;
int p = s.indexOf(','); // check if there is a reversed method to mention the name

@ -42,6 +42,7 @@ import net.yacy.cora.order.CloneableIterator;
import net.yacy.cora.order.Digest;
import net.yacy.cora.order.NaturalOrder;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.cora.util.SpaceExceededException;
import net.yacy.kelondro.blob.MapHeap;
@ -277,7 +278,7 @@ public final class UserDB {
}
public static String getLoginToken(final String cookies){
final String[] cookie = cookies.split(";"); //TODO: Mozilla uses "; "
final String[] cookie = CommonPattern.SEMICOLON.split(cookies); //TODO: Mozilla uses "; "
for (final String c :cookie) {
String[] pair = c.split("=");
if (pair[0].trim().equals("login")) {

@ -41,6 +41,7 @@ import org.apache.solr.common.params.MultiMapSolrParams;
import net.yacy.cora.date.ISO8601Formatter;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.document.Document;
@ -154,7 +155,7 @@ public class DCEntry extends MultiMapSolrParams {
public DigestURL getRelation() {
String u = this.get("dc:relation");
if (u == null) return null;
String[] urls = u.split(";");
String[] urls = CommonPattern.SEMICOLON.split(u);
if (urls.length > 1) {
// select one that fits
u = bestU(urls);
@ -287,7 +288,7 @@ public class DCEntry extends MultiMapSolrParams {
String[] tx;
if (t != null) {
t = stripCDATA(t);
return t.split(";");
return CommonPattern.SEMICOLON.split(t);
}
tx = this.getParams("dc:subject");

@ -111,7 +111,7 @@ public class csvParser extends AbstractParser implements Parser {
if (separator == null) {
// try comma, semicolon and tab; take that one that results with more columns
final String[] colc = CommonPattern.COMMA.split(row);
final String[] cols = row.split(";");
final String[] cols = CommonPattern.SEMICOLON.split(row);
final String[] colt = row.split("\t");
if (colc.length >= cols.length && colc.length >= colt.length) separator = ",";
if (cols.length >= colc.length && cols.length >= colt.length) separator = ";";

@ -36,6 +36,7 @@ import java.io.Writer;
import java.util.Properties;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.util.CommonPattern;
public class ScraperInputStream extends InputStream implements ScraperListener {
@ -86,7 +87,7 @@ public class ScraperInputStream extends InputStream implements ScraperListener {
private static String extractCharsetFromMimetypeHeader(final String mimeType) {
if (mimeType == null) return null;
final String[] parts = mimeType.split(";");
final String[] parts = CommonPattern.SEMICOLON.split(mimeType);
if (parts == null || parts.length <= 1) return null;
for (int i=1; i < parts.length; i++) {

@ -42,6 +42,7 @@ import java.util.List;
import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.document.id.AnchorURL;
import net.yacy.cora.order.Base64Order;
import net.yacy.cora.util.CommonPattern;
import net.yacy.document.AbstractParser;
import net.yacy.document.Document;
import net.yacy.document.Parser;
@ -99,7 +100,7 @@ public class vcfParser extends AbstractParser implements Parser {
String value = line.substring(pos+1).trim();
String encoding = null;
final String[] keyParts = key.split(";");
final String[] keyParts = CommonPattern.SEMICOLON.split(key);
if (keyParts.length > 1) {
for (final String keyPart : keyParts) {
if (keyPart.toUpperCase().startsWith("ENCODING")) {

Loading…
Cancel
Save