removed unused method parameters

pull/1/head
Michael Peter Christen 13 years ago
parent 241dd8410a
commit 0301aba1e9

@ -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 =

@ -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;
}

@ -44,7 +44,7 @@ public class CrawlMonitorRemoteStart {
boolean dark = true;
// create other peer crawl table using YaCyNews
Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(NewsPool.INCOMING_DB, true);
Iterator<NewsDB.Record> 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();

@ -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;

@ -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);
}
}

@ -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++;
}

@ -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()));

@ -257,7 +257,7 @@ public class Network {
final HashMap<String, Map<String, String>> updatedBlog = new HashMap<String, Map<String, String>>();
final HashMap<String, String> isCrawling = new HashMap<String, String>();
NewsDB.Record record;
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(NewsPool.INCOMING_DB, true);
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(NewsPool.INCOMING_DB);
while (recordIterator.hasNext()) {
record = recordIterator.next();
if (record == null) {

@ -126,7 +126,6 @@ public class NetworkPicture
buffer =
new EncodedImage(NetworkGraph.getNetworkPicture(
sb.peers,
10000,
width,
height,
passiveLimit,

@ -103,7 +103,7 @@ public class News {
if (sb.peers != null) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(tableID));
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(tableID, false);
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(tableID);
NewsDB.Record record;
Seed seed;
int i = 0;

@ -92,9 +92,9 @@ public class Supporter {
// make new news message with voting
final HashMap<String, String> map = new HashMap<String, String>();
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<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));
NewsDB.Record record;
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);
final Iterator<NewsDB.Record> 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<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));
NewsDB.Record record;
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype);
int j = 0;
String url = "", urlhash;
Row.Entry entry;

@ -99,9 +99,9 @@ public class Surftips {
// make new news message with voting
final HashMap<String, String> map = new HashMap<String, String>();
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<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));
NewsDB.Record record;
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);
final Iterator<NewsDB.Record> 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<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));
NewsDB.Record record;
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);
final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(dbtype);
int j = 0;
String url = "", urlhash;
Row.Entry entry;

@ -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:

@ -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());

@ -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, "<unknown>"); // 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;

@ -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;

@ -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());

@ -516,7 +516,6 @@ public class CrawlProfile extends ConcurrentHashMap<String, String> 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,

@ -36,6 +36,7 @@ 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(
@ -47,22 +48,13 @@ abstract class AbstractWikiParser implements WikiParser {
}
}
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) {
@Override
public String transform(String hostport, final byte[] content, final String encoding) {
final ByteArrayInputStream bais = new ByteArrayInputStream(content);
try {
return transform(
@ -74,15 +66,4 @@ abstract class AbstractWikiParser implements WikiParser {
}
}
public String transform(String hostport, final byte[] content, final String encoding) throws UnsupportedEncodingException {
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();
}
}
}

@ -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) {

@ -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<String, Object> conProp, final RequestHeader requestHeader, final OutputStream out) throws IOException {
private static void doURLProxy(final HashMap<String, Object> 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 = "";

@ -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')));
}
}

@ -119,11 +119,11 @@ public class cryptbig {
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) {
@ -157,7 +157,7 @@ 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) {
}
@ -168,7 +168,7 @@ public class cryptbig {
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) {
}
@ -182,11 +182,11 @@ public class cryptbig {
// 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-<encryption-date: YYYYMMddHHmmSSsss> 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));
@ -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,7 +321,7 @@ 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);
@ -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")) {

