diff --git a/htroot/AccessPicture_p.java b/htroot/AccessPicture_p.java index 35a025622..de5a64757 100644 --- a/htroot/AccessPicture_p.java +++ b/htroot/AccessPicture_p.java @@ -65,7 +65,7 @@ public class AccessPicture_p { color_grid = post.get("colorgrid", color_grid); color_dot = post.get("colordot", color_dot); color_line = post.get("colorline", color_line); - corona = !post.containsKey("corona") || post.getBoolean("corona"); + corona = !post.containsKey("corona") || post.getBoolean("corona", false); coronaangle = (corona) ? post.getInt("coronaangle", 0) : -1; } if (coronaangle < 0) corona = false; diff --git a/htroot/ConfigPortal.java b/htroot/ConfigPortal.java index 561ada482..1fa1f80d8 100644 --- a/htroot/ConfigPortal.java +++ b/htroot/ConfigPortal.java @@ -83,15 +83,15 @@ public class ConfigPortal { sb.setConfig(SwitchboardConstants.SEARCH_ITEMS, post.getInt("maximumRecords", 10)); sb.setConfig(SwitchboardConstants.INDEX_FORWARD, post.get(SwitchboardConstants.INDEX_FORWARD, "")); HTTPDFileHandler.indexForward = post.get(SwitchboardConstants.INDEX_FORWARD, ""); - sb.setConfig("publicTopmenu", !post.containsKey("publicTopmenu") || post.getBoolean("publicTopmenu")); - sb.setConfig("publicSearchpage", !post.containsKey("publicSearchpage") || post.getBoolean("publicSearchpage")); - sb.setConfig("search.options", post.getBoolean("search.options")); + sb.setConfig("publicTopmenu", !post.containsKey("publicTopmenu") || post.getBoolean("publicTopmenu", true)); + sb.setConfig("publicSearchpage", !post.containsKey("publicSearchpage") || post.getBoolean("publicSearchpage", true)); + sb.setConfig("search.options", post.getBoolean("search.options", false)); - sb.setConfig("interaction.userlogon.enabled", post.getBoolean("interaction.userlogon")); - sb.setConfig(SwitchboardConstants.GREEDYLEARNING_ACTIVE, post.getBoolean(SwitchboardConstants.GREEDYLEARNING_ACTIVE)); + sb.setConfig("interaction.userlogon.enabled", post.getBoolean("interaction.userlogon", false)); + sb.setConfig(SwitchboardConstants.GREEDYLEARNING_ACTIVE, post.getBoolean(SwitchboardConstants.GREEDYLEARNING_ACTIVE, true)); sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, post.get("search.verify", "ifexist")); - sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete")); + sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete", false)); sb.setConfig("about.headline", post.get("about.headline", "")); sb.setConfig("about.body", post.get("about.body", "")); diff --git a/htroot/ConfigSearchPage_p.java b/htroot/ConfigSearchPage_p.java index 108845e35..94663e7a0 100644 --- a/htroot/ConfigSearchPage_p.java +++ b/htroot/ConfigSearchPage_p.java @@ -59,34 +59,34 @@ public class ConfigSearchPage_p { // store this call as api call sb.tables.recordAPICall(post, "ConfigPortal.html", WorkTables.TABLE_API_TYPE_CONFIGURATION, "new portal design. greeting: " + newGreeting); - sb.setConfig("publicTopmenu", post.getBoolean("publicTopmenu")); - sb.setConfig("search.options", post.getBoolean("search.options")); + sb.setConfig("publicTopmenu", post.getBoolean("publicTopmenu", false)); + sb.setConfig("search.options", post.getBoolean("search.options", false)); - sb.setConfig("search.text", post.getBoolean("search.text")); - sb.setConfig("search.image", post.getBoolean("search.image")); - sb.setConfig("search.audio", post.getBoolean("search.audio")); - sb.setConfig("search.video", post.getBoolean("search.video")); - sb.setConfig("search.app", post.getBoolean("search.app")); + sb.setConfig("search.text", post.getBoolean("search.text", false)); + sb.setConfig("search.image", post.getBoolean("search.image", false)); + sb.setConfig("search.audio", post.getBoolean("search.audio", false)); + sb.setConfig("search.video", post.getBoolean("search.video", false)); + sb.setConfig("search.app", post.getBoolean("search.app", false)); - sb.setConfig("search.result.show.date", post.getBoolean("search.result.show.date")); - sb.setConfig("search.result.show.size", post.getBoolean("search.result.show.size")); - sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata")); - sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser")); - sb.setConfig("search.result.show.citation", post.getBoolean("search.result.show.citation")); - sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures")); - sb.setConfig("search.result.show.cache", post.getBoolean("search.result.show.cache")); - sb.setConfig("search.result.show.proxy", post.getBoolean("search.result.show.proxy")); - sb.setConfig("search.result.show.hostbrowser", post.getBoolean("search.result.show.hostbrowser")); - sb.setConfig("search.result.show.tags", post.getBoolean("search.result.show.tags")); + sb.setConfig("search.result.show.date", post.getBoolean("search.result.show.date", false)); + sb.setConfig("search.result.show.size", post.getBoolean("search.result.show.size", false)); + sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata", false)); + sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser", false)); + sb.setConfig("search.result.show.citation", post.getBoolean("search.result.show.citation", false)); + sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures", false)); + sb.setConfig("search.result.show.cache", post.getBoolean("search.result.show.cache", false)); + sb.setConfig("search.result.show.proxy", post.getBoolean("search.result.show.proxy", false)); + sb.setConfig("search.result.show.hostbrowser", post.getBoolean("search.result.show.hostbrowser", false)); + sb.setConfig("search.result.show.tags", post.getBoolean("search.result.show.tags", false)); // construct navigation String String nav = ""; - if (post.getBoolean("search.navigation.filetype")) nav += "filetype,"; - if (post.getBoolean("search.navigation.protocol")) nav += "protocol,"; - if (post.getBoolean("search.navigation.hosts")) nav += "hosts,"; - if (post.getBoolean("search.navigation.authors")) nav += "authors,"; - if (post.getBoolean("search.navigation.namespace")) nav += "namespace,"; - if (post.getBoolean("search.navigation.topics")) nav += "topics,"; + if (post.getBoolean("search.navigation.filetype", false)) nav += "filetype,"; + if (post.getBoolean("search.navigation.protocol", false)) nav += "protocol,"; + if (post.getBoolean("search.navigation.hosts", false)) nav += "hosts,"; + if (post.getBoolean("search.navigation.authors", false)) nav += "authors,"; + if (post.getBoolean("search.navigation.namespace", false)) nav += "namespace,"; + if (post.getBoolean("search.navigation.topics", false)) nav += "topics,"; if (nav.endsWith(",")) nav = nav.substring(0, nav.length() - 1); sb.setConfig("search.navigation", nav); } diff --git a/htroot/ConfigUpdate_p.java b/htroot/ConfigUpdate_p.java index 71bcdd7d5..4e8877745 100644 --- a/htroot/ConfigUpdate_p.java +++ b/htroot/ConfigUpdate_p.java @@ -157,7 +157,7 @@ public class ConfigUpdate_p { sb.setConfig("update.cycle", Math.max(12, post.getLong("cycle", 168))); sb.setConfig("update.blacklist", post.get("blacklist", "")); sb.setConfig("update.concept", ("any".equals(post.get("releaseType", "any"))) ? "any" : "main"); - sb.setConfig("update.onlySignedFiles", (post.getBoolean("onlySignedFiles")) ? "1" : "0"); + sb.setConfig("update.onlySignedFiles", (post.getBoolean("onlySignedFiles", true)) ? "1" : "0"); } } diff --git a/htroot/Connections_p.java b/htroot/Connections_p.java index efcf017df..8134f53ab 100644 --- a/htroot/Connections_p.java +++ b/htroot/Connections_p.java @@ -61,7 +61,7 @@ public final class Connections_p { // determines if name lookup should be done or not final boolean doNameLookup; if (post != null) { - doNameLookup = post.getBoolean("nameLookup"); + doNameLookup = post.getBoolean("nameLookup", false); if (post.containsKey("closeServerSession")) { final String sessionName = post.get("closeServerSession", null); sb.closeSessions(sessionName); diff --git a/htroot/Crawler_p.java b/htroot/Crawler_p.java index 1cd75ef15..915913286 100644 --- a/htroot/Crawler_p.java +++ b/htroot/Crawler_p.java @@ -171,7 +171,7 @@ public class Crawler_p { long t = timeParser(true, post.getInt("deleteIfOlderNumber", -1), post.get("deleteIfOlderUnit","year")); // year, month, day, hour if (t > 0) deleteageDate = new Date(t); } - final boolean deleteold = (deleteage && deleteageDate != null) || (restrictedcrawl && post.getBoolean("deleteold")); + final boolean deleteold = (deleteage && deleteageDate != null) || (restrictedcrawl && post.getBoolean("deleteold", false)); String crawlingStart0 = post.get("crawlingURL","").trim(); // the crawljob start url String[] rootURLs0 = crawlingStart0.indexOf('\n') > 0 || crawlingStart0.indexOf('\r') > 0 ? crawlingStart0.split("[\\r\\n]+") : crawlingStart0.split(Pattern.quote("|")); @@ -207,7 +207,7 @@ public class Crawler_p { String ipMustMatch = post.get("ipMustmatch", CrawlProfile.MATCH_ALL_STRING); final String ipMustNotMatch = post.get("ipMustnotmatch", CrawlProfile.MATCH_NEVER_STRING); if (ipMustMatch.length() < 2) ipMustMatch = CrawlProfile.MATCH_ALL_STRING; - final String countryMustMatch = post.getBoolean("countryMustMatchSwitch") ? post.get("countryMustMatchList", "") : ""; + final String countryMustMatch = post.getBoolean("countryMustMatchSwitch", false) ? post.get("countryMustMatchList", "") : ""; sb.setConfig("crawlingIPMustMatch", ipMustMatch); sb.setConfig("crawlingIPMustNotMatch", ipMustNotMatch); if (countryMustMatch.length() > 0) sb.setConfig("crawlingCountryMustMatch", countryMustMatch); diff --git a/htroot/HostBrowser.java b/htroot/HostBrowser.java index 7cfdc8a52..aa5a63404 100644 --- a/htroot/HostBrowser.java +++ b/htroot/HostBrowser.java @@ -228,7 +228,7 @@ public class HostBrowser { delete = true; } int facetcount=post.getInt("facetcount", 0); - boolean complete = post.getBoolean("complete"); + boolean complete = post.getBoolean("complete", false); if (complete) { // we want only root paths for complete lists p = path.indexOf('/', 10); if (p > 0) path = path.substring(0, p + 1); diff --git a/htroot/IndexFederated_p.java b/htroot/IndexFederated_p.java index be0ee9d5b..6008cd4ec 100644 --- a/htroot/IndexFederated_p.java +++ b/htroot/IndexFederated_p.java @@ -48,7 +48,7 @@ public class IndexFederated_p { if (post != null && post.containsKey("set")) { //yacy - boolean post_core_rwi = post.getBoolean(SwitchboardConstants.CORE_SERVICE_RWI); + boolean post_core_rwi = post.getBoolean(SwitchboardConstants.CORE_SERVICE_RWI, false); final boolean previous_core_rwi = sb.index.connectedRWI() && env.getConfigBool(SwitchboardConstants.CORE_SERVICE_RWI, false); env.setConfig(SwitchboardConstants.CORE_SERVICE_RWI, post_core_rwi); if (previous_core_rwi && !post_core_rwi) sb.index.disconnectRWI(); // switch off @@ -58,7 +58,7 @@ public class IndexFederated_p { sb.index.connectRWI(wordCacheMaxCount, fileSizeMax); } catch (final IOException e) { ConcurrentLog.logException(e); } // switch on - boolean post_core_citation = post.getBoolean(SwitchboardConstants.CORE_SERVICE_CITATION); + boolean post_core_citation = post.getBoolean(SwitchboardConstants.CORE_SERVICE_CITATION, false); final boolean previous_core_citation = sb.index.connectedCitation() && env.getConfigBool(SwitchboardConstants.CORE_SERVICE_CITATION, false); env.setConfig(SwitchboardConstants.CORE_SERVICE_CITATION, post_core_citation); if (previous_core_citation && !post_core_citation) sb.index.disconnectCitation(); // switch off @@ -68,7 +68,7 @@ public class IndexFederated_p { sb.index.connectCitation(wordCacheMaxCount, fileSizeMax); } catch (final IOException e) { ConcurrentLog.logException(e); } // switch on - boolean post_core_fulltext = post.getBoolean(SwitchboardConstants.CORE_SERVICE_FULLTEXT); + boolean post_core_fulltext = post.getBoolean(SwitchboardConstants.CORE_SERVICE_FULLTEXT, true); final boolean previous_core_fulltext = sb.index.fulltext().connectedLocalSolr() && env.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT, false); env.setConfig(SwitchboardConstants.CORE_SERVICE_FULLTEXT, post_core_fulltext); @@ -83,17 +83,17 @@ public class IndexFederated_p { try { sb.index.fulltext().connectLocalSolr(); } catch (final IOException e) { ConcurrentLog.logException(e); } } - boolean webgraph = post.getBoolean(SwitchboardConstants.CORE_SERVICE_WEBGRAPH); + boolean webgraph = post.getBoolean(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, false); sb.index.fulltext().writeWebgraph(webgraph); env.setConfig(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, webgraph); - boolean jena = post.getBoolean(SwitchboardConstants.CORE_SERVICE_JENA); + boolean jena = post.getBoolean(SwitchboardConstants.CORE_SERVICE_JENA, false); env.setConfig(SwitchboardConstants.CORE_SERVICE_JENA, jena); // solr final boolean solrRemoteWasOn = sb.index.fulltext().connectedRemoteSolr() && env.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, true); String solrurls = post.get("solr.indexing.url", env.getConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_URL, "http://127.0.0.1:8983/solr")); - final boolean solrRemoteIsOnAfterwards = post.getBoolean("solr.indexing.solrremote") & solrurls.length() > 0; + final boolean solrRemoteIsOnAfterwards = post.getBoolean("solr.indexing.solrremote", false) & solrurls.length() > 0; env.setConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, solrRemoteIsOnAfterwards); final BufferedReader r = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(UTF8.getBytes(solrurls)))); final StringBuilder s = new StringBuilder(); @@ -148,7 +148,7 @@ public class IndexFederated_p { ConcurrentLog.severe("IndexFederated_p", "change of solr connection failed", e); } - boolean lazy = post.getBoolean("solr.indexing.lazy"); + boolean lazy = post.getBoolean("solr.indexing.lazy", true); env.setConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_LAZY, lazy); } diff --git a/htroot/NetworkPicture.java b/htroot/NetworkPicture.java index ea69c75ec..b57bd2787 100644 --- a/htroot/NetworkPicture.java +++ b/htroot/NetworkPicture.java @@ -90,7 +90,7 @@ public class NetworkPicture passiveLimit = post.getInt("pal", passiveLimit); potentialLimit = post.getInt("pol", potentialLimit); maxCount = post.getInt("max", maxCount); - corona = !post.containsKey("corona") || post.getBoolean("corona"); + corona = post.getBoolean("corona", true); coronaangle = (corona) ? post.getInt("coronaangle", 0) : -1; communicationTimeout = post.getLong("ct", -1); bgcolor = post.get("bgcolor", bgcolor); diff --git a/htroot/PeerLoadPicture.java b/htroot/PeerLoadPicture.java index 3482279cf..2b8d46dcf 100644 --- a/htroot/PeerLoadPicture.java +++ b/htroot/PeerLoadPicture.java @@ -22,7 +22,7 @@ public class PeerLoadPicture { if (post != null) { width = post.getInt("width", 800); height = post.getInt("height", 600); - showidle = post.getBoolean("showidle"); + showidle = post.getBoolean("showidle", false); } final CircleThreadPiece idle = new CircleThreadPiece("Idle", new Color(170, 255, 170)); diff --git a/htroot/Status.java b/htroot/Status.java index 3a4622674..0e1198e51 100644 --- a/htroot/Status.java +++ b/htroot/Status.java @@ -102,11 +102,11 @@ public class Status ByteCount.resetCount(); redirect = true; } else if ( post.containsKey("popup") ) { - final boolean trigger_enabled = post.getBoolean("popup"); + final boolean trigger_enabled = post.getBoolean("popup", false); sb.setConfig("browserPopUpTrigger", trigger_enabled); redirect = true; } else if ( post.containsKey("tray") ) { - final boolean trigger_enabled = post.getBoolean("tray"); + final boolean trigger_enabled = post.getBoolean("tray", false); sb.setConfig("trayIcon", trigger_enabled); redirect = true; } diff --git a/htroot/Table_API_p.java b/htroot/Table_API_p.java index 6b3689343..4c854a1d0 100644 --- a/htroot/Table_API_p.java +++ b/htroot/Table_API_p.java @@ -65,7 +65,7 @@ public class Table_API_p { startRecord = 0; maximumRecords = 1000; } - final boolean inline = (post != null && post.getBoolean("inline")); + final boolean inline = (post != null && post.getBoolean("inline", false)); prop.put("inline", (inline) ? 1 : 0); diff --git a/htroot/Threaddump_p.java b/htroot/Threaddump_p.java index c60ef6d0f..c54a5ccfc 100644 --- a/htroot/Threaddump_p.java +++ b/htroot/Threaddump_p.java @@ -49,7 +49,7 @@ public class Threaddump_p { final StringBuilder buffer = new StringBuilder(1000); - final boolean plain = post != null && post.getBoolean("plain"); + final boolean plain = post != null && post.getBoolean("plain", false); final int sleep = (post == null) ? 0 : post.getInt("sleep", 0); // a sleep before creation of a thread dump can be used for profiling if (sleep > 0) try {Thread.sleep(sleep);} catch (final InterruptedException e) {} prop.put("dump", "1"); diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java index 5482bac56..40be24cfe 100644 --- a/htroot/ViewFile.java +++ b/htroot/ViewFile.java @@ -129,7 +129,7 @@ public class ViewFile { // define an url by post parameter url = new DigestURI(MultiProtocolURI.unescape(urlString)); urlHash = ASCII.String(url.hash()); - pre = post.getBoolean("pre"); + pre = post.getBoolean("pre", false); } catch (final MalformedURLException e) {} URIMetadataNode urlEntry = null; diff --git a/htroot/api/ymarks/import_ymark.java b/htroot/api/ymarks/import_ymark.java index daceeefb4..e4c890c94 100644 --- a/htroot/api/ymarks/import_ymark.java +++ b/htroot/api/ymarks/import_ymark.java @@ -62,7 +62,7 @@ public class import_ymark { boolean merge = false; boolean empty = false; final String indexing = post.get("indexing", "off"); - final boolean medialink = post.getBoolean("medialink"); + final boolean medialink = post.getBoolean("medialink", false); if(post.containsKey("autotag") && !post.get("autotag", "off").equals("off")) { autotag = true; diff --git a/htroot/opensearchdescription.java b/htroot/opensearchdescription.java index aab2f55fd..af08b6dfd 100644 --- a/htroot/opensearchdescription.java +++ b/htroot/opensearchdescription.java @@ -44,8 +44,7 @@ public class opensearchdescription { if (thisaddress.indexOf(':',0) == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8090")); int compareyacy = 0; - if (post != null && post.getBoolean("compare_yacy")) - compareyacy = 1; + if (post != null && post.getBoolean("compare_yacy", false)) compareyacy = 1; final serverObjects prop = new serverObjects(); prop.put("compareyacy", compareyacy); diff --git a/source/net/yacy/server/serverObjects.java b/source/net/yacy/server/serverObjects.java index 6700da916..b3e58edeb 100644 --- a/source/net/yacy/server/serverObjects.java +++ b/source/net/yacy/server/serverObjects.java @@ -444,13 +444,6 @@ public class serverObjects implements Serializable, Cloneable { } } - public boolean getBoolean(final String key) { - String s = removeByteOrderMark(get(key)); - if (s == null) return false; - s = s.toLowerCase(); - return s.equals("true") || s.equals("on") || s.equals("1"); - } - public boolean getBoolean(final String key, final boolean dflt) { String s = removeByteOrderMark(get(key)); if (s == null) return dflt;