diff --git a/build.properties b/build.properties index 5075bf4fc..0583b76a5 100644 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ javacSource=1.5 javacTarget=1.5 # Release Configuration -releaseVersion=0.563 +releaseVersion=0.564 stdReleaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz embReleaseFile=yacy_emb_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz proReleaseFile=yacy_pro_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz diff --git a/htroot/ViewProfile.html b/htroot/ViewProfile.html index de84fce21..4cb64e56a 100644 --- a/htroot/ViewProfile.html +++ b/htroot/ViewProfile.html @@ -3,6 +3,7 @@ YaCy '#[clientname]#': Remote Peer Profile + #%env/templates/metas.template%# @@ -25,7 +26,7 @@

The peer #[peername]# is not online.

::

This is the Profile of #[peername]#:

- +
Name
#(name)# ::#[value]##(/name)#
@@ -58,7 +59,10 @@
#[value]# 
#{/other}#
+
#(/success)# +

View this profile as rdf:foaf or + vCard

#(display)# #%env/templates/simplefooter.template%# :: diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.java index 26a7f272d..0903c7c72 100644 --- a/source/de/anomic/data/bookmarksDB.java +++ b/source/de/anomic/data/bookmarksDB.java @@ -74,7 +74,6 @@ import org.xml.sax.SAXException; import de.anomic.htmlFilter.htmlFilterContentScraper; import de.anomic.htmlFilter.htmlFilterWriter; -import de.anomic.plasma.plasmaCondenser; import de.anomic.kelondro.kelondroCloneableIterator; import de.anomic.kelondro.kelondroDyn; import de.anomic.kelondro.kelondroException; @@ -82,6 +81,7 @@ import de.anomic.kelondro.kelondroMapObjects; import de.anomic.kelondro.kelondroNaturalOrder; import de.anomic.kelondro.kelondroObjects; import de.anomic.kelondro.kelondroObjectsMapEntry; +import de.anomic.plasma.plasmaCondenser; import de.anomic.server.serverDate; import de.anomic.server.serverFileUtils; import de.anomic.server.logging.serverLog; @@ -722,15 +722,15 @@ public class bookmarksDB { public static final String TAG_NAME="tagName"; private String tagHash; private Map mem; - private Set urlHashes; + private Set urlHashes; public Tag(String hash, Map map){ tagHash=hash; mem=map; if(mem.containsKey(URL_HASHES)) - urlHashes=listManager.string2set((String) mem.get(URL_HASHES)); + urlHashes = listManager.string2set((String) mem.get(URL_HASHES)); else - urlHashes=new HashSet(); + urlHashes = new HashSet(); } public Tag(String name, HashSet entries){ tagHash=tagHash(name); @@ -776,7 +776,7 @@ public class bookmarksDB { } return "notagname"; } - public Set getUrlHashes(){ + public Set getUrlHashes(){ return urlHashes; } public boolean hasPublicItems(){ diff --git a/source/de/anomic/data/wiki/knwikiParser.java b/source/de/anomic/data/wiki/knwikiParser.java index 6a4cbd7ba..b2674b4b1 100644 --- a/source/de/anomic/data/wiki/knwikiParser.java +++ b/source/de/anomic/data/wiki/knwikiParser.java @@ -154,10 +154,10 @@ public class knwikiParser implements wikiParser { new DefinitionListToken(), new TableToken() }; - ArrayList r = new ArrayList(); - for (int i=0, k, j; i r = new ArrayList(); + for (int i = 0, k, j; i < tokens.length; i++) if (tokens[i].getBlockElementNames() != null) - for (j=0; j 1) { r.add(tokens[i].getBlockElementNames()[j].substring(0, k)); @@ -265,7 +265,7 @@ public class knwikiParser implements wikiParser { int startLen = escapeBegin.length(); int endLen = escapeEnd.length(); - ArrayList r = new ArrayList(); + ArrayList r = new ArrayList(); boolean escaped = text.startsWith(escapeBegin); if (escaped) r.add(new Text("", false, true)); int i, j = 0; diff --git a/source/de/anomic/data/wiki/tokens/LinkToken.java b/source/de/anomic/data/wiki/tokens/LinkToken.java index 75b40cf08..8df7397c7 100644 --- a/source/de/anomic/data/wiki/tokens/LinkToken.java +++ b/source/de/anomic/data/wiki/tokens/LinkToken.java @@ -168,15 +168,15 @@ public class LinkToken extends AbstractToken { private Link[] getLinksFromBookmarkTag(String tagName) { Tag tag = this.sb.bookmarksDB.getTag(bookmarksDB.tagHash(tagName)); if (tag == null) return null; - ArrayList r = new ArrayList(); - Iterator it = tag.getUrlHashes().iterator(); + ArrayList r = new ArrayList(); + Iterator it = tag.getUrlHashes().iterator(); String hash; Bookmark bm; while (it.hasNext()) - if ((hash = (String)it.next()) != null) + if ((hash = it.next()) != null) if ((bm = this.sb.bookmarksDB.getBookmark(hash)) != null) r.add(new Link(bm.getUrl(), bm.getTitle(), bm.getDescription())); - return (Link[])r.toArray(new Link[r.size()]); + return (Link[]) r.toArray(new Link[r.size()]); } private static class Link { diff --git a/source/de/anomic/data/wiki/tokens/ListToken.java b/source/de/anomic/data/wiki/tokens/ListToken.java index 4159071a0..274665501 100644 --- a/source/de/anomic/data/wiki/tokens/ListToken.java +++ b/source/de/anomic/data/wiki/tokens/ListToken.java @@ -68,7 +68,7 @@ public class ListToken extends AbstractToken { this.listElement = "li"; this.recursion = true; this.pattern = new Pattern[] { Pattern.compile("^[" + firstChar + "]([^\n]|\n[" + firstChar + "])*", Pattern.MULTILINE) }; - ArrayList r = new ArrayList(); + ArrayList r = new ArrayList(); if (this.listBlockElement != null) { if (this.recursion) r.add(this.listBlockElement); if (this.listElement != null) r.add(this.listElement); @@ -82,7 +82,7 @@ public class ListToken extends AbstractToken { this.listElement = listElement; this.recursion = true; this.pattern = new Pattern[] { Pattern.compile("^[" + firstChar + "]([^\n]|\n[" + firstChar + "])*", Pattern.MULTILINE) }; - ArrayList r = new ArrayList(); + ArrayList r = new ArrayList(); if (this.listBlockElement != null) { if (this.recursion) r.add(this.listBlockElement); if (this.listElement != null) r.add(this.listElement); @@ -96,7 +96,7 @@ public class ListToken extends AbstractToken { this.listElement = listElement; this.recursion = recursion; this.pattern = new Pattern[] { Pattern.compile("^[" + firstChar + "]([^\n]|\n[" + firstChar + "])*", Pattern.MULTILINE) }; - ArrayList r = new ArrayList(); + ArrayList r = new ArrayList(); if (this.listBlockElement != null) { if (this.recursion) r.add(this.listBlockElement); if (this.listElement != null) r.add(this.listElement); diff --git a/source/de/anomic/data/wiki/tokens/SimpleToken.java b/source/de/anomic/data/wiki/tokens/SimpleToken.java index bd1a7a4c5..faa2a0d60 100644 --- a/source/de/anomic/data/wiki/tokens/SimpleToken.java +++ b/source/de/anomic/data/wiki/tokens/SimpleToken.java @@ -66,13 +66,13 @@ public class SimpleToken extends AbstractToken { this.definitionList = definitionList; int i; if (isBlockElements) { - ArrayList r = new ArrayList(); + ArrayList r = new ArrayList(); int j; - for (i=0; i */ ps = new HashMap(); + private static final HashMap ps = new HashMap(); static { Arrays.sort(tps); String[] array; diff --git a/source/de/anomic/htmlFilter/htmlFilterAbstractScraper.java b/source/de/anomic/htmlFilter/htmlFilterAbstractScraper.java index efb3fcfb6..642c290e6 100644 --- a/source/de/anomic/htmlFilter/htmlFilterAbstractScraper.java +++ b/source/de/anomic/htmlFilter/htmlFilterAbstractScraper.java @@ -38,11 +38,11 @@ public abstract class htmlFilterAbstractScraper implements htmlFilterScraper { public static final char rb = '>'; public static final char sl = '/'; - private TreeSet tags0; - private TreeSet tags1; + private TreeSet tags0; + private TreeSet tags1; // define a translation table for html character codings - private static HashMap trans = new HashMap(300); + private static HashMap trans = new HashMap(300); static { trans.put(""", "\""); //Anführungszeichen oben trans.put("&", "&"); //Ampersand-Zeichen, kaufmännisches Und @@ -290,7 +290,7 @@ public abstract class htmlFilterAbstractScraper implements htmlFilterScraper { } - public htmlFilterAbstractScraper(TreeSet tags0, TreeSet tags1) { + public htmlFilterAbstractScraper(TreeSet tags0, TreeSet tags1) { this.tags0 = tags0; this.tags1 = tags1; } diff --git a/source/de/anomic/htmlFilter/htmlFilterAbstractTransformer.java b/source/de/anomic/htmlFilter/htmlFilterAbstractTransformer.java index fcb4cb5f5..d9fb3afd2 100644 --- a/source/de/anomic/htmlFilter/htmlFilterAbstractTransformer.java +++ b/source/de/anomic/htmlFilter/htmlFilterAbstractTransformer.java @@ -45,20 +45,20 @@ import java.util.TreeSet; public abstract class htmlFilterAbstractTransformer implements htmlFilterTransformer { - private TreeSet tags0; - private TreeSet tags1; + private TreeSet tags0; + private TreeSet tags1; - public htmlFilterAbstractTransformer(TreeSet tags0, TreeSet tags1) { - this.tags0 = tags0; - this.tags1 = tags1; + public htmlFilterAbstractTransformer(TreeSet tags0, TreeSet tags1) { + this.tags0 = tags0; + this.tags1 = tags1; } public boolean isTag0(String tag) { - return tags0.contains(tag); + return tags0.contains(tag); } public boolean isTag1(String tag) { - return tags1.contains(tag); + return tags1.contains(tag); } //the 'missing' method that shall be implemented: @@ -71,11 +71,11 @@ public abstract class htmlFilterAbstractTransformer implements htmlFilterTransfo // the other methods must take into account to construct the return value correctly public char[] transformTag0(String tagname, Properties tagopts, char quotechar) { - return htmlFilterWriter.genTag0(tagname, tagopts, quotechar); + return htmlFilterWriter.genTag0(tagname, tagopts, quotechar); } public char[] transformTag1(String tagname, Properties tagopts, char[] text, char quotechar) { - return htmlFilterWriter.genTag1(tagname, tagopts, text, quotechar); + return htmlFilterWriter.genTag1(tagname, tagopts, text, quotechar); } public void close() { diff --git a/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java b/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java index 288c1b460..011bbdd92 100644 --- a/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java +++ b/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java @@ -59,8 +59,8 @@ import de.anomic.server.serverCharBuffer; public class htmlFilterContentTransformer extends htmlFilterAbstractTransformer implements htmlFilterTransformer { // statics: for initialisation of the HTMLFilterAbstractTransformer - private static TreeSet linkTags0; - private static TreeSet linkTags1; + private static TreeSet linkTags0; + private static TreeSet linkTags1; private static final Collator insensitiveCollator = Collator.getInstance(Locale.US); static { @@ -69,15 +69,15 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformer } static { - linkTags0 = new TreeSet(insensitiveCollator); + linkTags0 = new TreeSet(insensitiveCollator); linkTags0.add("img"); linkTags0.add("input"); - linkTags1 = new TreeSet(insensitiveCollator); + linkTags1 = new TreeSet(insensitiveCollator); linkTags1.add("a"); } - private ArrayList bluelist = null; + private ArrayList bluelist = null; public htmlFilterContentTransformer() { super(linkTags0, linkTags1); @@ -85,8 +85,8 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformer public void init(String initarg) { if (bluelist == null) { - // here, the initarg is used to load a list of bluelisted words - bluelist = new ArrayList(); + // here, the init arg is used to load a list of blue-listed words + bluelist = new ArrayList(); File f = new File(initarg); if (f.canRead()) { try { @@ -127,8 +127,8 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformer return false; } - public ArrayList getStrings(byte[] text){ - ArrayList result=new ArrayList(); + public ArrayList getStrings(byte[] text){ + ArrayList result = new ArrayList(); serverByteBuffer sbb = new serverByteBuffer(text); serverByteBuffer[] sbbs = httpTemplate.splitQuotations(sbb); diff --git a/source/de/anomic/htmlFilter/htmlFilterImageEntry.java b/source/de/anomic/htmlFilter/htmlFilterImageEntry.java index abbb697e5..b65aa7dd2 100644 --- a/source/de/anomic/htmlFilter/htmlFilterImageEntry.java +++ b/source/de/anomic/htmlFilter/htmlFilterImageEntry.java @@ -42,7 +42,7 @@ package de.anomic.htmlFilter; import de.anomic.yacy.yacyURL; -public class htmlFilterImageEntry implements Comparable { +public class htmlFilterImageEntry implements Comparable { private yacyURL url; private String alt; @@ -86,13 +86,12 @@ public class htmlFilterImageEntry implements Comparable { return 0xFFFF0000 | (url.hashCode() & 0xFFFF); } - public int compareTo(Object h) { + public int compareTo(htmlFilterImageEntry h) { // this is needed if this object is stored in a TreeSet // this method uses the image-size ordering from the hashCode method // assuming that hashCode would return a 'perfect hash' this method would // create a total ordering on images with respect on the image size assert (url != null); - assert (h instanceof htmlFilterImageEntry); if (this.url.toNormalform(true, true).equals(((htmlFilterImageEntry) h).url.toNormalform(true, true))) return 0; int thc = this.hashCode(); int ohc = ((htmlFilterImageEntry) h).hashCode(); @@ -101,8 +100,7 @@ public class htmlFilterImageEntry implements Comparable { return this.url.toString().compareTo(((htmlFilterImageEntry) h).url.toString()); } - public boolean equals(Object o) { - if (!(o instanceof htmlFilterImageEntry)) return false; + public boolean equals(htmlFilterImageEntry o) { return compareTo(o) == 0; } } diff --git a/source/de/anomic/htmlFilter/htmlFilterWriter.java b/source/de/anomic/htmlFilter/htmlFilterWriter.java index d00dc7673..a343738e0 100644 --- a/source/de/anomic/htmlFilter/htmlFilterWriter.java +++ b/source/de/anomic/htmlFilter/htmlFilterWriter.java @@ -167,7 +167,7 @@ public final class htmlFilterWriter extends Writer { // a helper method for pretty-printing of properties for html tags public static char[] genOpts(Properties prop, char quotechar) { - Enumeration e = prop.propertyNames(); + Enumeration e = prop.propertyNames(); serverCharBuffer bb = new serverCharBuffer(prop.size() * 40); String key; while (e.hasMoreElements()) { diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.java index f4ee874f8..0aa929405 100644 --- a/source/de/anomic/http/httpHeader.java +++ b/source/de/anomic/http/httpHeader.java @@ -721,9 +721,9 @@ public final class httpHeader extends TreeMap implements Map implements Map { + private String k; + private Object v; + Entry(String k, Object v) { + this.k = k; + this.v = v; + } + public String getKey() { + return k; + } + public Object getValue() { + return v; + } + public Object setValue(Object v) { + Object r = this.v; + this.v = v; + return r; + } } /** @@ -895,10 +906,10 @@ public final class httpHeader extends TreeMap implements Map> it = this.entrySet().iterator(); while(it.hasNext()) { - java.util.Map.Entry e = (java.util.Map.Entry) it.next(); + Map.Entry e = it.next(); //System.out.println(""+e.getKey()+" : "+e.getValue()); if(e.getKey().equals("Cookie")) { diff --git a/source/de/anomic/http/httpRemoteProxyConfig.java b/source/de/anomic/http/httpRemoteProxyConfig.java index 3530e2c72..6f6967c7c 100644 --- a/source/de/anomic/http/httpRemoteProxyConfig.java +++ b/source/de/anomic/http/httpRemoteProxyConfig.java @@ -70,8 +70,8 @@ public final class httpRemoteProxyConfig { private String remoteProxyNoProxy = ""; private String[] remoteProxyNoProxyPatterns = null; - public final HashSet remoteProxyAllowProxySet = new HashSet(); - public final HashSet remoteProxyDisallowProxySet = new HashSet(); + public final HashSet remoteProxyAllowProxySet = new HashSet(); + public final HashSet remoteProxyDisallowProxySet = new HashSet(); public boolean useProxy() { return this.remoteProxyUse; diff --git a/source/de/anomic/http/httpTemplate.java b/source/de/anomic/http/httpTemplate.java index ad3c3999e..118afb30f 100644 --- a/source/de/anomic/http/httpTemplate.java +++ b/source/de/anomic/http/httpTemplate.java @@ -158,14 +158,14 @@ public final class httpTemplate { }; public static serverByteBuffer[] splitQuotations(serverByteBuffer text) { - List l = splitQuotation(text, 0); + List l = splitQuotation(text, 0); serverByteBuffer[] sbbs = new serverByteBuffer[l.size()]; - for (int i = 0; i < l.size(); i++) sbbs[i] = (serverByteBuffer) l.get(i); + for (int i = 0; i < l.size(); i++) sbbs[i] = l.get(i); return sbbs; } - public static List splitQuotation(serverByteBuffer text, int qoff) { - ArrayList l = new ArrayList(); + public static List splitQuotation(serverByteBuffer text, int qoff) { + ArrayList l = new ArrayList(); if (qoff >= meta_quotation.length) { if (text.length() > 0) l.add(text); return l; @@ -229,14 +229,14 @@ public final class httpTemplate { return false; } - public static void writeTemplate(InputStream in, OutputStream out, Hashtable pattern, byte[] dflt) throws IOException { + public static void writeTemplate(InputStream in, OutputStream out, Hashtable pattern, byte[] dflt) throws IOException { writeTemplate(in, out, pattern, dflt, new byte[0]); } /** * Reads a input stream, and writes the data with replaced templates on a output stream */ - public static byte[] writeTemplate(InputStream in, OutputStream out, Hashtable pattern, byte[] dflt, byte[] prefix) throws IOException { + public static byte[] writeTemplate(InputStream in, OutputStream out, Hashtable pattern, byte[] dflt, byte[] prefix) throws IOException { PushbackInputStream pis = new PushbackInputStream(in, 100); ByteArrayOutputStream keyStream; byte[] key; @@ -487,7 +487,7 @@ public final class httpTemplate { return structure.getBytes(); } - public static byte[] replacePattern(String key, Hashtable pattern, byte dflt[]) { + public static byte[] replacePattern(String key, Hashtable pattern, byte dflt[]) { byte[] replacement; Object value; if (pattern.containsKey(key)) { @@ -515,8 +515,8 @@ public final class httpTemplate { // arg1 = test input; arg2 = replacement for pattern 'test'; arg3 = default replacement try { InputStream i = new ByteArrayInputStream(args[0].getBytes()); - Hashtable h = new Hashtable(); - h.put("test", args[1].getBytes()); + Hashtable h = new Hashtable(); + h.put("test", args[1]); writeTemplate(new PushbackInputStream(i, 100), System.out, h, args[2].getBytes()); System.out.flush(); } catch (Exception e) { @@ -526,10 +526,10 @@ public final class httpTemplate { /* * loads all Files from path into a filename->content HashMap */ - public static HashMap loadTemplates(File path) { + public static HashMap loadTemplates(File path) { // reads all templates from a path // we use only the folder from the given file path - HashMap result = new HashMap(); + HashMap result = new HashMap(); if (path == null) return result; if (!(path.isDirectory())) path = path.getParentFile(); if ((path == null) || (!(path.isDirectory()))) return result; diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.java index c73c9b515..ebd028f88 100644 --- a/source/de/anomic/http/httpd.java +++ b/source/de/anomic/http/httpd.java @@ -107,7 +107,7 @@ public final class httpd implements serverHandler { */ //TODO: Load this from a file - private static final HashSet disallowZippedContentEncoding = new HashSet(Arrays.asList(new String[]{ + private static final HashSet disallowZippedContentEncoding = new HashSet(Arrays.asList(new String[]{ ".gz", ".tgz", ".jpg", ".jpeg", ".gif", ".zip", ".rar", ".bz2", ".lha", ".jar", ".rpm", ".arc", ".arj", ".wmv", ".png", ".ico", ".bmp" })); @@ -121,8 +121,8 @@ public final class httpd implements serverHandler { private static String virtualHost = null; public static boolean keepAliveSupport = false; - private static HashMap YaCyHopAccessRequester = new HashMap(); - private static HashMap YaCyHopAccessTargets = new HashMap(); + private static HashMap YaCyHopAccessRequester = new HashMap(); + private static HashMap YaCyHopAccessTargets = new HashMap(); // class objects private serverCore.Session session; // holds the session object of the calling class @@ -381,8 +381,8 @@ public final class httpd implements serverHandler { return true; } - private static long lastAccessDelta(HashMap accessTable, String domain) { - Long lastAccess = (Long) accessTable.get(domain); + private static long lastAccessDelta(HashMap accessTable, String domain) { + Long lastAccess = accessTable.get(domain); if (lastAccess == null) return Long.MAX_VALUE; // never accessed return System.currentTimeMillis() - lastAccess.longValue(); } @@ -1187,9 +1187,9 @@ public final class httpd implements serverHandler { tp.put("errorMessageType_file", (detailedErrorMsgFile == null) ? "" : detailedErrorMsgFile.toString()); if ((detailedErrorMsgValues != null) && (detailedErrorMsgValues.size() > 0)) { // rewriting the value-names and add the proper name prefix: - Iterator nameIter = detailedErrorMsgValues.keySet().iterator(); + Iterator nameIter = detailedErrorMsgValues.keySet().iterator(); while (nameIter.hasNext()) { - String name = (String) nameIter.next(); + String name = nameIter.next(); tp.put("errorMessageType_" + name, detailedErrorMsgValues.get(name)); } } @@ -1405,12 +1405,11 @@ public final class httpd implements serverHandler { httpHeader outgoingHeader=requestProperties.getOutgoingHeader(); if (outgoingHeader!=null) {*/ - Iterator it=header.getCookies(); - while(it.hasNext()) - { + Iterator it = header.getCookies(); + while(it.hasNext()) { //Append user properties to the main String //TODO: Should we check for user properites. What if they intersect properties that are already in header? - java.util.Map.Entry e=(java.util.Map.Entry)it.next(); + httpHeader.Entry e = it.next(); headerStringBuffer.append(e.getKey()).append(": ").append(e.getValue()).append("\r\n"); } @@ -1419,13 +1418,13 @@ public final class httpd implements serverHandler { }*/ // write header - Iterator i = header.keySet().iterator(); + Iterator i = header.keySet().iterator(); String key; char tag; int count; //System.out.println("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"); while (i.hasNext()) { - key = (String) i.next(); + key = i.next(); tag = key.charAt(0); if ((tag != '*') && (tag != '#')) { // '#' in key is reserved for proxy attributes as artificial header values count = header.keyCount(key); diff --git a/source/de/anomic/http/httpdByteCountInputStream.java b/source/de/anomic/http/httpdByteCountInputStream.java index 457e3b6af..f1e5a319c 100644 --- a/source/de/anomic/http/httpdByteCountInputStream.java +++ b/source/de/anomic/http/httpdByteCountInputStream.java @@ -54,7 +54,7 @@ import java.util.HashMap; public class httpdByteCountInputStream extends FilterInputStream { private static final Object syncObject = new Object(); - private static final HashMap byteCountInfo = new HashMap(2); + private static final HashMap byteCountInfo = new HashMap(2); private static long globalByteCount = 0; private boolean finished = false; @@ -144,7 +144,7 @@ public class httpdByteCountInputStream extends FilterInputStream { if (this.byteCountAccountName != null) { long lastByteCount = 0; if (byteCountInfo.containsKey(this.byteCountAccountName)) { - lastByteCount = ((Long)byteCountInfo.get(this.byteCountAccountName)).longValue(); + lastByteCount = byteCountInfo.get(this.byteCountAccountName).longValue(); } lastByteCount += this.byteCount; byteCountInfo.put(this.byteCountAccountName,new Long(lastByteCount)); diff --git a/source/de/anomic/http/httpdByteCountOutputStream.java b/source/de/anomic/http/httpdByteCountOutputStream.java index c6f6d2e33..a3f890f99 100644 --- a/source/de/anomic/http/httpdByteCountOutputStream.java +++ b/source/de/anomic/http/httpdByteCountOutputStream.java @@ -55,7 +55,7 @@ public class httpdByteCountOutputStream extends BufferedOutputStream { private static long globalByteCount = 0; private boolean finished = false; - private static final HashMap byteCountInfo = new HashMap(2); + private static final HashMap byteCountInfo = new HashMap(2); protected long byteCount; protected String byteCountAccountName = null; diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java index ca519d4ab..118edafa9 100644 --- a/source/de/anomic/http/httpdFileHandler.java +++ b/source/de/anomic/http/httpdFileHandler.java @@ -116,10 +116,8 @@ public final class httpdFileHandler { private static final boolean safeServletsMode = false; // if true then all servlets are called synchronized - // class variables private static final Properties mimeTable = new Properties(); private static final serverClassLoader provider; - private static final HashMap templates = new HashMap(); private static serverSwitch switchboard; private static plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard(); @@ -130,8 +128,8 @@ public final class httpdFileHandler { private static File htDefaultPath = null; private static File htLocalePath = null; - private static final HashMap templateCache; - private static final HashMap templateMethodCache; + private static final HashMap> templateCache; + private static final HashMap> templateMethodCache; public static boolean useTemplateCache = false; @@ -141,8 +139,8 @@ public final class httpdFileHandler { static { serverSwitch switchboard = plasmaSwitchboard.getSwitchboard(); useTemplateCache = switchboard.getConfig("enableTemplateCache","true").equalsIgnoreCase("true"); - templateCache = (useTemplateCache)? new HashMap() : new HashMap(0); - templateMethodCache = (useTemplateCache) ? new HashMap() : new HashMap(0); + templateCache = (useTemplateCache)? new HashMap>() : new HashMap>(0); + templateMethodCache = (useTemplateCache) ? new HashMap>() : new HashMap>(0); // create a class loader provider = new serverClassLoader(/*this.getClass().getClassLoader()*/); @@ -396,11 +394,11 @@ public final class httpdFileHandler { // check for cross site scripting - attacks in request arguments if (argc > 0) { // check all values for occurrences of script values - Enumeration e = args.elements(); // enumeration of values - Object val; + Enumeration e = args.elements(); // enumeration of values + String val; while (e.hasMoreElements()) { val = e.nextElement(); - if ((val != null) && (val instanceof String) && (((String) val).indexOf("= 0)) { + if ((val != null) && (val.indexOf("= 0)) { // deny request httpd.sendRespondError(conProp,out,4,403,null,"bad post values",null); return; @@ -549,6 +547,7 @@ public final class httpdFileHandler { boolean zipContent = requestHeader.acceptGzip() && httpd.shallTransportZipped("." + conProp.getProperty("EXT","")); if (path.endsWith("html") || path.endsWith("xml") || + path.endsWith("rdf") || path.endsWith("rss") || path.endsWith("csv") || path.endsWith("pac") || @@ -633,8 +632,6 @@ public final class httpdFileHandler { targetDate = new Date(System.currentTimeMillis()); nocache = true; } - // read templates - tp.putAll(templates); // rewrite the file InputStream fis = null; @@ -645,7 +642,7 @@ public final class httpdFileHandler { long fileSize = targetFile.length(); if (fileSize <= 512 * 1024) { // read from cache - SoftReference ref = (SoftReference) templateCache.get(targetFile); + SoftReference ref = templateCache.get(targetFile); if (ref != null) { templateContent = (byte[]) ref.get(); if (templateContent == null) templateCache.remove(targetFile); @@ -657,7 +654,7 @@ public final class httpdFileHandler { templateContent = serverFileUtils.read(targetFile); // storing the content into the cache - ref = new SoftReference(templateContent); + ref = new SoftReference(templateContent); templateCache.put(targetFile, ref); if (theLogger.isLoggable(Level.FINEST)) theLogger.logFinest("Cache MISS for file " + targetFile); @@ -931,7 +928,7 @@ public final class httpdFileHandler { // now make a class out of the stream try { if (useTemplateCache) { - SoftReference ref = (SoftReference) templateMethodCache.get(classFile); + SoftReference ref = templateMethodCache.get(classFile); if (ref != null) { m = (Method) ref.get(); if (m == null) { @@ -943,8 +940,8 @@ public final class httpdFileHandler { } } - Class c = provider.loadClass(classFile); - Class[] params = new Class[] { + Class c = provider.loadClass(classFile); + Class[] params = new Class[] { httpHeader.class, serverObjects.class, serverSwitch.class }; @@ -952,8 +949,8 @@ public final class httpdFileHandler { if (useTemplateCache) { // storing the method into the cache - SoftReference ref = new SoftReference(m); - templateMethodCache.put(classFile,ref); + SoftReference ref = new SoftReference(m); + templateMethodCache.put(classFile, ref); } } catch (ClassNotFoundException e) { diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java index b0e31f50d..f175ae9e6 100644 --- a/source/de/anomic/http/httpdProxyHandler.java +++ b/source/de/anomic/http/httpdProxyHandler.java @@ -113,7 +113,7 @@ public final class httpdProxyHandler { // static variables // can only be instantiated upon first instantiation of this class object private static plasmaSwitchboard switchboard = null; - public static HashSet yellowList = null; + public static HashSet yellowList = null; private static int timeout = 30000; private static boolean yacyTrigger = true; public static boolean isTransparentProxy = false; @@ -205,7 +205,7 @@ public final class httpdProxyHandler { yellowList = serverFileUtils.loadList(new File(f)); theLogger.logConfig("loaded yellow-list from file " + f + ", " + yellowList.size() + " entries"); } else { - yellowList = new HashSet(); + yellowList = new HashSet(); } String redirectorPath = switchboard.getConfig("externalRedirector", ""); @@ -1411,7 +1411,7 @@ public final class httpdProxyHandler { serverObjects detailedErrorMsgMap = new serverObjects(); // generic toplevel domains - HashSet topLevelDomains = new HashSet(Arrays.asList(new String[]{ + HashSet topLevelDomains = new HashSet(Arrays.asList(new String[]{ "aero", // Fluggesellschaften/Luftfahrt "arpa", // Einrichtung des ARPANet "biz", // Business @@ -1453,7 +1453,7 @@ public final class httpdProxyHandler { detailedErrorMsgMap.put("hostName", orgHostName); // guessing hostnames - HashSet testHostNames = new HashSet(); + HashSet testHostNames = new HashSet(); String testHostName = null; if (!orgHostName.startsWith("www.")) { testHostName = "www." + orgHostName; @@ -1472,9 +1472,9 @@ public final class httpdProxyHandler { pos = orgHostName.lastIndexOf("."); if (pos != -1) { - Iterator iter = topLevelDomains.iterator(); + Iterator iter = topLevelDomains.iterator(); while (iter.hasNext()) { - String topLevelDomain = (String) iter.next(); + String topLevelDomain = iter.next(); testHostName = orgHostName.substring(0,pos) + "." + topLevelDomain; InetAddress addr = serverDomains.dnsResolve(testHostName); if (addr != null) if (addr != null) testHostNames.add(testHostName); @@ -1482,9 +1482,9 @@ public final class httpdProxyHandler { } int hostNameCount = 0; - Iterator iter = testHostNames.iterator(); + Iterator iter = testHostNames.iterator(); while (iter.hasNext()) { - testHostName = (String) iter.next(); + testHostName = iter.next(); detailedErrorMsgMap.put("list_" + hostNameCount + "_hostName",testHostName); detailedErrorMsgMap.put("list_" + hostNameCount + "_hostPort",orgHostPort); detailedErrorMsgMap.put("list_" + hostNameCount + "_hostPath",orgHostPath); diff --git a/source/de/anomic/http/httpdSwitchboard.java b/source/de/anomic/http/httpdSwitchboard.java index 277111020..bd6ef0f36 100644 --- a/source/de/anomic/http/httpdSwitchboard.java +++ b/source/de/anomic/http/httpdSwitchboard.java @@ -48,11 +48,11 @@ import de.anomic.server.serverSwitch; public final class httpdSwitchboard extends serverAbstractSwitch implements serverSwitch { - private final LinkedList cacheStack; + private final LinkedList cacheStack; public httpdSwitchboard(String rootPath, String initPath, String configPath, boolean applyPro) { super(rootPath, initPath, configPath, applyPro); - cacheStack = new LinkedList(); + cacheStack = new LinkedList(); } public int queueSize() { diff --git a/source/de/anomic/icap/icapHeader.java b/source/de/anomic/icap/icapHeader.java index 1e1bb57ca..94b7bb220 100644 --- a/source/de/anomic/icap/icapHeader.java +++ b/source/de/anomic/icap/icapHeader.java @@ -54,7 +54,7 @@ import java.util.TreeMap; import de.anomic.server.serverCore; -public class icapHeader extends TreeMap implements Map { +public class icapHeader extends TreeMap implements Map { private static final long serialVersionUID = 1L; @@ -91,7 +91,7 @@ public class icapHeader extends TreeMap implements Map { /* ============================================================= * defining default icap status messages * ============================================================= */ - public static final HashMap icap1_0 = new HashMap(); + public static final HashMap icap1_0 = new HashMap(); static { // (1yz) Informational codes icap1_0.put("100","Continue after ICAP preview"); @@ -145,8 +145,8 @@ public class icapHeader extends TreeMap implements Map { } // to make the occurrence of multiple keys possible, we add them using a counter - public Object add(Object key, Object value) { - int c = keyCount((String) key); + public String add(String key, String value) { + int c = keyCount(key); if (c == 0) return put(key, value); return put("*" + key + "-" + c, value); } @@ -186,7 +186,7 @@ public class icapHeader extends TreeMap implements Map { .append(icapStatusText).append("\r\n"); // write header - Iterator i = keySet().iterator(); + Iterator i = keySet().iterator(); String key; char tag; int count; diff --git a/source/de/anomic/net/ftpc.java b/source/de/anomic/net/ftpc.java index ec228e472..0b1cb97ae 100644 --- a/source/de/anomic/net/ftpc.java +++ b/source/de/anomic/net/ftpc.java @@ -271,8 +271,8 @@ public class ftpc { super(); } - public Class loadClass(String classname, boolean resolve) throws ClassNotFoundException { - Class c = findLoadedClass(classname); + public Class loadClass(String classname, boolean resolve) throws ClassNotFoundException { + Class c = findLoadedClass(classname); if (c == null) try { // second try: ask the system c = findSystemClass(classname); @@ -324,11 +324,11 @@ public class ftpc { System.setProperties(pr); // locate object - Class c = (new cl()).loadClass(obj); + Class c = (new cl()).loadClass(obj); //Class c = this.getClass().getClassLoader().loadClass(obj); // locate public static main(String[]) method - Class[] parameterType = new Class[1]; + Class[] parameterType = new Class[1]; parameterType[0] = Class.forName("[Ljava.lang.String;"); Method m = c.getMethod("main", parameterType); @@ -477,11 +477,11 @@ public class ftpc { } if (ControlSocket == null) return LDIR(); try { - Vector l; + Vector l; if (cmd.length == 2) l = list(cmd[1],false); else l = list(".",false); - Enumeration x = l.elements(); + Enumeration x = l.elements(); out.println(logPrefix + "---- v---v---v---v---v---v---v---v---v---v---v---v---v---v---v---v---v---v---v"); - while (x.hasMoreElements()) out.println(logPrefix + (String) x.nextElement()); + while (x.hasMoreElements()) out.println(logPrefix + x.nextElement()); out.println(logPrefix + "---- ^---^---^---^---^---^---^---^---^---^---^---^---^---^---^---^---^---^---^"); } catch (IOException e) { err.println(logPrefix + "---- Error: remote list not available"); @@ -581,8 +581,8 @@ public class ftpc { exec("cd \"" + remote + "\";lmkdir \"" + remote + "\";lcd \"" + remote + "\"",true); //exec("mget *",true); try { - Enumeration files = list(".",false).elements(); - while (files.hasMoreElements()) retrieveFilesRecursively((String) files.nextElement(), delete); + Enumeration files = list(".",false).elements(); + while (files.hasMoreElements()) retrieveFilesRecursively(files.nextElement(), delete); } catch (IOException ee) {} exec("cd ..;lcd ..", true); try {if (delete) rmForced(remote);} catch (IOException eee) { @@ -1009,9 +1009,9 @@ cd .. } if (ControlSocket == null) return LLS(); try { - Vector l; + Vector l; if (cmd.length == 2) l = list(cmd[1],true); else l = list(".",true); - Enumeration x = l.elements(); + Enumeration x = l.elements(); out.println(logPrefix + "---- v---v---v---v---v---v---v---v---v---v---v---v---v---v---v---v---v---v---v"); while (x.hasMoreElements()) out.println(logPrefix + (String) x.nextElement()); out.println(logPrefix + "---- ^---^---^---^---^---^---^---^---^---^---^---^---^---^---^---^---^---^---^"); @@ -1022,7 +1022,7 @@ cd .. } - private Vector list(String path, boolean extended) throws IOException { + private Vector list(String path, boolean extended) throws IOException { // prepare data channel if (DataSocketPassiveMode) createPassiveDataPort(); else createActiveDataPort(); @@ -1050,7 +1050,7 @@ cd .. // read file system data String line; - Vector files = new Vector(); + Vector files = new Vector(); while ((line = ClientStream.readLine()) != null) if (!line.startsWith("total ")) files.addElement(line); @@ -1107,8 +1107,8 @@ cd .. } private void mget(String pattern, boolean remove) throws IOException { - Vector l = list(".",false); - Enumeration x = l.elements(); + Vector l = list(".",false); + Enumeration x = l.elements(); String remote; File local; //int idx; // the search for " " is only for improper lists from the server. this fails if the file name has a " " in it @@ -1894,12 +1894,12 @@ cd .. public void checkPackageAccess(String pkg) { } public void checkPackageDefinition(String pkg) { } public void checkSetFactory() { } - public void checkMemberAccess(Class clazz, int which) { } + public void checkMemberAccess(Class clazz, int which) { } public void checkSecurityAccess(String provider) { } } - public static Vector dir(String host, + public static Vector dir(String host, String remotePath, String account, String password, boolean extended) { @@ -1907,7 +1907,7 @@ cd .. ftpc c = new ftpc(); c.cmd = new String[]{"open", host}; c.OPEN(); c.cmd = new String[]{"user", account, password}; c.USER(); - c.cmd = new String[]{"ls"}; Vector v = c.list(remotePath, extended); + c.cmd = new String[]{"ls"}; Vector v = c.list(remotePath, extended); c.cmd = new String[]{"close"}; c.CLOSE(); c.cmd = new String[]{"exit"}; c.EXIT(); return v; @@ -1936,7 +1936,7 @@ cd .. public StringBuffer dirhtml(String remotePath) { // returns a directory listing using an existing connection try { - Vector list = list(remotePath, true); + Vector list = list(remotePath, true); if (this.remotesystem == null) sys(); String base = "ftp://" + ((account.equals("anonymous")) ? "" : (account + ":" + password + "@")) + host + ((port == 21) ? "" : (":" + port)) + ((remotePath.charAt(0) == '/') ? "" : "/") + remotePath; @@ -1965,7 +1965,7 @@ cd .. } } - public static StringBuffer dirhtml(String base, String servermessage, String greeting, String system, Vector list) { + public static StringBuffer dirhtml(String base, String servermessage, String greeting, String system, Vector list) { // this creates the html output from collected strings StringBuffer page = new StringBuffer(1024); String title = "Index of " + base; diff --git a/source/de/anomic/plasma/plasmaDHTTransfer.java b/source/de/anomic/plasma/plasmaDHTTransfer.java index 47688a48a..2363d0fa3 100644 --- a/source/de/anomic/plasma/plasmaDHTTransfer.java +++ b/source/de/anomic/plasma/plasmaDHTTransfer.java @@ -152,7 +152,7 @@ public class plasmaDHTTransfer extends Thread { // transfering seleted words to remote peer this.transferStatusMessage = "Running: Transfering chunk to target " + this.seed.hash + "/" + this.seed.getName(); - HashMap result = yacyClient.transferIndex(this.seed, this.dhtChunk.containers(), this.dhtChunk.urlCacheMap(), this.gzipBody4Transfer, this.timeout4Transfer); + HashMap result = yacyClient.transferIndex(this.seed, this.dhtChunk.containers(), this.dhtChunk.urlCacheMap(), this.gzipBody4Transfer, this.timeout4Transfer); String error = (String) result.get("result"); if (error == null) { // words successfully transfered @@ -254,11 +254,13 @@ public class plasmaDHTTransfer extends Thread { } } - private long getBusyTime(HashMap result) { + @SuppressWarnings("unchecked") + private long getBusyTime(HashMap result) { int pause = -1; - HashMap transferRWIResult = (HashMap) result.get("resultTransferRWI"); - if (transferRWIResult != null && transferRWIResult.containsKey("pause")) { - String pauseStr = (String) transferRWIResult.get("pause"); + Object transferRWIResult = result.get("resultTransferRWI"); + assert transferRWIResult instanceof HashMap; + if (transferRWIResult != null && ((HashMap) transferRWIResult).containsKey("pause")) { + String pauseStr = (String) ((HashMap) transferRWIResult).get("pause"); try { pause = Integer.valueOf(pauseStr).intValue(); } catch (NumberFormatException numEx){} if (pause < 0) pause = 5000; else if (pause > 30000) pause = 30000; diff --git a/source/de/anomic/plasma/plasmaRankingCRProcess.java b/source/de/anomic/plasma/plasmaRankingCRProcess.java index 63200e0ce..61572cd9e 100644 --- a/source/de/anomic/plasma/plasmaRankingCRProcess.java +++ b/source/de/anomic/plasma/plasmaRankingCRProcess.java @@ -95,7 +95,7 @@ public class plasmaRankingCRProcess { } // put elements in accumulator file - Iterator el = source_cr.keys(); + Iterator el = source_cr.keys(); String key; kelondroAttrSeq.Entry new_entry, acc_entry; int FUDate, FDDate, LUDate, UCount, PCount, ACount, VCount, Vita; @@ -168,7 +168,7 @@ public class plasmaRankingCRProcess { } // put elements in accumulator file - Iterator el = source_cr.keys(); + Iterator el = source_cr.keys(); String key; kelondroAttrSeq.Entry new_entry; kelondroRow.Entry acc_entry; @@ -345,12 +345,12 @@ public class plasmaRankingCRProcess { int size = cr.size(); long start = System.currentTimeMillis(); long l; - final Iterator i = cr.keys(); + final Iterator i = cr.keys(); String referee, anchor, anchorDom; kelondroAttrSeq.Entry cr_entry, rci_entry; long cr_UDate, rci_UDate; while (i.hasNext()) { - referee = (String) i.next(); + referee = i.next(); cr_entry = cr.getEntry(referee); cr_UDate = cr_entry.getAttr("UDate", 0);