introducting a new getConfig method which parses comma-separated llists

from setting fields; refactoring for all places where such lists are
parsed
pull/1/head
Michael Peter Christen 10 years ago
parent 69eacdf4eb
commit efbc9a3561

@ -41,7 +41,6 @@ import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.storage.HandleSet;
import net.yacy.cora.util.ByteBuffer;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.cora.util.SpaceExceededException;
import net.yacy.data.ListManager;
@ -375,7 +374,7 @@ public class IndexControlRWIs_p {
Word.commonHashOrder,
urlb.size());
if ( post.containsKey("blacklisturls") ) {
final String[] supportedBlacklistTypes = CommonPattern.COMMA.split(env.getConfig("BlackLists.types", ""));
final String[] supportedBlacklistTypes = env.getConfigArray("BlackLists.types", "");
DigestURL url;
for ( final byte[] b : urlb ) {
try {

@ -54,7 +54,6 @@ import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.ResponseHeader;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.data.BookmarksDB.Bookmark;
import net.yacy.data.DidYouMean;
@ -664,7 +663,7 @@ public class yacysearch {
&& sb.peers.mySeed().getFlagAcceptRemoteIndex(),
false,
lat, lon, rad,
CommonPattern.COMMA.split(sb.getConfig("search.navigation","")));
sb.getConfigArray("search.navigation", ""));
EventTracker.delete(EventTracker.EClass.SEARCH);
EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.EventSearch(
theQuery.id(true),

@ -60,7 +60,6 @@ package net.yacy.server.http;
import java.io.File;
import net.yacy.cora.document.analysis.Classification;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
@ -110,7 +109,7 @@ public final class HTTPDFileHandler {
public static final void initDefaultPath() {
// create default files array
defaultFiles = CommonPattern.COMMA.split(switchboard.getConfig(SwitchboardConstants.BROWSER_DEFAULT,"index.html"));
defaultFiles = switchboard.getConfigArray(SwitchboardConstants.BROWSER_DEFAULT, "index.html");
if (defaultFiles.length == 0) defaultFiles = new String[] {"index.html"};
indexForward = switchboard.getConfig(SwitchboardConstants.INDEX_FORWARD, "");
if (indexForward.startsWith("/")) indexForward = indexForward.substring(1);

@ -48,6 +48,7 @@ import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.http.HTTPClient;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.http.YaCyHttpServer;
import net.yacy.kelondro.util.FileUtils;
@ -399,6 +400,16 @@ public class serverSwitch {
return Boolean.parseBoolean(getConfig(key, Boolean.toString(dflt)));
}
/**
* get a configuration parameter list
* @param key
* @param dflt a default list
* @return a list of strings which had been separated by comma in the setting
*/
public String[] getConfigArray(final String key, final String dflt) {
return CommonPattern.COMMA.split(this.getConfig(key, dflt));
}
/**
* Create a File instance for a configuration setting specifying a path.
*
@ -614,7 +625,7 @@ public class serverSwitch {
final String rootPath, final File file) throws IOException,
FileNotFoundException {
if (uri.startsWith("http://") || uri.startsWith("https://")) {
final String[] uris = uri.split(",");
final String[] uris = CommonPattern.COMMA.split(uri);
for (String netdef : uris) {
netdef = netdef.trim();
try {

Loading…
Cancel
Save