diff --git a/defaults/yacy.init b/defaults/yacy.init index 6479bd42e..8644bd574 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -996,17 +996,6 @@ content.phpbb3.dbpw = joshua content.phpbb3.ppf = 1000 content.phpbb3.dumpfile = -# segment assignment for index storage processes in YaCy: -# each process can store its index result in it's own index segment -segment.process.receipts_tmp = default -segment.process.queries_tmp = default -segment.process.dhtin_tmp = default -segment.process.dhtout_tmp = default -segment.process.proxy_tmp = default -segment.process.localcrawling_tmp = default -segment.process.remotecrawling_tmp = default -segment.process.default_tmp = default - # search engine teaser: an about box in search results # this is only shown, if the about.body is filled about.headline = diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java index c2af82208..01b5c9d68 100644 --- a/htroot/ConfigBasic.java +++ b/htroot/ConfigBasic.java @@ -78,7 +78,7 @@ public class ConfigBasic { //boolean doPeerPing = false; if ((sb.peers.mySeed().isVirgin()) || (sb.peers.mySeed().isJunior())) { - InstantBusyThread.oneTimeJob(sb.yc, "peerPing", null, 0); + InstantBusyThread.oneTimeJob(sb.yc, "peerPing", 0); //doPeerPing = true; } diff --git a/htroot/CrawlMonitorRemoteStart.java b/htroot/CrawlMonitorRemoteStart.java index fcf9f50a4..dc52c99ef 100644 --- a/htroot/CrawlMonitorRemoteStart.java +++ b/htroot/CrawlMonitorRemoteStart.java @@ -44,7 +44,7 @@ public class CrawlMonitorRemoteStart { boolean dark = true; // create other peer crawl table using YaCyNews - Iterator recordIterator = sb.peers.newsPool.recordIterator(NewsPool.INCOMING_DB, true); + Iterator recordIterator = sb.peers.newsPool.recordIterator(NewsPool.INCOMING_DB); int showedCrawl = 0; NewsDB.Record record; Seed peer; @@ -74,7 +74,7 @@ public class CrawlMonitorRemoteStart { prop.put("otherCrawlStartInProgress", showedCrawl); // finished remote crawls - recordIterator = sb.peers.newsPool.recordIterator(NewsPool.PROCESSED_DB, true); + recordIterator = sb.peers.newsPool.recordIterator(NewsPool.PROCESSED_DB); showedCrawl = 0; while (recordIterator.hasNext()) { record = recordIterator.next(); diff --git a/htroot/CrawlProfileEditor_p.java b/htroot/CrawlProfileEditor_p.java index e5edb98e4..b7966790b 100644 --- a/htroot/CrawlProfileEditor_p.java +++ b/htroot/CrawlProfileEditor_p.java @@ -169,7 +169,7 @@ public class CrawlProfileEditor_p { // put active crawls into list for (final byte[] h: sb.crawler.getActive()) { profile = sb.crawler.getActive(h); - profile.putProfileEntry(CRAWL_PROFILE_PREFIX, prop, sb.crawlStacker, true, dark, count, domlistlength); + profile.putProfileEntry(CRAWL_PROFILE_PREFIX, prop, true, dark, count, domlistlength); dark = !dark; count++; } @@ -177,7 +177,7 @@ public class CrawlProfileEditor_p { boolean existPassiveCrawls = false; for (final byte[] h: sb.crawler.getPassive()) { profile = sb.crawler.getPassive(h); - profile.putProfileEntry(CRAWL_PROFILE_PREFIX, prop, sb.crawlStacker, false, dark, count, domlistlength); + profile.putProfileEntry(CRAWL_PROFILE_PREFIX, prop, false, dark, count, domlistlength); dark = !dark; count++; existPassiveCrawls = true; diff --git a/htroot/CrawlStartScanner_p.java b/htroot/CrawlStartScanner_p.java index 1ac7e798b..504ed43d5 100644 --- a/htroot/CrawlStartScanner_p.java +++ b/htroot/CrawlStartScanner_p.java @@ -93,21 +93,11 @@ public class CrawlStartScanner_p if ( post != null ) { int repeat_time = 0; String repeat_unit = "seldays"; - long validTime = 0; // check scheduler if ( post.get("rescan", "").equals("scheduler") ) { repeat_time = post.getInt("repeat_time", -1); repeat_unit = post.get("repeat_unit", "selminutes"); // selminutes, selhours, seldays - if ( repeat_unit.equals("selminutes") ) { - validTime = repeat_time * 60 * 1000; - } - if ( repeat_unit.equals("selhours") ) { - validTime = repeat_time * 60 * 60 * 1000; - } - if ( repeat_unit.equals("seldays") ) { - validTime = repeat_time * 24 * 60 * 60 * 1000; - } } final boolean bigrange = post.get("subnet", "24").equals("16"); @@ -151,9 +141,9 @@ public class CrawlStartScanner_p scanner.terminate(); if ( "on".equals(post.get("accumulatescancache", "")) && !"scheduler".equals(post.get("rescan", "")) ) { - Scanner.scancacheExtend(scanner, validTime); + Scanner.scancacheExtend(scanner); } else { - Scanner.scancacheReplace(scanner, validTime); + Scanner.scancacheReplace(scanner); } } @@ -175,9 +165,9 @@ public class CrawlStartScanner_p scanner.terminate(); if ( "on".equals(post.get("accumulatescancache", "")) && !"scheduler".equals(post.get("rescan", "")) ) { - Scanner.scancacheExtend(scanner, validTime); + Scanner.scancacheExtend(scanner); } else { - Scanner.scancacheReplace(scanner, validTime); + Scanner.scancacheReplace(scanner); } } diff --git a/htroot/Crawler_p.java b/htroot/Crawler_p.java index b83721349..9897f19be 100644 --- a/htroot/Crawler_p.java +++ b/htroot/Crawler_p.java @@ -634,7 +634,7 @@ public class Crawler_p { for (final byte[] h: sb.crawler.getActive()) { profile = sb.crawler.getActive(h); if (CrawlProfile.ignoreNames.contains(profile.name())) continue; - profile.putProfileEntry("crawlProfilesShow_list_", prop, sb.crawlStacker, true, dark, count, domlistlength); + profile.putProfileEntry("crawlProfilesShow_list_", prop, true, dark, count, domlistlength); dark = !dark; count++; } diff --git a/htroot/IndexImportOAIPMH_p.java b/htroot/IndexImportOAIPMH_p.java index 871ab0855..c627f1c4e 100644 --- a/htroot/IndexImportOAIPMH_p.java +++ b/htroot/IndexImportOAIPMH_p.java @@ -61,7 +61,7 @@ public class IndexImportOAIPMH_p { DigestURI url = null; try { url = new DigestURI(oaipmhurl); - final OAIPMHLoader r = new OAIPMHLoader(sb.loader, url, sb.surrogatesInPath, "oaipmh-one"); + final OAIPMHLoader r = new OAIPMHLoader(sb.loader, url, sb.surrogatesInPath); final ResumptionToken rt = r.getResumptionToken(); prop.put("import-one", 1); prop.put("import-one_count", (rt == null) ? "not available" : Integer.toString(rt.getRecordCounter())); diff --git a/htroot/Network.java b/htroot/Network.java index 7bd81feb1..253fbf0d3 100644 --- a/htroot/Network.java +++ b/htroot/Network.java @@ -257,7 +257,7 @@ public class Network { final HashMap> updatedBlog = new HashMap>(); final HashMap isCrawling = new HashMap(); NewsDB.Record record; - final Iterator recordIterator = sb.peers.newsPool.recordIterator(NewsPool.INCOMING_DB, true); + final Iterator recordIterator = sb.peers.newsPool.recordIterator(NewsPool.INCOMING_DB); while (recordIterator.hasNext()) { record = recordIterator.next(); if (record == null) { diff --git a/htroot/NetworkPicture.java b/htroot/NetworkPicture.java index bd4012ad9..51129d941 100644 --- a/htroot/NetworkPicture.java +++ b/htroot/NetworkPicture.java @@ -126,7 +126,6 @@ public class NetworkPicture buffer = new EncodedImage(NetworkGraph.getNetworkPicture( sb.peers, - 10000, width, height, passiveLimit, diff --git a/htroot/News.java b/htroot/News.java index 1f6e986d3..675bbe1b3 100644 --- a/htroot/News.java +++ b/htroot/News.java @@ -40,7 +40,7 @@ import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; public class News { - + public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) { final Switchboard sb = (Switchboard) env; final serverObjects prop = new serverObjects(); @@ -49,7 +49,7 @@ public class News { // execute commands if (post != null) { - + if ((post.containsKey("deletespecific")) && (tableID >= 0)) { if (sb.adminAuthenticated(header) < 2) { prop.authenticationRequired(); @@ -68,7 +68,7 @@ public class News { } } } - + if ((post.containsKey("deleteall")) && (tableID >= 0)) { if (sb.adminAuthenticated(header) < 2) { prop.authenticationRequired(); @@ -85,7 +85,7 @@ public class News { } } } - + // generate properties for output if (overview) { // show overview @@ -100,17 +100,17 @@ public class News { prop.put("table", "1"); prop.put("page", tableID + 1); prop.put("table_page", tableID + 1); - + if (sb.peers != null) { final int maxCount = Math.min(1000, sb.peers.newsPool.size(tableID)); - final Iterator recordIterator = sb.peers.newsPool.recordIterator(tableID, false); + final Iterator recordIterator = sb.peers.newsPool.recordIterator(tableID); NewsDB.Record record; Seed seed; int i = 0; while ((recordIterator.hasNext()) && (i < maxCount)) { record = recordIterator.next(); if (record == null) continue; - + seed = sb.peers.getConnected(record.originator()); if (seed == null) seed = sb.peers.getDisconnected(record.originator()); final String category = record.category(); @@ -121,7 +121,7 @@ public class News { prop.putHTML("table_list_" + i + "_cat", category); prop.put("table_list_" + i + "_rec", (record.received() == null) ? "-" : GenericFormatter.SHORT_SECOND_FORMATTER.format(record.received())); prop.put("table_list_" + i + "_dis", record.distributed()); - + final Map attributeMap = record.attributes(); prop.putHTML("table_list_" + i + "_att", attributeMap.toString()); int j = 0; @@ -133,7 +133,7 @@ public class News { } } prop.put("table_list_" + i + "_attributes", j); - + // generating link / title / description (taken over from Surftips.java) String link, title, description; if (category.equals(NewsPool.CATEGORY_CRAWL_START)) { @@ -165,23 +165,23 @@ public class News { title = record.attribute("author", "Anonymous") + ": " + record.attribute("page", ""); description = "Blog Entry: " + record.attribute("subject", ""); } else { - link = ""; - title = ""; + link = ""; + title = ""; description = ""; } prop.putHTML("table_list_" + i + "_link", link); prop.putHTML("table_list_" + i + "_title", title); prop.putHTML("table_list_" + i + "_description", description); - + i++; } prop.put("table_list", i); } } - + // adding the peer address prop.put("address", sb.peers.mySeed().getPublicAddress()); - + // return rewrite properties return prop; } diff --git a/htroot/Supporter.java b/htroot/Supporter.java index 2d75ee4c9..c506fce76 100644 --- a/htroot/Supporter.java +++ b/htroot/Supporter.java @@ -92,9 +92,9 @@ public class Supporter { // make new news message with voting final HashMap map = new HashMap(); map.put("urlhash", hash); - map.put("url", crypt.simpleDecode(post.get("url", ""), null)); - map.put("title", crypt.simpleDecode(post.get("title", ""), null)); - map.put("description", crypt.simpleDecode(post.get("description", ""), null)); + map.put("url", crypt.simpleDecode(post.get("url", ""))); + map.put("title", crypt.simpleDecode(post.get("title", ""))); + map.put("description", crypt.simpleDecode(post.get("description", ""))); map.put("vote", "positive"); map.put("refid", post.get("refid", "")); map.put("comment", post.get("comment", "")); @@ -176,7 +176,7 @@ public class Supporter { private static void accumulateVotes(final Switchboard sb, final HashMap negativeHashes, final HashMap positiveHashes, final int dbtype) { final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype)); NewsDB.Record record; - final Iterator recordIterator = sb.peers.newsPool.recordIterator(dbtype, true); + final Iterator recordIterator = sb.peers.newsPool.recordIterator(dbtype); int j = 0; while ((recordIterator.hasNext()) && (j++ < maxCount)) { record = recordIterator.next(); @@ -206,7 +206,7 @@ public class Supporter { final HashMap negativeHashes, final HashMap positiveHashes, final int dbtype) { final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype)); NewsDB.Record record; - final Iterator recordIterator = sb.peers.newsPool.recordIterator(dbtype, true); + final Iterator recordIterator = sb.peers.newsPool.recordIterator(dbtype); int j = 0; String url = "", urlhash; Row.Entry entry; diff --git a/htroot/Surftips.java b/htroot/Surftips.java index 63d4efa1a..9fe68ae99 100644 --- a/htroot/Surftips.java +++ b/htroot/Surftips.java @@ -99,9 +99,9 @@ public class Surftips { // make new news message with voting final HashMap map = new HashMap(); map.put("urlhash", hash); - map.put("url", crypt.simpleDecode(post.get("url", ""), null)); - map.put("title", crypt.simpleDecode(post.get("title", ""), null)); - map.put("description", crypt.simpleDecode(post.get("description", ""), null)); + map.put("url", crypt.simpleDecode(post.get("url", ""))); + map.put("title", crypt.simpleDecode(post.get("title", ""))); + map.put("description", crypt.simpleDecode(post.get("description", ""))); map.put("vote", "positive"); map.put("refid", post.get("refid", "")); map.put("comment", post.get("comment", "")); @@ -182,7 +182,7 @@ public class Surftips { private static void accumulateVotes(final Switchboard sb, final HashMap negativeHashes, final HashMap positiveHashes, final int dbtype) { final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype)); NewsDB.Record record; - final Iterator recordIterator = sb.peers.newsPool.recordIterator(dbtype, true); + final Iterator recordIterator = sb.peers.newsPool.recordIterator(dbtype); int j = 0; while ((recordIterator.hasNext()) && (j++ < maxCount)) { record = recordIterator.next(); @@ -212,7 +212,7 @@ public class Surftips { final HashMap negativeHashes, final HashMap positiveHashes, final int dbtype) { final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype)); NewsDB.Record record; - final Iterator recordIterator = sb.peers.newsPool.recordIterator(dbtype, true); + final Iterator recordIterator = sb.peers.newsPool.recordIterator(dbtype); int j = 0; String url = "", urlhash; Row.Entry entry; diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.java index eec9a1e06..cfa385b19 100644 --- a/htroot/yacy/crawlReceipt.java +++ b/htroot/yacy/crawlReceipt.java @@ -67,13 +67,10 @@ public final class crawlReceipt { // request values final String iam = post.get("iam", ""); // seed hash of requester final String youare = post.get("youare", ""); // seed hash of the target peer, needed for network stability - //String process = post.get("process", ""); // process type - final String key = post.get("key", ""); // transmission key - //String receivedUrlhash = post.get("urlhash", ""); // the url hash that has been crawled final String result = post.get("result", ""); // the result; either "ok" or "fail" final String reason = post.get("reason", ""); // the reason for that result //String words = post.get("wordh", ""); // priority word hashes - final String propStr = crypt.simpleDecode(post.get("lurlEntry", ""), key); + final String propStr = crypt.simpleDecode(post.get("lurlEntry", "")); /* the result can have one of the following values: diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java index 5ed193426..6a11424a3 100644 --- a/htroot/yacy/hello.java +++ b/htroot/yacy/hello.java @@ -91,7 +91,7 @@ public final class hello { } Seed remoteSeed; try { - remoteSeed = Seed.genRemoteSeed(seed, key, true, ias.getHostAddress()); + remoteSeed = Seed.genRemoteSeed(seed, true, ias.getHostAddress()); } catch (final IOException e) { Network.log.logInfo("hello/server: bad seed: " + e.getMessage() + ", time_dnsResolve=" + time_dnsResolve); prop.put("message", "bad seed: " + e.getMessage()); diff --git a/htroot/yacy/message.java b/htroot/yacy/message.java index 592951e7e..90a4a4e9d 100644 --- a/htroot/yacy/message.java +++ b/htroot/yacy/message.java @@ -69,7 +69,6 @@ public final class message { if (!Protocol.authentifyRequest(post, env)) return prop; final String process = post.get("process", "permission"); - final String key = post.get("key", ""); final String clientip = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, ""); // read an artificial header addendum final InetAddress ias = Domains.dnsResolve(clientip); @@ -115,14 +114,14 @@ public final class message { //Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote time Seed otherSeed; try { - otherSeed = Seed.genRemoteSeed(otherSeedString, key, false, ias.getHostAddress()); + otherSeed = Seed.genRemoteSeed(otherSeedString, false, ias.getHostAddress()); } catch (final IOException e) { prop.put("response", "-1"); // don't accept messages for bad seeds return prop; } - String subject = crypt.simpleDecode(post.get("subject", ""), key); // message's subject - String message = crypt.simpleDecode(post.get("message", ""), key); // message body + String subject = crypt.simpleDecode(post.get("subject", "")); // message's subject + String message = crypt.simpleDecode(post.get("message", "")); // message body if (subject == null || message == null) { prop.put("response", "-1"); // don't accept empty messages return prop; diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java index b3d233501..6ffd7b685 100644 --- a/htroot/yacy/search.java +++ b/htroot/yacy/search.java @@ -105,13 +105,10 @@ public final class search { final String oseed = post.get("myseed", ""); // complete seed of the requesting peer // final String youare = post.get("youare", ""); // seed hash of the target peer, used for testing network stability - final String key = post.get("key", ""); // transmission key for response final String query = post.get("query", ""); // a string of word hashes that shall be searched and combined final String exclude= post.get("exclude", "");// a string of word hashes that shall not be within the search result final String urls = post.get("urls", ""); // a string of url hashes that are preselected for the search: no other may be returned final String abstracts = post.get("abstracts", ""); // a string of word hashes for abstracts that shall be generated, or 'auto' (for maxcount-word), or '' (for none) -// final String fwdep = post.get("fwdep", ""); // forward depth. if "0" then peer may NOT ask another peer for more results -// final String fwden = post.get("fwden", ""); // forward deny, a list of seed hashes. They may NOT be target of forward hopping final int count = Math.min((int) sb.getConfigLong(SwitchboardConstants.REMOTESEARCH_MAXCOUNT_DEFAULT, 100), post.getInt("count", 10)); // maximum number of wanted results final long maxtime = Math.min((int) sb.getConfigLong(SwitchboardConstants.REMOTESEARCH_MAXTIME_DEFAULT, 3000), post.getLong("time", 3000)); // maximum waiting time final int maxdist= post.getInt("maxdist", Integer.MAX_VALUE); @@ -131,7 +128,7 @@ public final class search { } final int partitions = post.getInt("partitions", 30); String profile = post.get("profile", ""); // remote profile hand-over - if (profile.length() > 0) profile = crypt.simpleDecode(profile, null); + if (profile.length() > 0) profile = crypt.simpleDecode(profile); //final boolean includesnippet = post.get("includesnippet", "false").equals("true"); Bitfield constraint = ((post.containsKey("constraint")) && (post.get("constraint", "").length() > 0)) ? new Bitfield(4, post.get("constraint", "______")) : null; if (constraint != null) { @@ -192,7 +189,7 @@ public final class search { // store accessing peer Seed remoteSeed; try { - remoteSeed = Seed.genRemoteSeed(oseed, key, false, client); + remoteSeed = Seed.genRemoteSeed(oseed, false, client); } catch (final IOException e) { Network.log.logInfo("yacy.search: access with bad seed: " + e.getMessage()); remoteSeed = null; diff --git a/source/de/anomic/crawler/Balancer.java b/source/de/anomic/crawler/Balancer.java index f0a5f21dd..b62ee8d25 100644 --- a/source/de/anomic/crawler/Balancer.java +++ b/source/de/anomic/crawler/Balancer.java @@ -282,10 +282,10 @@ public class Balancer { */ public long getDomainSleepTime(final CrawlSwitchboard cs, final RobotsTxt robots, Request crawlEntry) { final CrawlProfile profileEntry = cs.getActive(UTF8.getBytes(crawlEntry.profileHandle())); - return getDomainSleepTime(cs, robots, profileEntry, crawlEntry.url()); + return getDomainSleepTime(robots, profileEntry, crawlEntry.url()); } - private long getDomainSleepTime(final CrawlSwitchboard cs, final RobotsTxt robots, final CrawlProfile profileEntry, final DigestURI crawlURL) { + private long getDomainSleepTime(final RobotsTxt robots, final CrawlProfile profileEntry, final DigestURI crawlURL) { if (profileEntry == null) { return 0; } @@ -409,7 +409,7 @@ public class Balancer { return null; } // depending on the caching policy we need sleep time to avoid DoS-like situations - sleeptime = getDomainSleepTime(cs, robots, profileEntry, crawlEntry.url()); + sleeptime = getDomainSleepTime(robots, profileEntry, crawlEntry.url()); assert Base64Order.enhancedCoder.equal(nexthash, rowEntry.getPrimaryKeyBytes()) : "result = " + ASCII.String(nexthash) + ", rowEntry.getPrimaryKeyBytes() = " + ASCII.String(rowEntry.getPrimaryKeyBytes()); assert Base64Order.enhancedCoder.equal(nexthash, crawlEntry.url().hash()) : "result = " + ASCII.String(nexthash) + ", crawlEntry.url().hash() = " + ASCII.String(crawlEntry.url().hash()); diff --git a/source/de/anomic/crawler/CrawlProfile.java b/source/de/anomic/crawler/CrawlProfile.java index 97a9b2968..cf877f610 100644 --- a/source/de/anomic/crawler/CrawlProfile.java +++ b/source/de/anomic/crawler/CrawlProfile.java @@ -516,7 +516,6 @@ public class CrawlProfile extends ConcurrentHashMap implements M public void putProfileEntry( final String CRAWL_PROFILE_PREFIX, final serverObjects prop, - final CrawlStacker crawlStacker, final boolean active, final boolean dark, final int count, diff --git a/source/de/anomic/data/wiki/AbstractWikiParser.java b/source/de/anomic/data/wiki/AbstractWikiParser.java index 202ccbc71..e2629289b 100644 --- a/source/de/anomic/data/wiki/AbstractWikiParser.java +++ b/source/de/anomic/data/wiki/AbstractWikiParser.java @@ -33,9 +33,10 @@ import java.io.StringReader; import java.io.UnsupportedEncodingException; abstract class AbstractWikiParser implements WikiParser { - + protected abstract String transform(String hostport, BufferedReader reader, int length) throws IOException; + @Override public String transform(String hostport, final String content) { try { return transform( @@ -46,35 +47,14 @@ abstract class AbstractWikiParser implements WikiParser { return "internal error: " + e.getMessage(); } } - - public String transform(String hostport, final String content, final String publicAddress) { - try { - return transform( - hostport, - new BufferedReader(new StringReader(content)), - content.length()); - } catch (final IOException e) { - return "internal error: " + e.getMessage(); - } - } - + + @Override public String transform(String hostport, final byte[] content) throws UnsupportedEncodingException { return transform(hostport, content, "UTF-8"); } - - public String transform(String hostport, final byte[] content, final String encoding, final String publicAddress) { - final ByteArrayInputStream bais = new ByteArrayInputStream(content); - try { - return transform( - hostport, - new BufferedReader(new InputStreamReader(bais, encoding)), - content.length); - } catch (final IOException e) { - return "internal error: " + e.getMessage(); - } - } - - public String transform(String hostport, final byte[] content, final String encoding) throws UnsupportedEncodingException { + + @Override + public String transform(String hostport, final byte[] content, final String encoding) { final ByteArrayInputStream bais = new ByteArrayInputStream(content); try { return transform( @@ -85,4 +65,5 @@ abstract class AbstractWikiParser implements WikiParser { return "internal error: " + e.getMessage(); } } + } diff --git a/source/de/anomic/http/server/AugmentedHtmlStream.java b/source/de/anomic/http/server/AugmentedHtmlStream.java index 437f7052f..26e2d8658 100644 --- a/source/de/anomic/http/server/AugmentedHtmlStream.java +++ b/source/de/anomic/http/server/AugmentedHtmlStream.java @@ -53,7 +53,7 @@ public class AugmentedHtmlStream extends FilterOutputStream { if (this.urls.contains("currentyacypeer/")) { return data; } - return AugmentHtmlStream.process (data, this.charset, this.url, this.requestHeader); + return AugmentHtmlStream.process(data, this.url, this.requestHeader); } public static boolean supportsMime(String mime) { diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java index d450a30bf..7a719c44c 100644 --- a/source/de/anomic/http/server/HTTPDFileHandler.java +++ b/source/de/anomic/http/server/HTTPDFileHandler.java @@ -551,7 +551,7 @@ public final class HTTPDFileHandler { final UserDB.Entry user = sb.userDB.getUser(requestHeader); final boolean user_may_see_proxyurl = Domains.matchesList(clientIP, urlProxyAccess) || (user!=null && user.hasRight(UserDB.AccessRight.PROXY_RIGHT)); if (sb.getConfigBool("proxyURL", false) && user_may_see_proxyurl) { - doURLProxy(args, conProp, requestHeader, out); + doURLProxy(conProp, requestHeader, out); return; } HTTPDemon.sendRespondError(conProp,out,3,403,"Access denied",null,null); @@ -1428,7 +1428,7 @@ public final class HTTPDFileHandler { * not in separete servlet, because we need access to binary outstream * @throws IOException */ - private static void doURLProxy(final serverObjects args, final HashMap conProp, final RequestHeader requestHeader, final OutputStream out) throws IOException { + private static void doURLProxy(final HashMap conProp, final RequestHeader requestHeader, final OutputStream out) throws IOException { final String httpVersion = (String) conProp.get(HeaderFramework.CONNECTION_PROP_HTTP_VER); URL proxyurl = null; String action = ""; diff --git a/source/de/anomic/tools/crypt.java b/source/de/anomic/tools/crypt.java index eb263a57a..a19d8cdf4 100644 --- a/source/de/anomic/tools/crypt.java +++ b/source/de/anomic/tools/crypt.java @@ -81,7 +81,7 @@ public class crypt { } } - public static String simpleDecode(final String encoded, final String key) { + public static String simpleDecode(final String encoded) { if (encoded == null || encoded.length() < 3) { return null; } @@ -111,7 +111,7 @@ public class crypt { public static void main(final String[] args) { final String teststring="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; System.out.println("Teststring = " + teststring); - System.out.println("enc-b result = " + simpleDecode(simpleEncode(teststring, null, 'b'), null)); - System.out.println("enc-z result = " + simpleDecode(simpleEncode(teststring, null, 'z'), null)); + System.out.println("enc-b result = " + simpleDecode(simpleEncode(teststring, null, 'b'))); + System.out.println("enc-z result = " + simpleDecode(simpleEncode(teststring, null, 'z'))); } } \ No newline at end of file diff --git a/source/de/anomic/tools/cryptbig.java b/source/de/anomic/tools/cryptbig.java index 26640f5c9..65e2190d7 100644 --- a/source/de/anomic/tools/cryptbig.java +++ b/source/de/anomic/tools/cryptbig.java @@ -1,4 +1,4 @@ -// cryptbig.java +// cryptbig.java // ------------------------------------- // (C) by Michael Peter Christen; mc@yacy.net // first published on http://www.anomic.de @@ -93,7 +93,7 @@ public class cryptbig { Cipher ecipher; Cipher dcipher; - + public cryptbig(final String pbe) { // this is possible, but not recommended this(pbe, (pbe + "XXXXXXXX").substring(0, 8)); @@ -110,20 +110,20 @@ public class cryptbig { try { if (salt.length() > 8) salt = salt.substring(0,8); if (salt.length() < 8) salt = (salt + "XXXXXXXX").substring(0,8); - + // create the PBE key final SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(method); final SecretKey key = keyFactory.generateSecret(keySpec); // create parameter spec for PBE final PBEParameterSpec paramSpec = new PBEParameterSpec(UTF8.getBytes(salt), 1000 /*ITERATIONS*/); - + // Create a cipher and initialize it for encrypting end decrypting - cryptMethod = method; - ecipher = Cipher.getInstance(cryptMethod); - dcipher = Cipher.getInstance(cryptMethod); - ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec); // paramSpec only for PBE! - dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec); + this.cryptMethod = method; + this.ecipher = Cipher.getInstance(this.cryptMethod); + this.dcipher = Cipher.getInstance(this.cryptMethod); + this.ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec); // paramSpec only for PBE! + this.dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec); } catch (final javax.crypto.NoSuchPaddingException e) { } catch (final java.security.InvalidKeyException e) { } catch (final java.security.NoSuchAlgorithmException e) { @@ -131,7 +131,7 @@ public class cryptbig { } catch (final java.security.InvalidAlgorithmParameterException e) { } } - + // Encode a string into a new string using utf-8, crypt and b64 public String encryptString(final String str) { try { @@ -157,18 +157,18 @@ public class cryptbig { public byte[] encryptArray(final byte[] b) { if (b == null) return null; try { - return ecipher.doFinal(b); + return this.ecipher.doFinal(b); } catch (final javax.crypto.BadPaddingException e) { } catch (final IllegalBlockSizeException e) { } return null; } - + // Decode a string into a new string using b64, crypt and utf-8 public byte[] decryptArray(final byte[] b) { if (b == null) return null; try { - return dcipher.doFinal(b); + return this.dcipher.doFinal(b); } catch (final javax.crypto.BadPaddingException e) { } catch (final IllegalBlockSizeException e) { } @@ -179,14 +179,14 @@ public class cryptbig { // This method returns the available implementations for a service type public static Set listCryptoMethods(final String serviceType) { final Set result = new HashSet(); - + // All providers final Provider[] providers = Security.getProviders(); - for (int i = 0; i < providers.length; i++) { + for (Provider provider : providers) { // Get services provided by each provider - final Set keys = providers[i].keySet(); - for (final Iterator it = keys.iterator(); it.hasNext(); ) { - String key = (String) it.next(); + final Set keys = provider.keySet(); + for (Object name : keys) { + String key = (String) name; key = key.split(" ")[0]; if (key.startsWith(serviceType + ".")) { result.add(key.substring(serviceType.length() + 1)); @@ -218,7 +218,7 @@ public class cryptbig { } } - public void encryptFile(final String inFileName, final String outFileName, final boolean compress) { + public void encryptFile(final String inFileName, final String outFileName) { /* File-Format of encrypted file: Filename: b64-of-encryption-of- plus extension ".crypt" @@ -247,7 +247,7 @@ public class cryptbig { System.out.println("TEST: preserving X-String : " + X); // start encryption - final InputStream fin = new CipherInputStream(new FileInputStream(inFile), ecipher); + final InputStream fin = new CipherInputStream(new FileInputStream(inFile), this.ecipher); final OutputStream fout = new FileOutputStream(outFileName); // write magic and properties of original file @@ -258,8 +258,8 @@ public class cryptbig { // - the length of B is BL; BL is then b64-ed to a string C of fixed length 1 // - after the magic String we write C, B and A try { - final String A = UTF8.String(ecipher.doFinal(X.getBytes("UTF8"))); - final String B = UTF8.String(ecipher.doFinal(Base64Order.standardCoder.encodeLongSB(A.length(), 2).toString().getBytes("UTF8"))); // most probable not longer than 4 + final String A = UTF8.String(this.ecipher.doFinal(X.getBytes("UTF8"))); + final String B = UTF8.String(this.ecipher.doFinal(Base64Order.standardCoder.encodeLongSB(A.length(), 2).toString().getBytes("UTF8"))); // most probable not longer than 4 final String C = Base64Order.standardCoder.encodeLongSB(B.length(), 1).toString(); // fixed length 1 (6 bits, that should be enough) fout.write(UTF8.getBytes(magicString)); // the magic string, used to identify a 'crypt'-file fout.write(UTF8.getBytes(C)); @@ -280,7 +280,7 @@ public class cryptbig { System.err.println("ERROR: IO trouble"); } } - + public void decryptFile(final String inFileName, final String outFileName) { InputStream fin = null; OutputStream fout = null; @@ -301,9 +301,9 @@ public class cryptbig { fin.read(C); // the length of the following String, encoded as b64 final byte[] B = new byte[(int) Base64Order.standardCoder.decodeLong(UTF8.String(C))]; fin.read(B); // this is again the length of the following string, as encrypted b64-ed integer - final byte[] A = new byte[(int) Base64Order.standardCoder.decodeLong(UTF8.String(dcipher.doFinal(B)))]; + final byte[] A = new byte[(int) Base64Order.standardCoder.decodeLong(UTF8.String(this.dcipher.doFinal(B)))]; fin.read(A); - final String X = UTF8.String(dcipher.doFinal(A)); + final String X = UTF8.String(this.dcipher.doFinal(A)); System.out.println("TEST: detecting X-String : " + X); @@ -321,11 +321,11 @@ public class cryptbig { System.out.println("TEST: detecting inFileName : " + origFileName); // open the output file - fout = new BufferedOutputStream(new CipherOutputStream(new FileOutputStream(outFileName), dcipher), 4096); + fout = new BufferedOutputStream(new CipherOutputStream(new FileOutputStream(outFileName), this.dcipher), 4096); // read and decrypt the file copy(fout, fin, 512); - + // close the files fin.close(); fout.close(); @@ -347,7 +347,7 @@ public class cryptbig { }} catch (final Exception ee) {} } } - + private static void copy(final OutputStream out, final InputStream in, final int bufferSize) throws IOException { final InputStream bIn = new BufferedInputStream(in, bufferSize); final OutputStream bOut = new BufferedOutputStream(out, bufferSize); @@ -645,7 +645,7 @@ public class cryptbig { if ((s.length < 3) || (s.length > 4)) {help(); System.exit(-1);} String target; if (s.length == 3) target = s[2] + ".crypt"; else target = s[3]; - (new cryptbig(s[1])).encryptFile(s[2], target, true /*compress*/); + (new cryptbig(s[1])).encryptFile(s[2], target); System.exit(0); } if (s[0].equals("-dec")) { diff --git a/source/net/yacy/ai/example/ConnectFour.java b/source/net/yacy/ai/example/ConnectFour.java index 0da5e8137..cd375b797 100644 --- a/source/net/yacy/ai/example/ConnectFour.java +++ b/source/net/yacy/ai/example/ConnectFour.java @@ -6,17 +6,17 @@ * $LastChangedDate$ * $LastChangedRevision$ * $LastChangedBy$ - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program in the file lgpl21.txt * If not, see . @@ -29,25 +29,26 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import net.yacy.ai.greedy.AbstractModel; import net.yacy.ai.greedy.AbstractFinding; +import net.yacy.ai.greedy.AbstractModel; import net.yacy.ai.greedy.Battle; import net.yacy.ai.greedy.ContextFactory; import net.yacy.ai.greedy.Finding; +import net.yacy.ai.greedy.Goal; import net.yacy.ai.greedy.Model; import net.yacy.ai.greedy.Role; -import net.yacy.ai.greedy.Goal; public class ConnectFour { static final int width = 7; static final int height = 6; - + public static enum Coin implements Role { red('*'), blue('#'); - private String c; + private final String c; Coin(char c) {this.c = String.valueOf(c);} + @Override public Coin nextRole() { return (this == red) ? blue : red; } @@ -55,7 +56,7 @@ public class ConnectFour { public String toString() {return this.c;} public final static Coin[] allCoins = {red, blue}; } - + public static class Move extends AbstractFinding implements Finding { protected final int column; public Move(Coin role, int column) { @@ -84,21 +85,21 @@ public class ConnectFour { return super.getRole().toString() + ":" + Integer.toString(this.column); } } - + public static class Board extends AbstractModel implements Model, Cloneable { Coin[] b; // 2 dimensions folded: array starts in the bottom left and first position in second row is at index position - + /** * create a board with start configuration: empty board * @param nextRole */ public Board(Coin startPlayer) { super(startPlayer); - b = new Coin[height * width]; - for (int i = 0; i < b.length; i++) b[i] = null; + this.b = new Coin[height * width]; + for (int i = 0; i < this.b.length; i++) this.b[i] = null; } - + /** * clone a board and return a new board * @param board @@ -106,69 +107,73 @@ public class ConnectFour { public Board(Board board) { super(board.currentRole()); this.b = new Coin[board.b.length]; - System.arraycopy(board.b, 0, b, 0, b.length); + System.arraycopy(board.b, 0, this.b, 0, this.b.length); } + @Override public Object clone() { return new Board(this); } - + public boolean columnFull(int column) { - return b[(height - 1) * width + column] != null; + return this.b[(height - 1) * width + column] != null; } public Coin getCell(int column, int row) { - return b[row * width + column]; + return this.b[row * width + column]; } - + + @Override public void applyFinding(Move nextStep) { int column = nextStep.getColumn(); int row = 0; - while (row < height && b[row * width + column] != null) row++; + while (row < height && this.b[row * width + column] != null) row++; if (row == height) throw new RuntimeException("column " + column + " is full"); - b[row * width + column] = nextStep.getRole(); + this.b[row * width + column] = nextStep.getRole(); } - + + @Override public int hashCode() { int c = 0; Coin x; - for (int i = 0; i < b.length; i++) { - x = b[i]; + for (int i = 0; i < this.b.length; i++) { + x = this.b[i]; if (x != null) c += (i + 1) * (x.ordinal() + 1); } return c; } + @Override public boolean equals(Object o) { if (!(o instanceof Board)) return false; Board om = (Board) o; Coin c0, c1; - for (int i = 0; i < b.length; i++) { - c0 = b[i]; + for (int i = 0; i < this.b.length; i++) { + c0 = this.b[i]; c1 = om.b[i]; if (!(c0 == null ? c1 == null : c0.equals(c1))) return false; } return true; } - + private boolean count4(int x, int y, int xi, int yi, Coin c) { int steps = 4; Coin cell; while (steps-- > 0) { - cell = b[y * width + x]; + cell = this.b[y * width + x]; if (cell == null || !cell.equals(c)) return false; x += xi; y += yi; } return true; } - + private int countSame(int x, int y, int xi, int yi, Coin c) { int rb = 0; int steps = 4; Coin cell; while (steps-- > 0) { - cell = b[y * width + x]; + cell = this.b[y * width + x]; if (cell != null) { if (cell.equals(c)) rb++; else return rb; } @@ -177,12 +182,14 @@ public class ConnectFour { } return rb; } - + + @Override public Coin isTermination() { for (Coin coin: Coin.allCoins) if (isTermination(coin)) return coin; return null; } - + + @Override public boolean isTermination(Coin coin) { // waagerecht for (int x = 0; x < width - 3; x++) @@ -204,11 +211,12 @@ public class ConnectFour { return false; } + @Override public int getRanking(int findings, Coin coin) { - return 2 * getRankingSingle(findings, coin) - getRankingSingle(findings, coin.nextRole()) - 3 * findings; + return 2 * getRankingSingle(coin) - getRankingSingle(coin.nextRole()) - 3 * findings; } - - private int getRankingSingle(int findings, Coin coin) { + + private int getRankingSingle(Coin coin) { int r = 0; // waagerecht for (int x = 0; x < width - 3; x++) @@ -233,7 +241,8 @@ public class ConnectFour { if (finding.column <= width / 2) return finding.column; return width - 1 - finding.column; } - + + @Override public List explore() { ArrayList moves = new ArrayList(); for (int i = 0; i < width; i++) { @@ -243,7 +252,7 @@ public class ConnectFour { } return moves; } - + @Override public String toString() { StringBuilder s = new StringBuilder((width + 1) * height); @@ -251,7 +260,7 @@ public class ConnectFour { for (int row = height - 1; row >= 0; row--) { s.append('\"'); for (int column = 0; column < width; column++) { - coin = b[row * width + column]; + coin = this.b[row * width + column]; s.append((coin == null) ? " " : coin.toString()); } if (row == 0) s.append('\"'); else s.append("\"+\n"); @@ -259,24 +268,27 @@ public class ConnectFour { return s.toString(); } } - - public static class Strategy implements Goal { + + public static class Strategy implements Goal { public Strategy() { } + @Override public boolean isFulfilled(Board model) { return false; } + @Override public boolean isSnapshot(Board model) { return false; } + @Override public boolean pruning(Board model) { return false; } - + } @@ -288,9 +300,9 @@ public class ConnectFour { strategies.put(Coin.blue, blueFactroy); /*Battle battle =*/ new Battle(new Board(Coin.red), strategies, 2000); } - + public static void main(String[] args) { - + battle(); /* int cores = Runtime.getRuntime().availableProcessors(); @@ -299,7 +311,7 @@ public class ConnectFour { engine.start(); long comptime = 60; long relaxtime = 20; - + agent = new Agent(new Board(Coin.red), new Strategy(comptime, false, false)); // red begins engine.inject(agent); agent.getTeorem().getGoal().awaitTermination(relaxtime); @@ -312,9 +324,9 @@ public class ConnectFour { agent.getGoal().awaitTermination(relaxtime); System.out.println("=========== terminated =========="); agent.printReport(10); - */ - + */ + //engine.stop(); } - + } diff --git a/source/net/yacy/cora/document/RSSMessage.java b/source/net/yacy/cora/document/RSSMessage.java index 7f0b52d9c..1143134ae 100644 --- a/source/net/yacy/cora/document/RSSMessage.java +++ b/source/net/yacy/cora/document/RSSMessage.java @@ -148,7 +148,6 @@ public class RSSMessage implements Hit, Comparable, Comparator. @@ -32,12 +32,12 @@ import org.apache.http.entity.mime.MIME; import org.apache.http.entity.mime.content.AbstractContentBody; public class ByteArrayBody extends AbstractContentBody { - + private final String filename; private final byte[] bytes; /** - * + * * @param bytes of 'file' * @param filename */ @@ -47,33 +47,29 @@ public class ByteArrayBody extends AbstractContentBody { this.filename = filename; } - /** - * @deprecated use {@link #writeTo(OutputStream)} - */ - @Deprecated - public void writeTo(final OutputStream out, int mode) throws IOException { - writeTo(out); - } - @Override public void writeTo(OutputStream outputStream) throws IOException { - outputStream.write(bytes); + outputStream.write(this.bytes); outputStream.flush(); } - public String getFilename() { + @Override + public String getFilename() { return this.filename; } - public String getCharset() { + @Override + public String getCharset() { return null; } - public long getContentLength() { - return bytes.length; + @Override + public long getContentLength() { + return this.bytes.length; } - public String getTransferEncoding() { + @Override + public String getTransferEncoding() { return MIME.ENC_BINARY; } diff --git a/source/net/yacy/cora/protocol/Scanner.java b/source/net/yacy/cora/protocol/Scanner.java index 8f61b648a..cfa9f46bb 100644 --- a/source/net/yacy/cora/protocol/Scanner.java +++ b/source/net/yacy/cora/protocol/Scanner.java @@ -128,7 +128,7 @@ public class Scanner extends Thread { return scancache.size(); } - public static void scancacheReplace(final Scanner newScanner, final long validTime) { + public static void scancacheReplace(final Scanner newScanner) { scancache.clear(); scancache.putAll(newScanner.services()); //scancacheUpdateTime = System.currentTimeMillis(); @@ -136,7 +136,7 @@ public class Scanner extends Thread { scancacheScanrange = newScanner.scanrange; } - public static void scancacheExtend(final Scanner newScanner, final long validTime) { + public static void scancacheExtend(final Scanner newScanner) { final Iterator> i = Scanner.scancache.entrySet().iterator(); Map.Entry entry; while (i.hasNext()) { diff --git a/source/net/yacy/document/TextParser.java b/source/net/yacy/document/TextParser.java index 905576086..75e8cb49f 100644 --- a/source/net/yacy/document/TextParser.java +++ b/source/net/yacy/document/TextParser.java @@ -228,7 +228,7 @@ public final class TextParser { // then we use only one stream-oriented parser. if (idioms.size() == 1 || contentLength > Integer.MAX_VALUE) { // use a specific stream-oriented parser - return parseSource(location, mimeType, idioms.iterator().next(), charset, contentLength, sourceStream); + return parseSource(location, mimeType, idioms.iterator().next(), charset, sourceStream); } // in case that we know more parsers we first transform the content into a byte[] and use that as base @@ -249,7 +249,6 @@ public final class TextParser { final String mimeType, final Parser parser, final String charset, - final long contentLength, final InputStream sourceStream ) throws Parser.Failure { if (log.isFine()) log.logFine("Parsing '" + location + "' from stream"); diff --git a/source/net/yacy/document/importer/OAIPMHImporter.java b/source/net/yacy/document/importer/OAIPMHImporter.java index 6f8372ff4..e3f2affa9 100644 --- a/source/net/yacy/document/importer/OAIPMHImporter.java +++ b/source/net/yacy/document/importer/OAIPMHImporter.java @@ -2,19 +2,19 @@ * OAIPMHImporter * Copyright 2009 by Michael Peter Christen * First released 30.09.2009 at http://yacy.net - * + * * This is a part of YaCy, a peer-to-peer based web search engine * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program in the file lgpl21.txt * If not, see . @@ -46,11 +46,11 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable startedJobs = new ConcurrentHashMap(); public static ConcurrentHashMap runningJobs = new ConcurrentHashMap(); public static ConcurrentHashMap finishedJobs = new ConcurrentHashMap(); - + private final LoaderDispatcher loader; private DigestURI source; private int recordsCount, chunkCount, completeListSize; @@ -59,7 +59,7 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable 50) { @@ -128,7 +134,7 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable o.serialNumber) return 1; if (this.serialNumber < o.serialNumber) return -1; return 0; } - + public static Set getUnloadedOAIServer( LoaderDispatcher loader, File surrogatesIn, @@ -196,7 +205,7 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable) getLoadedOAIServer(surrogatesIn).entrySet()); return map; } - + private static Map getLoadedOAIServer(File surrogates) { HashMap map = new HashMap(); //oaipmh_opus.bsz-bw.de_20091102113118728.xml @@ -232,7 +241,7 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable table = getTable(location, mimeType, charset, source); + final List table = getTable(charset, source); if (table.isEmpty()) throw new Parser.Failure("document has no lines", location); final StringBuilder sb = new StringBuilder(); for (final String[] row: table) { @@ -90,7 +90,7 @@ public class csvParser extends AbstractParser implements Parser { return sb.toString(); } - private List getTable(MultiProtocolURI location, String mimeType, String charset, InputStream source) { + private List getTable(String charset, InputStream source) { final List rows = new ArrayList(); BufferedReader reader; try { diff --git a/source/net/yacy/document/parser/odtParser.java b/source/net/yacy/document/parser/odtParser.java index e5252abfd..f9cf04276 100644 --- a/source/net/yacy/document/parser/odtParser.java +++ b/source/net/yacy/document/parser/odtParser.java @@ -104,8 +104,7 @@ public class odtParser extends AbstractParser implements Parser { return parser; } - private Document[] parse(final DigestURI location, final String mimeType, - final String charset, final File dest) + private Document[] parse(final DigestURI location, final String mimeType, @SuppressWarnings("unused") final String charset, final File dest) throws Parser.Failure, InterruptedException { CharBuffer writer = null; diff --git a/source/net/yacy/document/parser/ooxmlParser.java b/source/net/yacy/document/parser/ooxmlParser.java index 9dcf83266..13c990ce1 100644 --- a/source/net/yacy/document/parser/ooxmlParser.java +++ b/source/net/yacy/document/parser/ooxmlParser.java @@ -88,7 +88,7 @@ public class ooxmlParser extends AbstractParser implements Parser { return parser; } - private Document[] parse(final DigestURI location, final String mimeType, final String charset, final File dest) throws Parser.Failure, InterruptedException { + private Document[] parse(final DigestURI location, final String mimeType, @SuppressWarnings("unused") final String charset, final File dest) throws Parser.Failure, InterruptedException { CharBuffer writer = null; try { diff --git a/source/net/yacy/document/parser/psParser.java b/source/net/yacy/document/parser/psParser.java index e354befae..c2e9e4386 100644 --- a/source/net/yacy/document/parser/psParser.java +++ b/source/net/yacy/document/parser/psParser.java @@ -83,7 +83,7 @@ public class psParser extends AbstractParser implements Parser { } - private Document[] parse(final DigestURI location, final String mimeType, final String charset, final File sourceFile) throws Parser.Failure, InterruptedException { + private Document[] parse(final DigestURI location, final String mimeType, @SuppressWarnings("unused") final String charset, final File sourceFile) throws Parser.Failure, InterruptedException { File outputFile = null; try { diff --git a/source/net/yacy/document/parser/xlsParser.java b/source/net/yacy/document/parser/xlsParser.java index 2cfe8eb52..48b65a158 100644 --- a/source/net/yacy/document/parser/xlsParser.java +++ b/source/net/yacy/document/parser/xlsParser.java @@ -86,7 +86,7 @@ public class xlsParser extends AbstractParser implements Parser { * all extracted information about the parsed document */ public Document[] parse(final DigestURI location, final String mimeType, - final String charset, final InputStream source) throws Parser.Failure, + @SuppressWarnings("unused") final String charset, final InputStream source) throws Parser.Failure, InterruptedException { try { diff --git a/source/net/yacy/gui/framework/Browser.java b/source/net/yacy/gui/framework/Browser.java index d8d4f77af..69e20136d 100644 --- a/source/net/yacy/gui/framework/Browser.java +++ b/source/net/yacy/gui/framework/Browser.java @@ -108,10 +108,10 @@ public class Browser { try { openBrowserJava(url); } catch (Exception ee) { - logBrowserFail(url, ee); + logBrowserFail(url); } } else { - logBrowserFail(url, e); + logBrowserFail(url); } } } @@ -160,7 +160,7 @@ public class Browser { } } - private static void logBrowserFail(final String url, Throwable e) { + private static void logBrowserFail(final String url) { //if (e != null) Log.logException(e); Log.logInfo("Browser", "please start your browser and open the following location: " + url); } diff --git a/source/net/yacy/interaction/AugmentHtmlStream.java b/source/net/yacy/interaction/AugmentHtmlStream.java index 7788a3821..7eb3123c2 100644 --- a/source/net/yacy/interaction/AugmentHtmlStream.java +++ b/source/net/yacy/interaction/AugmentHtmlStream.java @@ -9,7 +9,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import java.net.URLEncoder; -import java.nio.charset.Charset; import net.yacy.yacy; import net.yacy.cora.document.ASCII; @@ -134,12 +133,12 @@ public class AugmentHtmlStream { * * @return the web page with integrated REFLECT elements */ - private static String processExternal(String url, String fieldname, - String data) throws IOException { + private static String processExternal(String url, String fieldname, String data) throws IOException { final HTTPClient client = new HTTPClient(); try { StringBuilder postdata = new StringBuilder(); - postdata.append("document="); + postdata.append(fieldname); + postdata.append('='); postdata.append(URLEncoder.encode(data, "UTF-8")); InputStream in = new ByteArrayInputStream(postdata.toString() .getBytes()); @@ -210,7 +209,7 @@ public class AugmentHtmlStream { return result; } - public static StringBuffer process (StringBuffer data, Charset charset, DigestURI url, RequestHeader requestHeader) { + public static StringBuffer process(StringBuffer data, DigestURI url, RequestHeader requestHeader) { String action = requestHeader.get("YACYACTION"); requestHeader.remove("YACYACTION"); @@ -234,8 +233,7 @@ public class AugmentHtmlStream { if (sb.getConfigBool("augmentation.reflect", false) == true) { try { - Doc = processExternal("http://reflect.ws/REST/GetHTML", - "document", Doc); + Doc = processExternal("http://reflect.ws/REST/GetHTML", "document", Doc); Log.logInfo("AUGMENTATION", "reflected " + url); augmented = true; } catch (Exception e) { diff --git a/source/net/yacy/kelondro/blob/MapDataMining.java b/source/net/yacy/kelondro/blob/MapDataMining.java index ef36e46d4..5f9b2da6f 100644 --- a/source/net/yacy/kelondro/blob/MapDataMining.java +++ b/source/net/yacy/kelondro/blob/MapDataMining.java @@ -66,8 +66,7 @@ public class MapDataMining extends MapHeap { final int cachesize, final String[] sortfields, final String[] longaccfields, - final String[] floataccfields, - final Object externalHandler) throws IOException { + final String[] floataccfields) throws IOException { super(heapFile, keylength, ordering, buffermax, cachesize, ' '); // create fast ordering clusters and acc fields @@ -423,7 +422,7 @@ public class MapDataMining extends MapHeap { try { File f = new File("/tmp/MapDataMinig.test.db"); f.delete(); - final MapDataMining db = new MapDataMining(f, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, new String[] {"X"}, new String[] {"X"}, new String[] {}, null); + final MapDataMining db = new MapDataMining(f, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, new String[] {"X"}, new String[] {"X"}, new String[] {}); final Map m1 = new HashMap(); long t = System.currentTimeMillis(); m1.put("X", Long.toString(t)); diff --git a/source/net/yacy/kelondro/data/citation/CitationReference.java b/source/net/yacy/kelondro/data/citation/CitationReference.java index 1272b7193..e26a4f379 100644 --- a/source/net/yacy/kelondro/data/citation/CitationReference.java +++ b/source/net/yacy/kelondro/data/citation/CitationReference.java @@ -172,7 +172,7 @@ public class CitationReference implements Reference, Serializable { throw new UnsupportedOperationException(); } - public int position(int p) { + public int position(@SuppressWarnings("unused") int p) { throw new UnsupportedOperationException(); } diff --git a/source/net/yacy/kelondro/data/meta/URIMetadataRow.java b/source/net/yacy/kelondro/data/meta/URIMetadataRow.java index 571939634..21d4e156b 100644 --- a/source/net/yacy/kelondro/data/meta/URIMetadataRow.java +++ b/source/net/yacy/kelondro/data/meta/URIMetadataRow.java @@ -225,17 +225,17 @@ public class URIMetadataRow implements URIMetadata { //System.out.println("DEBUG-ENTRY: prop=" + prop.toString()); DigestURI url; try { - url = new DigestURI(crypt.simpleDecode(prop.getProperty("url", ""), null), ASCII.getBytes(prop.getProperty("hash"))); + url = new DigestURI(crypt.simpleDecode(prop.getProperty("url", ""))); } catch (final MalformedURLException e) { url = null; } - String descr = crypt.simpleDecode(prop.getProperty("descr", ""), null); if (descr == null) descr = ""; - String dc_creator = crypt.simpleDecode(prop.getProperty("author", ""), null); if (dc_creator == null) dc_creator = ""; - String tags = crypt.simpleDecode(prop.getProperty("tags", ""), null); if (tags == null) tags = ""; + String descr = crypt.simpleDecode(prop.getProperty("descr", "")); if (descr == null) descr = ""; + String dc_creator = crypt.simpleDecode(prop.getProperty("author", "")); if (dc_creator == null) dc_creator = ""; + String tags = crypt.simpleDecode(prop.getProperty("tags", "")); if (tags == null) tags = ""; tags = Tagging.cleanTagFromAutotagging(tags); - String dc_publisher = crypt.simpleDecode(prop.getProperty("publisher", ""), null); if (dc_publisher == null) dc_publisher = ""; - String lons = crypt.simpleDecode(prop.getProperty("lon", "0.0"), null); if (lons == null) lons = "0.0"; - String lats = crypt.simpleDecode(prop.getProperty("lat", "0.0"), null); if (lats == null) lats = "0.0"; + String dc_publisher = crypt.simpleDecode(prop.getProperty("publisher", "")); if (dc_publisher == null) dc_publisher = ""; + String lons = crypt.simpleDecode(prop.getProperty("lon", "0.0")); if (lons == null) lons = "0.0"; + String lats = crypt.simpleDecode(prop.getProperty("lat", "0.0")); if (lats == null) lats = "0.0"; this.entry = rowdef.newEntry(); this.entry.setCol(col_hash, url.hash()); // FIXME potential null pointer access @@ -274,7 +274,7 @@ public class URIMetadataRow implements URIMetadata { this.entry.setCol(col_laudio, Integer.parseInt(prop.getProperty("laudio", "0"))); this.entry.setCol(col_lvideo, Integer.parseInt(prop.getProperty("lvideo", "0"))); this.entry.setCol(col_lapp, Integer.parseInt(prop.getProperty("lapp", "0"))); - this.snippet = crypt.simpleDecode(prop.getProperty("snippet", ""), null); + this.snippet = crypt.simpleDecode(prop.getProperty("snippet", "")); this.word = null; if (prop.containsKey("word")) throw new kelondroException("old database structure is not supported"); if (prop.containsKey("wi")) { diff --git a/source/net/yacy/kelondro/index/RAMIndex.java b/source/net/yacy/kelondro/index/RAMIndex.java index 3eae20871..fbc193728 100644 --- a/source/net/yacy/kelondro/index/RAMIndex.java +++ b/source/net/yacy/kelondro/index/RAMIndex.java @@ -50,11 +50,10 @@ public final class RAMIndex implements Index, Iterable { private final Row.EntryComparator entryComparator; //private final int spread; - public RAMIndex(final String name, final Row rowdef, final int expectedspace) { + public RAMIndex(final String name, final Row rowdef) { this.name = name; this.rowdef = rowdef; this.entryComparator = new Row.EntryComparator(rowdef.objectOrder); - //this.spread = Math.max(10, expectedspace / 3000); reset(); objectTracker.put(name, this); } diff --git a/source/net/yacy/kelondro/index/RAMIndexCluster.java b/source/net/yacy/kelondro/index/RAMIndexCluster.java index 212dd36cd..ded7793d8 100644 --- a/source/net/yacy/kelondro/index/RAMIndexCluster.java +++ b/source/net/yacy/kelondro/index/RAMIndexCluster.java @@ -113,7 +113,7 @@ public final class RAMIndexCluster implements Index, Iterable, Clonea if (r == null) synchronized (this.cluster) { r = this.cluster[i]; if (r == null) { - r = new RAMIndex(this.name + "." + i, this.rowdef, 0); + r = new RAMIndex(this.name + "." + i, this.rowdef); this.cluster[i] = r; } } diff --git a/source/net/yacy/kelondro/order/MergeIterator.java b/source/net/yacy/kelondro/order/MergeIterator.java index 09452934b..c0448a46f 100644 --- a/source/net/yacy/kelondro/order/MergeIterator.java +++ b/source/net/yacy/kelondro/order/MergeIterator.java @@ -218,7 +218,7 @@ public class MergeIterator implements CloneableIterator { // do not remove the following method, it is not reference anywhere directly but indirectly using reflection // please see initialization of simpleMerge above - public static Object mergeEqualByReplace(final Object a, final Object b) { + public static Object mergeEqualByReplace(final Object a, @SuppressWarnings("unused") final Object b) { return a; } } diff --git a/source/net/yacy/kelondro/table/SQLTable.java b/source/net/yacy/kelondro/table/SQLTable.java index 56b9a89e5..ce8db797d 100644 --- a/source/net/yacy/kelondro/table/SQLTable.java +++ b/source/net/yacy/kelondro/table/SQLTable.java @@ -34,7 +34,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; -import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -271,14 +270,6 @@ public class SQLTable implements Index, Iterable { throw new UnsupportedOperationException(); } - public synchronized void addUnique(final Row.Entry row, final Date entryDate) { - throw new UnsupportedOperationException(); - } - - public synchronized void addUnique(final List rows) { - throw new UnsupportedOperationException(); - } - @Override public Row.Entry remove(final byte[] key) throws IOException { PreparedStatement sqlStatement = null; @@ -354,11 +345,6 @@ public class SQLTable implements Index, Iterable { return 0; } - public int columnSize(final int column) { - // TODO Auto-generated method stub - return 0; - } - public ByteOrder order() { return order; } diff --git a/source/net/yacy/kelondro/table/Table.java b/source/net/yacy/kelondro/table/Table.java index f81d37359..3075abf56 100644 --- a/source/net/yacy/kelondro/table/Table.java +++ b/source/net/yacy/kelondro/table/Table.java @@ -31,7 +31,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.ConcurrentModificationException; -import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -641,10 +640,6 @@ public class Table implements Index, Iterable { } } - public Entry put(final Entry row, final Date entryDate) throws IOException, RowSpaceExceededException { - return replace(row); - } - /** * remove one entry from the file * @param i an index position within the file (not a byte position) diff --git a/source/net/yacy/kelondro/workflow/InstantBusyThread.java b/source/net/yacy/kelondro/workflow/InstantBusyThread.java index d193f65c7..e91b6cf7f 100644 --- a/source/net/yacy/kelondro/workflow/InstantBusyThread.java +++ b/source/net/yacy/kelondro/workflow/InstantBusyThread.java @@ -160,7 +160,7 @@ public final class InstantBusyThread extends AbstractBusyThread implements BusyT } } - public static BusyThread oneTimeJob(final Object env, final String jobExec, final Log log, final long startupDelay) { + public static BusyThread oneTimeJob(final Object env, final String jobExec, final long startupDelay) { // start the job and execute it once as background process final BusyThread thread = new InstantBusyThread( env, jobExec, null, null, Long.MIN_VALUE, Long.MAX_VALUE, Long.MIN_VALUE, Long.MAX_VALUE); @@ -173,9 +173,7 @@ public final class InstantBusyThread extends AbstractBusyThread implements BusyT } public static WorkflowThread oneTimeJob(final Runnable thread, final long startupDelay) { - final Log log = new Log(thread.getClass().getName() + "/run"); - log.setLevel(java.util.logging.Level.INFO); - return oneTimeJob(thread, "run", log, startupDelay); + return oneTimeJob(thread, "run", startupDelay); } public static WorkflowThread oneTimeJob(final Runnable thread, final long startupDelay, final int maxJobs) { diff --git a/source/net/yacy/peers/NewsPool.java b/source/net/yacy/peers/NewsPool.java index 33b87b676..2f9de6e56 100644 --- a/source/net/yacy/peers/NewsPool.java +++ b/source/net/yacy/peers/NewsPool.java @@ -284,10 +284,10 @@ public class NewsPool { this.processedNews.close(); } - public Iterator recordIterator(final int dbKey, final boolean up) { + public Iterator recordIterator(final int dbKey) { // returns an iterator of yacyNewsRecord-type objects final NewsQueue queue = switchQueue(dbKey); - return queue.records(up); + return queue.iterator(); } public NewsDB.Record parseExternal(final String external) { @@ -373,7 +373,7 @@ public class NewsPool { NewsDB.Record record; int pc = 0; synchronized (this.incomingNews) { - final Iterator i = this.incomingNews.records(true); + final Iterator i = this.incomingNews.iterator(); final Set removeIDs = new HashSet(); // this loop should not run too long! This may happen if the incoming news are long and not deleted after processing final long start = System.currentTimeMillis(); @@ -435,7 +435,7 @@ public class NewsPool { final NewsQueue queue = switchQueue(dbKey); NewsDB.Record record; String s; - final Iterator i = queue.records(true); + final Iterator i = queue.iterator(); while (i.hasNext()) { record = i.next(); if ((record != null) && (record.category().equals(category))) { @@ -449,7 +449,7 @@ public class NewsPool { public synchronized NewsDB.Record getByOriginator(final int dbKey, final String category, final String originatorHash) { final NewsQueue queue = switchQueue(dbKey); NewsDB.Record record; - final Iterator i = queue.records(true); + final Iterator i = queue.iterator(); while (i.hasNext()) { record = i.next(); if ((record != null) && @@ -529,7 +529,7 @@ public class NewsPool { private int moveOffAll(final NewsQueue fromqueue, final NewsQueue toqueue) throws IOException, RowSpaceExceededException { // move off all news from a specific queue to another queue - final Iterator i = fromqueue.records(true); + final Iterator i = fromqueue.iterator(); NewsDB.Record record; if (toqueue == null) return 0; int c = 0; diff --git a/source/net/yacy/peers/NewsQueue.java b/source/net/yacy/peers/NewsQueue.java index 20f52b12c..de52ae597 100644 --- a/source/net/yacy/peers/NewsQueue.java +++ b/source/net/yacy/peers/NewsQueue.java @@ -131,7 +131,7 @@ public class NewsQueue implements Iterable { public synchronized NewsDB.Record get(final String id) { NewsDB.Record record; - final Iterator i = records(true); + final Iterator i = iterator(); while (i.hasNext()) { record = i.next(); if ((record != null) && (record.id().equals(id))) return record; @@ -141,7 +141,7 @@ public class NewsQueue implements Iterable { public synchronized NewsDB.Record remove(final String id) { NewsDB.Record record; - final Iterator i = records(true); + final Iterator i = iterator(); while (i.hasNext()) { record = i.next(); if ((record != null) && (record.id().equals(id))) { @@ -174,13 +174,9 @@ public class NewsQueue implements Iterable { @Override public Iterator iterator() { - return records(true); - } - - public Iterator records(final boolean up) { // iterates yacyNewsRecord-type objects if (this.queueStack == null) return new HashSet().iterator(); - return new newsIterator(up); + return new newsIterator(); } private class newsIterator implements Iterator { @@ -188,7 +184,7 @@ public class NewsQueue implements Iterable { Iterator stackNodeIterator; - private newsIterator(final boolean up) { + private newsIterator() { try { this.stackNodeIterator = NewsQueue.this.queueStack.rows(); } catch (final IOException e) { @@ -197,10 +193,12 @@ public class NewsQueue implements Iterable { } } + @Override public boolean hasNext() { return this.stackNodeIterator != null && this.stackNodeIterator.hasNext(); } + @Override public NewsDB.Record next() { if (this.stackNodeIterator == null) return null; Row.Entry row; @@ -218,6 +216,7 @@ public class NewsQueue implements Iterable { } } + @Override public void remove() { if (this.stackNodeIterator != null) this.stackNodeIterator.remove(); } diff --git a/source/net/yacy/peers/PeerActions.java b/source/net/yacy/peers/PeerActions.java index e37583ae6..198eb6da5 100644 --- a/source/net/yacy/peers/PeerActions.java +++ b/source/net/yacy/peers/PeerActions.java @@ -227,7 +227,7 @@ public class PeerActions { final String recordString = peer.get("news", null); //System.out.println("### triggered news arrival from peer " + peer.getName() + ", news " + ((recordString == null) ? "empty" : "attached")); if ((recordString == null) || (recordString.length() == 0)) return; - final String decodedString = de.anomic.tools.crypt.simpleDecode(recordString, ""); + final String decodedString = de.anomic.tools.crypt.simpleDecode(recordString); final NewsDB.Record record = this.newsPool.parseExternal(decodedString); if (record != null) { //System.out.println("### news arrival from peer " + peer.getName() + ", decoded=" + decodedString + ", record=" + recordString + ", news=" + record.toString()); diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java index d5b04fc0c..b8c366bbd 100644 --- a/source/net/yacy/peers/Protocol.java +++ b/source/net/yacy/peers/Protocol.java @@ -241,7 +241,7 @@ public final class Protocol return -1; } final String host = Domains.dnsResolve(address.substring(0, p)).getHostAddress(); - otherPeer = Seed.genRemoteSeed(seed, salt, false, host); + otherPeer = Seed.genRemoteSeed(seed, false, host); if ( !otherPeer.hash.equals(otherHash) ) { Network.log.logInfo("yacyClient.hello: consistency error: otherPeer.hash = " + otherPeer.hash @@ -354,9 +354,9 @@ public final class Protocol return -1; } final String host = Domains.dnsResolve(address.substring(0, p)).getHostAddress(); - s = Seed.genRemoteSeed(seedStr, salt, false, host); + s = Seed.genRemoteSeed(seedStr, false, host); } else { - s = Seed.genRemoteSeed(seedStr, salt, false, null); + s = Seed.genRemoteSeed(seedStr, false, null); } if ( peerActions.peerArrival(s, (i == 1)) ) { count++; @@ -397,7 +397,7 @@ public final class Protocol return null; } //final Date remoteTime = yacyCore.parseUniversalDate((String) result.get(yacySeed.MYTIME)); // read remote time - return Seed.genRemoteSeed(result.get("response"), salt, false, target.getIP()); + return Seed.genRemoteSeed(result.get("response"), false, target.getIP()); } catch ( final Exception e ) { Network.log.logWarning("yacyClient.querySeed error:" + e.getMessage()); return null; diff --git a/source/net/yacy/peers/Seed.java b/source/net/yacy/peers/Seed.java index 2af48cd67..a47c6b77b 100644 --- a/source/net/yacy/peers/Seed.java +++ b/source/net/yacy/peers/Seed.java @@ -956,7 +956,6 @@ public class Seed implements Cloneable, Comparable, Comparator public static Seed genRemoteSeed( final String seedStr, - final String key, final boolean ownSeed, final String patchIP) throws IOException { // this method is used to convert the external representation of a seed into a seed object @@ -969,7 +968,7 @@ public class Seed implements Cloneable, Comparable, Comparator if ( seedStr.length() == 0 ) { throw new IOException("seedStr.length() == 0"); } - final String seed = crypt.simpleDecode(seedStr, key); + final String seed = crypt.simpleDecode(seedStr); if ( seed == null ) { throw new IOException("seed == null"); } @@ -1107,7 +1106,7 @@ public class Seed implements Cloneable, Comparable, Comparator final char[] b = new char[(int) f.length()]; fr.read(b, 0, b.length); fr.close(); - final Seed mySeed = genRemoteSeed(new String(b), null, true, null); + final Seed mySeed = genRemoteSeed(new String(b), true, null); assert mySeed != null; // in case of an error, an IOException is thrown mySeed.dna.put(Seed.IP, ""); // set own IP as unknown return mySeed; diff --git a/source/net/yacy/peers/SeedDB.java b/source/net/yacy/peers/SeedDB.java index 350b8de05..5d9753fa1 100644 --- a/source/net/yacy/peers/SeedDB.java +++ b/source/net/yacy/peers/SeedDB.java @@ -313,12 +313,12 @@ public final class SeedDB implements AlternativeDomainNames { Log.logWarning("yacySeedDB", "could not create directories for "+ seedDBFile.getParent()); } try { - return new MapDataMining(seedDBFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, sortFields, longaccFields, doubleaccFields, this); + return new MapDataMining(seedDBFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, sortFields, longaccFields, doubleaccFields); } catch (final Exception e) { // try again FileUtils.deletedelete(seedDBFile); try { - return new MapDataMining(seedDBFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, sortFields, longaccFields, doubleaccFields, this); + return new MapDataMining(seedDBFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, sortFields, longaccFields, doubleaccFields); } catch (final IOException e1) { Log.logException(e1); System.exit(-1); @@ -870,6 +870,7 @@ public final class SeedDB implements AlternativeDomainNames { /** * resolve a yacy address */ + @Override public String resolve(String host) { Seed seed; int p; @@ -983,6 +984,7 @@ public final class SeedDB implements AlternativeDomainNames { } } + @Override public boolean hasNext() { return (this.nextSeed != null); } @@ -1022,6 +1024,7 @@ public final class SeedDB implements AlternativeDomainNames { } } + @Override public Seed next() { final Seed seed = this.nextSeed; double version; @@ -1041,6 +1044,7 @@ public final class SeedDB implements AlternativeDomainNames { return seed; } + @Override public void remove() { throw new UnsupportedOperationException(); } diff --git a/source/net/yacy/peers/graphics/NetworkGraph.java b/source/net/yacy/peers/graphics/NetworkGraph.java index 716c266a7..e534a1b64 100644 --- a/source/net/yacy/peers/graphics/NetworkGraph.java +++ b/source/net/yacy/peers/graphics/NetworkGraph.java @@ -124,7 +124,7 @@ public class NetworkGraph { if (primarySearches == null) return null; // this was a local search and there are no threads // get a copy of a recent network picture - final RasterPlotter eventPicture = getNetworkPicture(seedDB, 120000, 640, 480, 300, 300, 9000, coronaangle, -1, Switchboard.getSwitchboard().getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"), Switchboard.getSwitchboard().getConfig("network.unit.description", "unspecified"), COL_BACKGROUND, cyc); + final RasterPlotter eventPicture = getNetworkPicture(seedDB, 640, 480, 300, 300, 9000, coronaangle, -1, Switchboard.getSwitchboard().getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"), Switchboard.getSwitchboard().getConfig("network.unit.description", "unspecified"), COL_BACKGROUND, cyc); //if (eventPicture instanceof ymageMatrix) eventPicture = (ymageMatrix) eventPicture; //new ymageMatrix((ymageMatrix) eventPicture); // TODO: fix cloning of ymageMatrix pictures @@ -169,7 +169,7 @@ public class NetworkGraph { return eventPicture; } - public static RasterPlotter getNetworkPicture(final SeedDB seedDB, final long maxAge, final int width, final int height, final int passiveLimit, final int potentialLimit, final int maxCount, final int coronaangle, final long communicationTimeout, final String networkName, final String networkTitle, final String bgcolor, final int cyc) { + public static RasterPlotter getNetworkPicture(final SeedDB seedDB, final int width, final int height, final int passiveLimit, final int potentialLimit, final int maxCount, final int coronaangle, final long communicationTimeout, final String networkName, final String networkTitle, final String bgcolor, final int cyc) { return drawNetworkPicture(seedDB, width, height, passiveLimit, potentialLimit, maxCount, coronaangle, communicationTimeout, networkName, networkTitle, bgcolor, cyc); } diff --git a/source/net/yacy/peers/graphics/WebStructureGraph.java b/source/net/yacy/peers/graphics/WebStructureGraph.java index 2ab3394c0..7424b7f5a 100644 --- a/source/net/yacy/peers/graphics/WebStructureGraph.java +++ b/source/net/yacy/peers/graphics/WebStructureGraph.java @@ -47,7 +47,6 @@ import net.yacy.cora.date.GenericFormatter; import net.yacy.cora.document.ASCII; import net.yacy.cora.document.MultiProtocolURI; import net.yacy.cora.document.UTF8; -import net.yacy.document.Condenser; import net.yacy.document.Document; import net.yacy.kelondro.data.meta.DigestURI; import net.yacy.kelondro.index.Row; @@ -153,10 +152,7 @@ public class WebStructureGraph } } - public void generateCitationReference( - final DigestURI url, - final Document document, - final Condenser condenser) { + public void generateCitationReference(final DigestURI url, final Document document) { // generate citation reference final Map hl = document.getHyperlinks(); final Iterator it = hl.keySet().iterator(); diff --git a/source/net/yacy/repository/FilterEngine.java b/source/net/yacy/repository/FilterEngine.java index a35706059..ed4fda08d 100644 --- a/source/net/yacy/repository/FilterEngine.java +++ b/source/net/yacy/repository/FilterEngine.java @@ -112,9 +112,6 @@ public class FilterEngine { this.hostpaths_notmatchable.remove(host); } - public void remove(final String listType, final String host, final String path) { - } - public boolean isListed(final DigestURI url, final EnumSet type) { // trival anwser if (url.getHost() == null) @@ -126,7 +123,7 @@ public class FilterEngine { return e.containsAll(type); } // Cache Miss - return isListed(url.getHost().toLowerCase(), url.getFile(), type); + return isListed(url.getHost().toLowerCase(), url.getFile()); } public static boolean isMatchable (final String host) { @@ -144,7 +141,7 @@ public class FilterEngine { return false; } - public boolean isListed(final String host, String path, final EnumSet type) { + public boolean isListed(final String host, String path) { if (host == null) throw new NullPointerException(); if (path == null) throw new NullPointerException(); diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java index 81e2a4728..71aeac883 100644 --- a/source/net/yacy/search/Switchboard.java +++ b/source/net/yacy/search/Switchboard.java @@ -299,7 +299,7 @@ public final class Switchboard extends serverSwitch // UPnP port mapping if ( getConfigBool(SwitchboardConstants.UPNP_ENABLED, false) ) { - InstantBusyThread.oneTimeJob(UPnP.class, "addPortMapping", UPnP.log, 0); + InstantBusyThread.oneTimeJob(UPnP.class, "addPortMapping", 0); } // init TrayIcon if possible @@ -461,7 +461,7 @@ public final class Switchboard extends serverSwitch // start yacy core this.log.logConfig("Starting YaCy Protocol Core"); this.yc = new Network(this); - InstantBusyThread.oneTimeJob(this, "loadSeedLists", Network.log, 0); + InstantBusyThread.oneTimeJob(this, "loadSeedLists", 0); //final long startedSeedListAquisition = System.currentTimeMillis(); // init a DHT transmission dispatcher @@ -762,7 +762,7 @@ public final class Switchboard extends serverSwitch wikiParser = new WikiCode(); // initializing the resourceObserver - InstantBusyThread.oneTimeJob(ResourceObserver.class, "initThread", ResourceObserver.log, 0); + InstantBusyThread.oneTimeJob(ResourceObserver.class, "initThread", 0); // initializing the stackCrawlThread this.crawlStacker = @@ -1453,7 +1453,7 @@ public final class Switchboard extends serverSwitch public RankingProfile getRanking() { return (getConfig("rankingProfile", "").length() == 0) ? new RankingProfile(Classification.ContentDomain.TEXT) - : new RankingProfile("", crypt.simpleDecode(sb.getConfig("rankingProfile", ""), null)); + : new RankingProfile("", crypt.simpleDecode(sb.getConfig("rankingProfile", ""))); } /** @@ -2509,16 +2509,13 @@ public final class Switchboard extends serverSwitch public indexingQueueEntry webStructureAnalysis(final indexingQueueEntry in) { in.queueEntry.updateStatus(Response.QUEUE_STATE_STRUCTUREANALYSIS); - for ( int i = 0; i < in.documents.length; i++ ) { + for (Document document : in.documents) { assert this.webStructure != null; assert in != null; assert in.queueEntry != null; assert in.documents != null; assert in.queueEntry != null; - this.webStructure.generateCitationReference( - in.queueEntry.url(), - in.documents[i], - (in.condenser == null) ? null : in.condenser[i]); // [outlinksSame, outlinksOther] + this.webStructure.generateCitationReference(in.queueEntry.url(), document); // [outlinksSame, outlinksOther] } return in; } @@ -2761,10 +2758,9 @@ public final class Switchboard extends serverSwitch if ( document.indexingDenied() ) { throw new Parser.Failure("indexing is denied", url); } - final Condenser condenser = - new Condenser(document, true, true, LibraryProvider.dymLib, true); + final Condenser condenser = new Condenser(document, true, true, LibraryProvider.dymLib, true); ResultImages.registerImages(url, document, true); - Switchboard.this.webStructure.generateCitationReference(url, document, condenser); + Switchboard.this.webStructure.generateCitationReference(url, document); storeDocumentIndex( response, document, @@ -2998,7 +2994,7 @@ public final class Switchboard extends serverSwitch return accessSet.tailSet(Long.valueOf(System.currentTimeMillis() - timeInterval)).size(); } - public String dhtShallTransfer(final String segment) { + public String dhtShallTransfer() { final String cautionCause = onlineCaution(); if ( cautionCause != null ) { return "online caution for " + cautionCause + ", dht transmission"; @@ -3047,14 +3043,10 @@ public final class Switchboard extends serverSwitch } public boolean dhtTransferJob() { - return dhtTransferJob(getConfig(SwitchboardConstants.SEGMENT_DHTOUT, "default")); - } - - public boolean dhtTransferJob(final String segment) { if ( this.dhtDispatcher == null ) { return false; } - final String rejectReason = dhtShallTransfer(segment); + final String rejectReason = dhtShallTransfer(); if ( rejectReason != null ) { if ( this.log.isFine() ) { this.log.logFine(rejectReason); @@ -3429,7 +3421,7 @@ public final class Switchboard extends serverSwitch int lc = 0; while ( enu.hasNext() ) { try { - Seed ys = Seed.genRemoteSeed(enu.next(), null, false, null); + Seed ys = Seed.genRemoteSeed(enu.next(), false, null); if ( (ys != null) && (!peers.mySeedIsDefined() || !peers.mySeed().hash.equals(ys.hash)) ) { final long lastseen = Math.abs((System.currentTimeMillis() - ys.getLastSeenUTC()) / 1000 / 60); diff --git a/source/net/yacy/search/SwitchboardConstants.java b/source/net/yacy/search/SwitchboardConstants.java index 5dc46dca8..e9fd74dd2 100644 --- a/source/net/yacy/search/SwitchboardConstants.java +++ b/source/net/yacy/search/SwitchboardConstants.java @@ -452,16 +452,4 @@ public final class SwitchboardConstants { public static final String TRAY_ICON_FORCED = "tray.icon.force"; public static final String TRAY_ICON_LABEL = "tray.icon.label"; public static final String TRAY_MENU_ENABLED = "tray.menu.enabled"; - - /** - * Segments - */ - public static final String SEGMENT_RECEIPTS = "segment.process.receipts_tmp"; - public static final String SEGMENT_QUERIES = "segment.process.queries_tmp"; - public static final String SEGMENT_DHTIN = "segment.process.dhtin_tmp"; - public static final String SEGMENT_DHTOUT = "segment.process.dhtout_tmp"; - public static final String SEGMENT_PROXY = "segment.process.proxy_tmp"; - public static final String SEGMENT_LOCALCRAWLING = "segment.process.localcrawling_tmp"; - public static final String SEGMENT_REMOTECRAWLING= "segment.process.remotecrawling_tmp"; - public static final String SEGMENT_PUBLIC = "segment.process.public_tmp"; } diff --git a/source/net/yacy/search/query/SnippetProcess.java b/source/net/yacy/search/query/SnippetProcess.java index d0745f374..fad0d573c 100644 --- a/source/net/yacy/search/query/SnippetProcess.java +++ b/source/net/yacy/search/query/SnippetProcess.java @@ -575,7 +575,6 @@ public class SnippetProcess { null, ((this.query.constraint != null) && (this.query.constraint.get(Condenser.flag_cat_indexof))), 220, - Integer.MAX_VALUE, !this.query.isLocal()); return new ResultEntry(page, this.query.getSegment(), this.peers, snippet, null, dbRetrievalTime, 0); // result without snippet } @@ -592,7 +591,6 @@ public class SnippetProcess { cacheStrategy, ((this.query.constraint != null) && (this.query.constraint.get(Condenser.flag_cat_indexof))), 180, - Integer.MAX_VALUE, !this.query.isLocal()); final long snippetComputationTime = System.currentTimeMillis() - startTime; Log.logInfo("SEARCH", "text snippet load time for " + page.url() + ": " + snippetComputationTime + ", " + (!snippet.getErrorCode().fail() ? "snippet found" : ("no snippet found (" + snippet.getError() + ")"))); diff --git a/source/net/yacy/search/snippet/TextSnippet.java b/source/net/yacy/search/snippet/TextSnippet.java index 65839436d..be561a482 100644 --- a/source/net/yacy/search/snippet/TextSnippet.java +++ b/source/net/yacy/search/snippet/TextSnippet.java @@ -151,7 +151,6 @@ public class TextSnippet implements Comparable, Comparator>> it; it = db.entries(true, false); @@ -1059,6 +1059,7 @@ class shutdownHookThread extends Thread { this.mainThread = mainThread; } + @Override public void run() { try { if (!this.sb.isTerminated()) {