diff --git a/htroot/Banner.java b/htroot/Banner.java index 9fad6e8d3..2521f9914 100644 --- a/htroot/Banner.java +++ b/htroot/Banner.java @@ -34,7 +34,6 @@ import javax.imageio.ImageIO; import net.yacy.cora.protocol.RequestHeader; import net.yacy.peers.Seed; import net.yacy.peers.graphics.BannerData; -import net.yacy.peers.graphics.NetworkGraph; import net.yacy.search.Switchboard; import net.yacy.search.SwitchboardConstants; import net.yacy.visualization.RasterPlotter; @@ -111,12 +110,12 @@ public class Banner { } } - final BannerData data = + final BannerData data = new BannerData( width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, peers, nlinks, nwords, nqph, nppm); - + if (!net.yacy.peers.graphics.Banner.logoIsLoaded()) { // do not write a cache to disc; keep in RAM ImageIO.setUseCache(false); diff --git a/htroot/Table_API_p.java b/htroot/Table_API_p.java index 5320f2deb..9b2bb29f6 100644 --- a/htroot/Table_API_p.java +++ b/htroot/Table_API_p.java @@ -36,7 +36,6 @@ import net.yacy.kelondro.logging.Log; import net.yacy.search.Switchboard; import net.yacy.search.SwitchboardConstants; import net.yacy.search.query.QueryParams; - import de.anomic.data.WorkTables; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -73,7 +72,6 @@ public class Table_API_p { typefilter = Pattern.compile(post.get("filter", ".*")); } - String pk; boolean scheduleevent = false; // flag if schedule info of row changes String current_schedule_pk = ""; // pk of changed schedule data row if (post != null && post.containsKey("scheduleevent")) { diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index 4e864831a..9f92e1c8b 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -61,7 +61,7 @@ public class yacysearchitem { private static final int MAX_NAME_LENGTH = 60; private static final int MAX_URL_LENGTH = 120; - private static boolean col = true; + //private static boolean col = true; public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) { final Switchboard sb = (Switchboard) env; diff --git a/source/de/anomic/data/ymark/YMarkAutoTagger.java b/source/de/anomic/data/ymark/YMarkAutoTagger.java index 1176836a8..34a3c57d8 100644 --- a/source/de/anomic/data/ymark/YMarkAutoTagger.java +++ b/source/de/anomic/data/ymark/YMarkAutoTagger.java @@ -4,13 +4,13 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.MalformedURLException; import java.util.Arrays; -import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import java.util.TreeSet; import java.util.concurrent.ArrayBlockingQueue; + import net.yacy.cora.document.UTF8; import net.yacy.cora.services.federated.yacy.CacheStrategy; import net.yacy.document.Condenser; @@ -28,11 +28,11 @@ import de.anomic.crawler.retrieval.Response; public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandler { private static final String EMPTY_STRING = new String(); - - + + public final static String SPACE = " "; public final static String POISON = ""; - public final static HashSet stopwords = new HashSet(Arrays.asList(".", "!", "?", "nbsp", "uuml", "ouml", "auml", "amp", "quot", "laquo", "raquo", + public final static HashSet stopwords = new HashSet(Arrays.asList(".", "!", "?", "nbsp", "uuml", "ouml", "auml", "amp", "quot", "laquo", "raquo", "and", "with", "the", "gt", "lt")); @@ -81,10 +81,10 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle return null; } } - + public static String autoTag(final Document document, final int max, final TreeMap tags) { final TreeSet topwords = new TreeSet(); - StringBuilder token; + StringBuilder token; if(document == null) { return EMPTY_STRING; @@ -92,7 +92,7 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle //get words from document final Map words = new Condenser(document, true, true, LibraryProvider.dymLib).words(); - + // generate potential tags from document title, description and subject final int bufferSize = document.dc_title().length() + document.dc_description().length() + document.dc_subject(' ').length() + 32; final StringBuilder buffer = new StringBuilder(bufferSize); @@ -103,21 +103,21 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle final WordTokenizer tokens = new WordTokenizer(new ByteArrayInputStream(UTF8.getBytes(buffer.toString())), LibraryProvider.dymLib); try { int score = 0; - + // get phrases final TreeMap phrases = getPhrases(document, 2); phrases.putAll(getPhrases(document, 3)); final Iterator iter = phrases.keySet().iterator(); while(iter.hasNext()) { score = 10; - final String phrase = iter.next(); + final String phrase = iter.next(); if(phrases.get(phrase).size() > 3 && phrases.get(phrase).size() < 10) { score = phrases.get(phrase).size() * phrase.split(" ").length * 20; } if(isDigitSpace(phrase)) { score = 10; } - if(phrases.get(phrase).size() > 2 && buffer.indexOf(phrase) > 1) { + if(phrases.get(phrase).size() > 2 && buffer.indexOf(phrase) > 1) { score = score * 10; } if (tags.containsKey(phrase)) { @@ -127,14 +127,14 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle pwords.append(phrase); pwords.append(' '); } - + // loop through potential tag and rank them - while(tokens.hasMoreElements()) { + while(tokens.hasMoreElements()) { score = 0; token = tokens.nextElement(); - + // check if the token appears in the text - if (words.containsKey(token.toString())) { + if (words.containsKey(token.toString())) { final Word word = words.get(token.toString()); // token appears in text and matches an existing bookmark tag if (tags.containsKey(token.toString())) { @@ -172,8 +172,8 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle } finally { tokens.close(); } - } - + } + private static TreeMap getPhrases(final Document document, final int size) { final TreeMap phrases = new TreeMap(); final StringBuilder phrase = new StringBuilder(128); @@ -181,33 +181,33 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle try { StringBuilder token; int count = 0; - + // loop through text - while(tokens.hasMoreElements()) { - - token = tokens.nextElement(); + while(tokens.hasMoreElements()) { + + token = tokens.nextElement(); if(stopwords.contains(token.toString()) || isDigitSpace(token.toString())) - continue; - + continue; + // if we have a full phrase, delete the first token count++; if(count > size) phrase.delete(0, phrase.indexOf(SPACE)+1); - + // append new token if(phrase.length() > 1) - phrase.append(SPACE); + phrase.append(SPACE); phrase.append(token); - + if(count >= size) { // make sure we really have a phrase if(phrases.containsKey(phrase.toString())) { phrases.get(phrase.toString()).inc(); } else { phrases.put(phrase.toString(), new YMarkTag(phrase.toString())); } - } + } } - + return phrases; } finally { tokens.close(); @@ -221,7 +221,7 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle else return "/IOExceptions"; } - + public static boolean isDigitSpace(String str) { if (str == null) { return false; @@ -235,7 +235,8 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle return true; } - public void run() { + @Override + public void run() { Log.logInfo(YMarkTables.BOOKMARKS_LOG, "autoTagger run()"); Thread.currentThread().setUncaughtExceptionHandler(this); String url = null; @@ -247,9 +248,9 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle while((url = this.bmkQueue.take()) != POISON) { tagString = autoTag(url, this.loader, 5, tags); if (tagString.equals("/IOExceptions")) { - this.ymarks.addFolder(bmk_user, url, tagString); + this.ymarks.addFolder(this.bmk_user, url, tagString); tagString = ""; - } + } // update tags this.ymarks.addTags(this.bmk_user, url, tagString, this.merge); @@ -275,7 +276,8 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle } } - public void uncaughtException(final Thread t, final Throwable e) { + @Override + public void uncaughtException(final Thread t, final Throwable e) { Log.logWarning(YMarkTables.BOOKMARKS_LOG, "I caught an uncaughtException in thread "+t.getName()); Log.logException(e); } diff --git a/source/de/anomic/http/server/TemplateEngine.java b/source/de/anomic/http/server/TemplateEngine.java index a047689f7..0b31aca1c 100644 --- a/source/de/anomic/http/server/TemplateEngine.java +++ b/source/de/anomic/http/server/TemplateEngine.java @@ -129,7 +129,7 @@ public final class TemplateEngine { private final static byte lbr = (byte)'['; private final static byte rbr = (byte)']'; - private final static byte[] pOpen = {hashChar, lbr}; + //private final static byte[] pOpen = {hashChar, lbr}; private final static byte[] pClose = {rbr, hashChar}; private final static byte lcbr = (byte)'{'; @@ -142,7 +142,7 @@ public final class TemplateEngine { private final static byte[] aOpen = {hashChar, lrbr}; private final static byte[] aClose = {rrbr, hashChar}; - private final static byte[] iOpen = {hashChar, pcChar}; + //private final static byte[] iOpen = {hashChar, pcChar}; private final static byte[] iClose = {pcChar, hashChar}; private final static byte[] ul = "_".getBytes(); diff --git a/source/de/anomic/tools/loaderThreads.java b/source/de/anomic/tools/loaderThreads.java index 176525bda..784c124d7 100644 --- a/source/de/anomic/tools/loaderThreads.java +++ b/source/de/anomic/tools/loaderThreads.java @@ -1,4 +1,4 @@ -// loaderThreads.java +// loaderThreads.java // --------------------------- // (C) by Michael Peter Christen; mc@yacy.net // first published on http://www.anomic.de @@ -24,7 +24,6 @@ package de.anomic.tools; -import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -33,7 +32,7 @@ import net.yacy.cora.protocol.http.ProxySettings; import net.yacy.kelondro.data.meta.DigestURI; public class loaderThreads { - + // global values for loader threads protected int timeout; protected String user; @@ -41,16 +40,16 @@ public class loaderThreads { protected ProxySettings remoteProxyConfig; // management objects for collection of threads - private Map threads; + private final Map threads; private int completed, failed; - + public loaderThreads() { this(10000, null, null); } - + public loaderThreads( - final int timeout, - final String user, + final int timeout, + final String user, final String password ) { this.timeout = timeout; @@ -60,45 +59,45 @@ public class loaderThreads { this.completed = 0; this.failed = 0; } - + public void newThread(final String name, final DigestURI url, final loaderProcess process) { final Thread t = new loaderThread(url, process); - threads.put(name, t); + this.threads.put(name, t); t.start(); } - + public void terminateThread(final String name) { - final loaderThread t = (loaderThread) threads.get(name); + final loaderThread t = (loaderThread) this.threads.get(name); if (t == null) throw new RuntimeException("no such thread: " + name); t.terminate(); } - + public int threadCompleted(final String name) { - final loaderThread t = (loaderThread) threads.get(name); + final loaderThread t = (loaderThread) this.threads.get(name); if (t == null) throw new RuntimeException("no such thread: " + name); return t.completed(); } - + public int threadStatus(final String name) { - final loaderThread t = (loaderThread) threads.get(name); + final loaderThread t = (loaderThread) this.threads.get(name); if (t == null) throw new RuntimeException("no such thread: " + name); return t.status(); } - + public int completed() { - return completed; + return this.completed; } - + public int failed() { - return failed; + return this.failed; } - + public int count() { - return threads.size(); + return this.threads.size(); } - + public Exception threadError(final String name) { - final loaderThread t = (loaderThread) threads.get(name); + final loaderThread t = (loaderThread) this.threads.get(name); if (t == null) throw new RuntimeException("no such thread: " + name); return t.error(); } @@ -109,7 +108,7 @@ public class loaderThreads { private final loaderProcess process; private byte[] page; private boolean loaded; - + public loaderThread(final DigestURI url, final loaderProcess process) { this.url = url; this.process = process; @@ -118,47 +117,48 @@ public class loaderThreads { this.loaded = false; } + @Override public void run() { try { - page = url.get(ClientIdentification.getUserAgent(), timeout); - loaded = true; - process.feed(page); - if (process.status() == loaderCore.STATUS_FAILED) { - error = process.error(); + this.page = this.url.get(ClientIdentification.getUserAgent(), loaderThreads.this.timeout); + this.loaded = true; + this.process.feed(this.page); + if (this.process.status() == loaderCore.STATUS_FAILED) { + this.error = this.process.error(); } - if ((process.status() == loaderCore.STATUS_COMPLETED) || - (process.status() == loaderCore.STATUS_FINALIZED)) completed++; - if ((process.status() == loaderCore.STATUS_ABORTED) || - (process.status() == loaderCore.STATUS_FAILED)) failed++; + if ((this.process.status() == loaderCore.STATUS_COMPLETED) || + (this.process.status() == loaderCore.STATUS_FINALIZED)) loaderThreads.this.completed++; + if ((this.process.status() == loaderCore.STATUS_ABORTED) || + (this.process.status() == loaderCore.STATUS_FAILED)) loaderThreads.this.failed++; } catch (final Exception e) { - error = e; - failed++; + this.error = e; + loaderThreads.this.failed++; } } - + public void terminate() { - process.terminate(); + this.process.terminate(); } - + public boolean loaded() { - return loaded; + return this.loaded; } - + public int completed() { - if (process.status() == loaderCore.STATUS_READY) return 1; - if (process.status() == loaderCore.STATUS_RUNNING) return 9 + ((process.completed() * 9) / 10); - if (process.status() == loaderCore.STATUS_COMPLETED) return 100; + if (this.process.status() == loaderCore.STATUS_READY) return 1; + if (this.process.status() == loaderCore.STATUS_RUNNING) return 9 + ((this.process.completed() * 9) / 10); + if (this.process.status() == loaderCore.STATUS_COMPLETED) return 100; return 0; } public int status() { - return process.status(); // see constants in loaderCore + return this.process.status(); // see constants in loaderCore } - + public Exception error() { - return error; + return this.error; } - + } } diff --git a/source/net/yacy/cora/storage/ConfigurationSet.java b/source/net/yacy/cora/storage/ConfigurationSet.java index 99fe6de16..3277b6328 100644 --- a/source/net/yacy/cora/storage/ConfigurationSet.java +++ b/source/net/yacy/cora/storage/ConfigurationSet.java @@ -32,6 +32,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.Serializable; import java.util.Iterator; +import java.util.Map; import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -200,7 +201,8 @@ public class ConfigurationSet extends TreeMap implements Serializa File bakfile = new File (this.file.getAbsolutePath() + ".bak"); FileUtils.copy (this.file, bakfile); - TreeMap tclone = (TreeMap) this.clone(); // clone to write appended entries + @SuppressWarnings("unchecked") + TreeMap tclone = (TreeMap) this.clone(); // clone to write appended entries final BufferedWriter writer = new BufferedWriter(new FileWriter(this.file)); try { @@ -248,7 +250,7 @@ public class ConfigurationSet extends TreeMap implements Serializa } catch (final IOException e) {} // write remainig entries (not already written) - Iterator ie = tclone.entrySet().iterator(); + Iterator> ie = tclone.entrySet().iterator(); while (ie.hasNext()) { Object e = ie.next(); writer.write (e.toString() + "\n"); diff --git a/source/net/yacy/document/parser/dwgParser.java b/source/net/yacy/document/parser/dwgParser.java index f5d58ce42..c35ffa468 100644 --- a/source/net/yacy/document/parser/dwgParser.java +++ b/source/net/yacy/document/parser/dwgParser.java @@ -50,7 +50,7 @@ public class dwgParser extends AbstractParser implements Parser { * How far to skip after the last standard property, before * we find any custom properties that might be there. */ - private static final int CUSTOM_PROPERTIES_SKIP = 20; + //private static final int CUSTOM_PROPERTIES_SKIP = 20; public dwgParser() { super("DWG (CAD Drawing) parser (very basic)"); diff --git a/source/net/yacy/kelondro/logging/ThreadDump.java b/source/net/yacy/kelondro/logging/ThreadDump.java index 74f1e53c3..6ed2571c7 100644 --- a/source/net/yacy/kelondro/logging/ThreadDump.java +++ b/source/net/yacy/kelondro/logging/ThreadDump.java @@ -36,7 +36,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.regex.Pattern; import net.yacy.document.parser.html.CharacterCoding; @@ -210,7 +209,7 @@ public class ThreadDump extends HashMap> imp Thread thread; // collect single dumps - for (final Entry entry: stackTraces.entrySet()) { + for (final Map.Entry entry: stackTraces.entrySet()) { thread = entry.getKey(); final StackTraceElement[] stackTraceElements = entry.getValue(); StackTraceElement ste; @@ -274,7 +273,7 @@ public class ThreadDump extends HashMap> imp bufferappend(buffer, plain, ""); // write dumps - for (final Entry> entry: entrySet()) { + for (final Map.Entry> entry: entrySet()) { final List threads = entry.getValue(); for (final String t: threads) bufferappend(buffer, plain, t); bufferappend(buffer, plain, entry.getKey().text); @@ -317,7 +316,7 @@ public class ThreadDump extends HashMap> imp ThreadDump x; for (final Map trace: stackTraces) { x = new ThreadDump(rootPath, trace, plain, Thread.State.RUNNABLE); - for (final Entry> e: x.entrySet()) { + for (final Map.Entry> e: x.entrySet()) { if (multiDumpFilterPattern.matcher(e.getKey().text).matches()) continue; Integer c = dumps.get(e.getKey().text); if (c == null) dumps.put(e.getKey().text, Integer.valueOf(1)); @@ -330,16 +329,16 @@ public class ThreadDump extends HashMap> imp // write dumps while (!dumps.isEmpty()) { - final Entry e = removeMax(dumps); + final Map.Entry e = removeMax(dumps); bufferappend(buffer, plain, "Occurrences: " + e.getValue()); bufferappend(buffer, plain, e.getKey()); } bufferappend(buffer, plain, ""); } - private static Entry removeMax(final Map result) { - Entry max = null; - for (final Entry e: result.entrySet()) { + private static Map.Entry removeMax(final Map result) { + Map.Entry max = null; + for (final Map.Entry e: result.entrySet()) { if (max == null || e.getValue().intValue() > max.getValue().intValue()) { max = e; } diff --git a/source/net/yacy/peers/graphics/NetworkGraph.java b/source/net/yacy/peers/graphics/NetworkGraph.java index bbb091fad..716c266a7 100644 --- a/source/net/yacy/peers/graphics/NetworkGraph.java +++ b/source/net/yacy/peers/graphics/NetworkGraph.java @@ -324,12 +324,12 @@ public class NetworkGraph { private static class drawNetworkPicturePeerJob { - private RasterPlotter img; - private int centerX, centerY, innerradius, outerradius, coronaangle; - private Seed seed; - private String colorDot, colorLine, colorText; - private double cyc; - public drawNetworkPicturePeerJob() {} // used to produce a poison pill + private final RasterPlotter img; + private final int centerX, centerY, innerradius, outerradius, coronaangle; + private final Seed seed; + private final String colorDot, colorLine, colorText; + private final double cyc; + //public drawNetworkPicturePeerJob() {} // used to produce a poison pill public drawNetworkPicturePeerJob( final RasterPlotter img, final int centerX, final int centerY, final int innerradius, final int outerradius, diff --git a/source/net/yacy/search/query/RWIProcess.java b/source/net/yacy/search/query/RWIProcess.java index 145678cca..324e9c47a 100644 --- a/source/net/yacy/search/query/RWIProcess.java +++ b/source/net/yacy/search/query/RWIProcess.java @@ -95,7 +95,6 @@ public final class RWIProcess extends Thread private final ScoreMap ref; // reference score computation for the commonSense heuristic private final Map hostResolver; // a mapping from a host hash (6 bytes) to the full url hash of one of these urls that have the host hash private final ReferenceOrder order; - private final long startTime; private boolean addRunning; private final boolean remote; @@ -141,7 +140,6 @@ public final class RWIProcess extends Thread this.ref = new ConcurrentScoreMap(); this.feedersAlive = new AtomicInteger(0); this.feedersTerminated = new AtomicInteger(0); - this.startTime = System.currentTimeMillis(); this.maxExpectedRemoteReferences = new AtomicInteger(0); this.expectedRemoteReferences = new AtomicInteger(0); this.receivedRemoteReferences = new AtomicInteger(0); diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java index c335798d9..243d63132 100644 --- a/source/net/yacy/search/query/SearchEvent.java +++ b/source/net/yacy/search/query/SearchEvent.java @@ -505,16 +505,21 @@ public final class SearchEvent this.urlhash = urlhash; this.heuristicName = heuristicName; this.redundant = redundant; - }/* - public int compareTo(HeuristicResult o) { + } + + public int compareTo(HeuristicResult o) { return Base64Order.enhancedCoder.compare(this.urlhash, o.urlhash); } - public int hashCode() { + + @Override + public int hashCode() { return (int) Base64Order.enhancedCoder.cardinal(this.urlhash); - } - public boolean equals(Object o) { + } + + @Override + public boolean equals(Object o) { return Base64Order.enhancedCoder.equal(this.urlhash, ((HeuristicResult) o).urlhash); - }*/ + } } public class SecondarySearchSuperviser extends Thread diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java index 85ef9bc8b..8f271a0d8 100644 --- a/source/net/yacy/yacy.java +++ b/source/net/yacy/yacy.java @@ -57,7 +57,6 @@ import net.yacy.cora.protocol.http.HTTPClient; import net.yacy.cora.sorting.Array; import net.yacy.cora.sorting.OrderedScoreMap; import net.yacy.cora.sorting.ScoreMap; -import net.yacy.gui.Tray; import net.yacy.gui.YaCyApp; import net.yacy.gui.framework.Browser; import net.yacy.kelondro.blob.MapDataMining;