@ -29,14 +29,14 @@ 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 {
@ -46,8 +46,9 @@ public class ConnectFour {
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;
}
@ -95,8 +96,8 @@ public class ConnectFour {
*/
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;
}
/**
@ -106,45 +107,49 @@ 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;
}
@ -155,7 +160,7 @@ public class ConnectFour {
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;
@ -168,7 +173,7 @@ public class ConnectFour {
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;
}
@ -178,11 +183,13 @@ 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++)
@ -234,6 +242,7 @@ public class ConnectFour {
return width - 1 - finding.column;
}
@Override
public List<Move> explore() {
ArrayList<Move> moves = new ArrayList<Move>();
for (int i = 0; i < width; i++) {
@ -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");
@ -265,14 +274,17 @@ public class ConnectFour {
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;
}

@ -148,7 +148,6 @@ public class RSSMessage implements Hit, Comparable<RSSMessage>, Comparator<RSSMe
@Override
public int compareTo(final RSSMessage o) {
if (!(o instanceof RSSMessage)) return 1;
return getLink().compareTo(o.getLink());
}

@ -47,32 +47,28 @@ 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();
}
@Override
public String getFilename() {
return this.filename;
}
@Override
public String getCharset() {
return null;
}
@Override
public long getContentLength() {
return bytes.length;
return this.bytes.length;
}
@Override
public String getTransferEncoding() {
return MIME.ENC_BINARY;
}

@ -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<Map.Entry<Service, Access>> i = Scanner.scancache.entrySet().iterator();
Map.Entry<Service, Access> entry;
while (i.hasNext()) {

@ -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");

@ -82,6 +82,7 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable<OAIPM
startedJobs.put(this, N);
}
@Override
public int count() {
return this.recordsCount;
}
@ -90,6 +91,7 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable<OAIPM
return this.chunkCount;
}
@Override
public String status() {
return this.message;
}
@ -102,18 +104,22 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable<OAIPM
return this.completeListSize;
}
@Override
public long remainingTime() {
return (this.isAlive()) ? Long.MAX_VALUE : 0; // we don't know
}
@Override
public long runningTime() {
return (this.isAlive()) ? System.currentTimeMillis() - this.startTime : this.finishTime - this.startTime;
}
@Override
public String source() {
return source.toNormalform(true, false);
return this.source.toNormalform(true, false);
}
@Override
public int speed() {
return (int) (1000L * (count()) / runningTime());
}
@ -128,7 +134,7 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable<OAIPM
this.message = "loading first part of records";
while (true) {
try {
OAIPMHLoader loader = new OAIPMHLoader(this.loader, this.source, Switchboard.getSwitchboard().surrogatesInPath, filenamePrefix);
OAIPMHLoader loader = new OAIPMHLoader(this.loader, this.source, Switchboard.getSwitchboard().surrogatesInPath);
this.completeListSize = Math.max(this.completeListSize, loader.getResumptionToken().getCompleteListSize());
this.chunkCount++;
this.recordsCount += loader.getResumptionToken().getRecordCounter();
@ -151,10 +157,12 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable<OAIPM
// methods that are needed to put the object into a Hashtable or a Map:
@Override
public int hashCode() {
return this.serialNumber;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
@ -164,6 +172,7 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable<OAIPM
}
// methods that are needed to put the object into a Tree:
@Override
public int compareTo(OAIPMHImporter o) {
if (this.serialNumber > o.serialNumber) return 1;
if (this.serialNumber < o.serialNumber) return -1;

@ -44,7 +44,7 @@ public class OAIPMHLoader {
private final DigestURI source;
private final ResumptionToken resumptionToken;
public OAIPMHLoader(final LoaderDispatcher loader, final DigestURI source, final File targetDir, final String filePrefix) throws IOException {
public OAIPMHLoader(final LoaderDispatcher loader, final DigestURI source, final File targetDir) throws IOException {
this.source = source;
// load the file from the net

@ -32,7 +32,6 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.document.AbstractParser;
import net.yacy.document.Document;
import net.yacy.document.Parser;
@ -50,11 +49,12 @@ public class csvParser extends AbstractParser implements Parser {
this.SUPPORTED_EXTENSIONS.add("csv");
}
@Override
public Document[] parse(DigestURI location, String mimeType, String charset, InputStream source) throws Parser.Failure, InterruptedException {
// construct a document using all cells of the document
// the first row is used as headline
// all lines are artificially terminated by a '.' to separate them as sentence for the condenser.
final List<String[]> table = getTable(location, mimeType, charset, source);
final List<String[]> 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<String[]> getTable(MultiProtocolURI location, String mimeType, String charset, InputStream source) {
private List<String[]> getTable(String charset, InputStream source) {
final List<String[]> rows = new ArrayList<String[]>();
BufferedReader reader;
try {

@ -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;

@ -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 {

@ -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 {

@ -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 {

@ -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);
}

@ -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) {

@ -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<String, String> m1 = new HashMap<String, String>();
long t = System.currentTimeMillis();
m1.put("X", Long.toString(t));

@ -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();
}

@ -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")) {

@ -50,11 +50,10 @@ public final class RAMIndex implements Index, Iterable<Row.Entry> {
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);
}

@ -113,7 +113,7 @@ public final class RAMIndexCluster implements Index, Iterable<Row.Entry>, 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;
}
}

@ -218,7 +218,7 @@ public class MergeIterator<E> implements CloneableIterator<E> {
// 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;
}
}

@ -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<Row.Entry> {
throw new UnsupportedOperationException();
}
public synchronized void addUnique(final Row.Entry row, final Date entryDate) {
throw new UnsupportedOperationException();
}
public synchronized void addUnique(final List<Row.Entry> 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<Row.Entry> {
return 0;
}
public int columnSize(final int column) {
// TODO Auto-generated method stub
return 0;
}
public ByteOrder order() {
return order;
}

@ -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<Row.Entry> {
}
}
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)

@ -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) {

@ -284,10 +284,10 @@ public class NewsPool {
this.processedNews.close();
}
public Iterator<NewsDB.Record> recordIterator(final int dbKey, final boolean up) {
public Iterator<NewsDB.Record> 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<NewsDB.Record> i = this.incomingNews.records(true);
final Iterator<NewsDB.Record> i = this.incomingNews.iterator();
final Set<String> removeIDs = new HashSet<String>();
// 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<NewsDB.Record> i = queue.records(true);
final Iterator<NewsDB.Record> 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<NewsDB.Record> i = queue.records(true);
final Iterator<NewsDB.Record> 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<NewsDB.Record> i = fromqueue.records(true);
final Iterator<NewsDB.Record> i = fromqueue.iterator();
NewsDB.Record record;
if (toqueue == null) return 0;
int c = 0;

@ -131,7 +131,7 @@ public class NewsQueue implements Iterable<NewsDB.Record> {
public synchronized NewsDB.Record get(final String id) {
NewsDB.Record record;
final Iterator<NewsDB.Record> i = records(true);
final Iterator<NewsDB.Record> 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<NewsDB.Record> {
public synchronized NewsDB.Record remove(final String id) {
NewsDB.Record record;
final Iterator<NewsDB.Record> i = records(true);
final Iterator<NewsDB.Record> i = iterator();
while (i.hasNext()) {
record = i.next();
if ((record != null) && (record.id().equals(id))) {
@ -174,13 +174,9 @@ public class NewsQueue implements Iterable<NewsDB.Record> {
@Override
public Iterator<NewsDB.Record> iterator() {
return records(true);
}
public Iterator<NewsDB.Record> records(final boolean up) {
// iterates yacyNewsRecord-type objects
if (this.queueStack == null) return new HashSet<NewsDB.Record>().iterator();
return new newsIterator(up);
return new newsIterator();
}
private class newsIterator implements Iterator<NewsDB.Record> {
@ -188,7 +184,7 @@ public class NewsQueue implements Iterable<NewsDB.Record> {
Iterator<Row.Entry> 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<NewsDB.Record> {
}
}
@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<NewsDB.Record> {
}
}
@Override
public void remove() {
if (this.stackNodeIterator != null) this.stackNodeIterator.remove();
}

@ -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());

@ -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;

@ -956,7 +956,6 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
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<Seed>, Comparator<Seed>
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<Seed>, Comparator<Seed>
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;

@ -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();
}

@ -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);
}

@ -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<MultiProtocolURI, String> hl = document.getHyperlinks();
final Iterator<MultiProtocolURI> it = hl.keySet().iterator();

@ -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<listTypes> 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<listTypes> type) {
public boolean isListed(final String host, String path) {
if (host == null) throw new NullPointerException();
if (path == null) throw new NullPointerException();

@ -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);

@ -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";
}

@ -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() + ")")));

@ -151,7 +151,6 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
final CacheStrategy cacheStrategy,
final boolean pre,
final int snippetMaxLength,
final int maxDocLen,
final boolean reindexing) {
// heise = "0OQUNU3JSs05"
final DigestURI url = row.url();

@ -913,7 +913,7 @@ public final class yacy {
final String[] dbFileNames = {"seed.new.db","seed.old.db","seed.pot.db"};
for (final String dbFileName : dbFileNames) {
final File dbFile = new File(yacyDBPath,dbFileName);
final MapDataMining db = new MapDataMining(dbFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, SeedDB.sortFields, SeedDB.longaccFields, SeedDB.doubleaccFields, null);
final MapDataMining db = new MapDataMining(dbFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, SeedDB.sortFields, SeedDB.longaccFields, SeedDB.doubleaccFields);
Iterator<Map.Entry<byte[], Map<String, String>>> 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()) {

Loading…
Cancel
Save