Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
more PMD recommendations
orbitera06f7ddb3347
diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.javaindex 7fbd7fb64..ffc9453ab 100644--- a/htroot/AccessTracker_p.java+++ b/htroot/AccessTracker_p.java@@ -28,6 +28,7 @@ import java.util.ArrayList;import java.util.ConcurrentModificationException;import java.util.Date;import java.util.Iterator;+import java.util.Locale;import java.util.Map;import java.util.SortedMap;import java.util.TreeMap;@@ -46,7 +47,7 @@ import de.anomic.yacy.yacySeed;public class AccessTracker_p {- private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");+ private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);private static final SortedMap<Long, String> treemapclone(final SortedMap<Long, String> m) {final TreeMap<Long, String> accessClone = new TreeMap<Long, String>();diff --git a/htroot/BlacklistCleaner_p.java b/htroot/BlacklistCleaner_p.javaindex 7d101b96b..269903288 100644--- a/htroot/BlacklistCleaner_p.java+++ b/htroot/BlacklistCleaner_p.java@@ -303,8 +303,8 @@ public class BlacklistCleaner_p {// remove the entry from the running blacklist enginefor (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists", blacklistToUse)) {- final String host = (s.indexOf("/") == -1) ? s : s.substring(0, s.indexOf("/"));- final String path = (s.indexOf("/") == -1) ? ".*" : s.substring(s.indexOf("/") + 1);+ final String host = (s.indexOf('/') == -1) ? s : s.substring(0, s.indexOf('/'));+ final String path = (s.indexOf('/') == -1) ? ".*" : s.substring(s.indexOf('/') + 1);try {Switchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes], host, path);} catch (final RuntimeException e) {@@ -340,7 +340,7 @@ public class BlacklistCleaner_p {pw = new PrintWriter(new FileWriter(new File(listManager.listsPath, blacklistToUse), true));String host, path;for (int i=0, pos; i<newEntry.length; i++) {- pos = newEntry[i].indexOf("/");+ pos = newEntry[i].indexOf('/');if (pos < 0) {host = newEntry[i];path = ".*";diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.javaindex 860fbabfe..419febf63 100644--- a/htroot/Blacklist_p.java+++ b/htroot/Blacklist_p.java@@ -581,7 +581,7 @@ public class Blacklist_p {}// remove the entry from the running blacklist engine- int pos = oldEntry.indexOf("/");+ int pos = oldEntry.indexOf('/');if (pos < 0) {// add default empty path patternpos = oldEntry.length();@@ -616,7 +616,7 @@ public class Blacklist_p {newEntry = newEntry.substring(8);}- int pos = newEntry.indexOf("/");+ int pos = newEntry.indexOf('/');if (pos < 0) {// add default empty path patternpos = newEntry.length();diff --git a/htroot/Blog.java b/htroot/Blog.javaindex fa75ef2e5..62f2bb9cd 100644--- a/htroot/Blog.java+++ b/htroot/Blog.java@@ -36,6 +36,7 @@ import java.util.ArrayList;import java.util.Date;import java.util.HashMap;import java.util.Iterator;+import java.util.Locale;import net.yacy.kelondro.util.DateFormatter;@@ -53,7 +54,7 @@ public class Blog {private static final String DEFAULT_PAGE = "blog_default";- private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");+ private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);// TODO: make userdefined date/time-strings (localisation)public static String dateString(final Date date) {diff --git a/htroot/BlogComments.java b/htroot/BlogComments.javaindex 37f1e1a90..f6c42406e 100644--- a/htroot/BlogComments.java+++ b/htroot/BlogComments.java@@ -37,6 +37,7 @@ import java.io.UnsupportedEncodingException;import java.text.SimpleDateFormat;import java.util.Date;import java.util.Iterator;+import java.util.Locale;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;@@ -55,7 +56,7 @@ import de.anomic.yacy.yacyCore;public class BlogComments {- private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");+ private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);// TODO: make userdefined date/time-strings (localisation)public static String dateString(final Date date) {diff --git a/htroot/ConfigAppearance_p.java b/htroot/ConfigAppearance_p.javaindex 5a094271d..2440ddf29 100644--- a/htroot/ConfigAppearance_p.java+++ b/htroot/ConfigAppearance_p.java@@ -109,7 +109,7 @@ public class ConfigAppearance_p {return prop;}try {- final File skinFile = new File(skinPath, url.substring(url.lastIndexOf("/"), url.length()));+ final File skinFile = new File(skinPath, url.substring(url.lastIndexOf('/'), url.length()));final BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(skinFile)));while (it.hasNext()) {diff --git a/htroot/CrawlProfileEditor_p.java b/htroot/CrawlProfileEditor_p.javaindex d15ffeb98..11e167bcb 100644--- a/htroot/CrawlProfileEditor_p.java+++ b/htroot/CrawlProfileEditor_p.java@@ -138,7 +138,7 @@ public class CrawlProfileEditor_p {}prop.put("profiles", count);selentry = sb.crawler.profilesActiveCrawls.getEntry(handle);-+ assert selentry.handle() != null;// read post for change submitif ((post != null) && (selentry != null)) {if (post.containsKey("submit")) {diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.javaindex 67fb8b17a..50f25ff2a 100644--- a/htroot/MessageSend_p.java+++ b/htroot/MessageSend_p.java@@ -29,6 +29,7 @@ import java.io.UnsupportedEncodingException;import java.text.SimpleDateFormat;import java.util.Date;import java.util.HashMap;+import java.util.Locale;import de.anomic.http.server.RequestHeader;import de.anomic.search.Switchboard;@@ -39,7 +40,7 @@ import de.anomic.yacy.yacySeed;public class MessageSend_p {- private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");+ private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);public static String dateString(final Date date) {return SimpleFormatter.format(date);}diff --git a/htroot/Messages_p.java b/htroot/Messages_p.javaindex 9b7829679..33532016c 100644--- a/htroot/Messages_p.java+++ b/htroot/Messages_p.java@@ -30,6 +30,7 @@ import java.io.UnsupportedEncodingException;import java.text.SimpleDateFormat;import java.util.Date;import java.util.Iterator;+import java.util.Locale;import java.util.TreeMap;import net.yacy.kelondro.util.DateFormatter;@@ -45,7 +46,7 @@ import de.anomic.yacy.yacySeed;public class Messages_p {- private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");+ private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);private static final String PEERSKNOWN = "peersKnown_";public static String dateString(final Date date) {diff --git a/htroot/ProxyIndexingMonitor_p.java b/htroot/ProxyIndexingMonitor_p.javaindex 1f8144454..03bae423d 100644--- a/htroot/ProxyIndexingMonitor_p.java+++ b/htroot/ProxyIndexingMonitor_p.java@@ -103,6 +103,7 @@ public class ProxyIndexingMonitor_p {prop.put("info", "1"); //delete DATA/PLASMADB/crawlProfiles0.db} else {try {+ assert sb.crawler.defaultProxyProfile.handle() != null;sb.crawler.profilesActiveCrawls.changeEntry(sb.crawler.defaultProxyProfile, "generalDepth", Integer.toString(newProxyPrefetchDepth));sb.crawler.profilesActiveCrawls.changeEntry(sb.crawler.defaultProxyProfile, "storeHTCache", (proxyStoreHTCache) ? "true": "false");sb.crawler.profilesActiveCrawls.changeEntry(sb.crawler.defaultProxyProfile, "remoteIndexing",proxyIndexingRemote ? "true":"false");diff --git a/htroot/Wiki.java b/htroot/Wiki.javaindex 090485a2f..18ea19668 100644--- a/htroot/Wiki.java+++ b/htroot/Wiki.java@@ -36,6 +36,7 @@ import java.text.SimpleDateFormat;import java.util.Date;import java.util.HashMap;import java.util.Iterator;+import java.util.Locale;import de.anomic.data.diff;import de.anomic.data.wiki.wikiBoard;@@ -52,7 +53,7 @@ public class Wiki {//private static String ListLevel = "";//private static String numListLevel = "";- private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");+ private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);public static String dateString(final Date date) {return SimpleFormatter.format(date);}diff --git a/htroot/yacy/message.java b/htroot/yacy/message.javaindex 233fc0f31..0da56c405 100644--- a/htroot/yacy/message.java+++ b/htroot/yacy/message.java@@ -33,6 +33,7 @@ import java.io.PrintWriter;import java.io.UnsupportedEncodingException;import java.text.SimpleDateFormat;import java.util.Date;+import java.util.Locale;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;@@ -50,7 +51,7 @@ import de.anomic.yacy.yacySeed;public final class message {- private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");+ private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);public static String dateString(final Date date) {return SimpleFormatter.format(date);}diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 2914aa209..d9de079ee 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -344,7 +344,7 @@ public class yacysearch {String domain = querystring.substring(tld + 4, ftb);querystring = querystring.replace("tld:" + domain, "");while (domain.length() > 0 && domain.charAt(0) == '.') domain = domain.substring(1);- if (domain.indexOf(".") < 0) domain = "\\." + domain; // is tld+ if (domain.indexOf('.') < 0) domain = "\\." + domain; // is tldif (domain.length() > 0) {if (urlmask == null) {urlmask = "[a-zA-Z]*://[^/]*" + domain + "/.*";diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex 9644560df..4e4921248 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -107,7 +107,7 @@ public class yacysearchitem {final int port=result.url().getPort();DigestURI faviconURL = null;if (!result.url().isLocal()) try {- faviconURL = new DigestURI(result.url().getProtocol() + "://" + result.url().getHost() + ((port != -1) ? (":" + String.valueOf(port)) : "") + "/favicon.ico", null);+ faviconURL = new DigestURI(result.url().getProtocol() + "://" + result.url().getHost() + ((port != -1) ? (":" + port) : "") + "/favicon.ico", null);} catch (final MalformedURLException e1) {faviconURL = null;}diff --git a/source/de/anomic/crawler/CrawlProfile.java b/source/de/anomic/crawler/CrawlProfile.javaindex 8adb3814a..b1274c156 100644--- a/source/de/anomic/crawler/CrawlProfile.java+++ b/source/de/anomic/crawler/CrawlProfile.java@@ -228,6 +228,7 @@ public class CrawlProfile {public void changeEntry(final entry e, final String propName, final String newValue) throws IOException, RowSpaceExceededException {e.mem.put(propName, newValue);+ assert e.handle() != null;profileTable.put(e.handle(), e.mem);}diff --git a/source/de/anomic/data/blogBoardComments.java b/source/de/anomic/data/blogBoardComments.javaindex 779dd1f37..5c323ce8a 100644--- a/source/de/anomic/data/blogBoardComments.java+++ b/source/de/anomic/data/blogBoardComments.java@@ -34,6 +34,7 @@ import java.util.ArrayList;import java.util.Date;import java.util.HashMap;import java.util.Iterator;+import java.util.Locale;import java.util.Map;import java.util.TimeZone;@@ -59,7 +60,7 @@ public class blogBoardComments {public static final int keyLength = 64;private static final String dateFormat = "yyyyMMddHHmmss";- static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat);+ static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat, Locale.US);static {SimpleFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));}diff --git a/source/de/anomic/data/messageBoard.java b/source/de/anomic/data/messageBoard.javaindex a6d7c5a7b..add9189c0 100644--- a/source/de/anomic/data/messageBoard.java+++ b/source/de/anomic/data/messageBoard.java@@ -28,6 +28,7 @@ import java.text.SimpleDateFormat;import java.util.Date;import java.util.HashMap;import java.util.Iterator;+import java.util.Locale;import java.util.Map;import java.util.TimeZone;@@ -43,7 +44,7 @@ public class messageBoard {private static final int categoryLength = 12;private static final String dateFormat = "yyyyMMddHHmmss";- static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat);+ static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat, Locale.US);static {SimpleFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));diff --git a/source/de/anomic/data/wiki/wikiBoard.java b/source/de/anomic/data/wiki/wikiBoard.javaindex 3efb2aa7f..23e80ec31 100644--- a/source/de/anomic/data/wiki/wikiBoard.java+++ b/source/de/anomic/data/wiki/wikiBoard.java@@ -31,6 +31,7 @@ import java.text.SimpleDateFormat;import java.util.Date;import java.util.HashMap;import java.util.Iterator;+import java.util.Locale;import java.util.Map;import java.util.TimeZone;@@ -46,7 +47,7 @@ public class wikiBoard {public static final int keyLength = 64;private static final String dateFormat = "yyyyMMddHHmmss";- protected static final SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat);+ protected static final SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat, Locale.US);static {SimpleFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));diff --git a/source/de/anomic/http/client/Client.java b/source/de/anomic/http/client/Client.javaindex 2865a4ac8..95e6213cd 100644--- a/source/de/anomic/http/client/Client.java+++ b/source/de/anomic/http/client/Client.java@@ -718,7 +718,7 @@ public class Client {*/public static String generateLocation() {String loc = System.getProperty("user.timezone", "nowhere");- final int p = loc.indexOf("/");+ final int p = loc.indexOf('/');if (p > 0) {loc = loc.substring(0, p);}diff --git a/source/de/anomic/http/server/RequestHeader.java b/source/de/anomic/http/server/RequestHeader.javaindex cbf436955..9c35dc680 100755--- a/source/de/anomic/http/server/RequestHeader.java+++ b/source/de/anomic/http/server/RequestHeader.java@@ -115,7 +115,7 @@ public class RequestHeader extends HeaderFramework {}public static Properties parseRequestLine(final String s, final Properties prop, final String virtualHost) {- final int p = s.indexOf(" ");+ final int p = s.indexOf(' ');if (p >= 0) {final String cmd = s.substring(0,p);final String args = s.substring(p+1);@@ -148,7 +148,7 @@ public class RequestHeader extends HeaderFramework {}// store the version propery "HTTP" and cut the query at both ends- int sep = args.lastIndexOf(" ");+ int sep = args.lastIndexOf(' ');if ((sep >= 0)&&(args.substring(sep + 1).toLowerCase().startsWith("http/"))) {// HTTP version is givenprop.setProperty(CONNECTION_PROP_HTTP_VER, args.substring(sep + 1).trim());@@ -169,7 +169,7 @@ public class RequestHeader extends HeaderFramework {// additionally, the values URL and ARGC are computedString argsString = "";- sep = args.indexOf("?");+ sep = args.indexOf('?');if (sep >= 0) {// there are values attached to the query stringargsString = args.substring(sep + 1); // cut head from tail of query@@ -184,7 +184,7 @@ public class RequestHeader extends HeaderFramework {if (args.toUpperCase().startsWith("HTTP://")) {// a host was given. extract it and set pathargs = args.substring(7);- sep = args.indexOf("/");+ sep = args.indexOf('/');if (sep < 0) {// this is a malformed url, something like// http://index.html@@ -220,7 +220,7 @@ public class RequestHeader extends HeaderFramework {// find out file extension (we already stripped ?-parameters from args)String ext = ""; // default when no file extension- sep = path.lastIndexOf(".");+ sep = path.lastIndexOf('.');if (sep >= 0) {final int ancpos = path.indexOf("#", sep + 1);if (ancpos >= sep) {@@ -245,7 +245,7 @@ public class RequestHeader extends HeaderFramework {while ((line = theSession.readLineAsString()) != null) {if (line.length() == 0) break; // this separates the header of the HTTP request from the body// parse the header line: a property separated with the ':' sign- if ((p = line.indexOf(":")) >= 0) {+ if ((p = line.indexOf(':')) >= 0) {// store a propertyheader.add(line.substring(0, p).trim(), line.substring(p + 1).trim());}diff --git a/source/de/anomic/search/ResultEntry.java b/source/de/anomic/search/ResultEntry.javaindex 95f8a5bf5..a2cde7941 100644--- a/source/de/anomic/search/ResultEntry.java+++ b/source/de/anomic/search/ResultEntry.java@@ -74,7 +74,7 @@ public class ResultEntry implements Comparable<ResultEntry>, Comparator<ResultEnfinal String host = urlcomps.url().getHost();if (host != null && host.endsWith(".yacyh")) {// translate host into current IP- int p = host.indexOf(".");+ int p = host.indexOf('.');final String hash = yacySeed.hexHash2b64Hash(host.substring(p + 1, host.length() - 6));final yacySeed seed = peers.getConnected(hash);final String filename = urlcomps.url().getFile();@@ -97,7 +97,7 @@ public class ResultEntry implements Comparable<ResultEntry>, Comparator<ResultEn}alternative_urlstring = "http://" + address + "/" + host.substring(0, p) + filename;alternative_urlname = "http://share." + seed.getName() + ".yacy" + filename;- if ((p = alternative_urlname.indexOf("?")) > 0) alternative_urlname = alternative_urlname.substring(0, p);+ if ((p = alternative_urlname.indexOf('?')) > 0) alternative_urlname = alternative_urlname.substring(0, p);}}public int hashCode() {diff --git a/source/de/anomic/search/Switchboard.java b/source/de/anomic/search/Switchboard.javaindex 7e1c871e0..f03d1bf51 100644--- a/source/de/anomic/search/Switchboard.java+++ b/source/de/anomic/search/Switchboard.java@@ -202,7 +202,7 @@ public final class Switchboard extends serverSwitch {// load slotspublic static int xstackCrawlSlots = 2000;public static long lastPPMUpdate = System.currentTimeMillis()- 30000;- private final int dhtMaxContainerCount = 500;+ private static final int dhtMaxContainerCount = 500;private int dhtMaxReferenceCount = 1000;// colored list management@@ -1367,6 +1367,8 @@ public final class Switchboard extends serverSwitch {entry selentry;while (it.hasNext()) {selentry = it.next();+ assert selentry.handle() != null;+ if (selentry.handle() == null) continue;if (selentry.name().equals(CrawlSwitchboard.CRAWL_PROFILE_PROXY))crawler.profilesActiveCrawls.changeEntry(selentry, CrawlProfile.entry.RECRAWL_IF_OLDER,Long.toString(crawler.profilesActiveCrawls.getRecrawlDate(CrawlSwitchboard.CRAWL_PROFILE_PROXY_RECRAWL_CYCLE)));@@ -1808,7 +1810,7 @@ public final class Switchboard extends serverSwitch {}}- private static SimpleDateFormat DateFormat1 = new SimpleDateFormat("EEE, dd MMM yyyy");+ private static SimpleDateFormat DateFormat1 = new SimpleDateFormat("EEE, dd MMM yyyy", Locale.US);public static String dateString(final Date date) {if (date == null) return "";return DateFormat1.format(date);diff --git a/source/net/sbbi/upnp/ServicesEventing.java b/source/net/sbbi/upnp/ServicesEventing.javaindex c06d5ae04..7686c50f8 100644--- a/source/net/sbbi/upnp/ServicesEventing.java+++ b/source/net/sbbi/upnp/ServicesEventing.java@@ -160,8 +160,8 @@ public class ServicesEventing implements Runnable {StringBuffer packet = new StringBuffer( 64 );packet.append( "SUBSCRIBE " ).append( eventingLoc.getFile() ).append( " HTTP/1.1\r\n" );- packet.append( "HOST: " ).append( eventingLoc.getHost() ).append( ":" ).append( eventingLoc.getPort() ).append( "\r\n" );- packet.append( "CALLBACK: <http://" ).append( InetAddress.getLocalHost().getHostAddress() ).append( ":" ).append( daemonPort ).append( "" ).append( eventingLoc.getFile() ).append( ">\r\n" );+ packet.append( "HOST: " ).append( eventingLoc.getHost() ).append( ':' ).append( eventingLoc.getPort() ).append( "\r\n" );+ packet.append( "CALLBACK: <http://" ).append( InetAddress.getLocalHost().getHostAddress() ).append( ':' ).append( daemonPort ).append( "" ).append( eventingLoc.getFile() ).append( ">\r\n" );packet.append( "NT: upnp:event\r\n" );packet.append( "Connection: close\r\n" );packet.append( "TIMEOUT: Second-" ).append( duration ).append( "\r\n\r\n" );@@ -277,7 +277,7 @@ public class ServicesEventing implements Runnable {StringBuffer packet = new StringBuffer( 64 );packet.append( "UNSUBSCRIBE " ).append( eventingLoc.getFile() ).append( " HTTP/1.1\r\n" );- packet.append( "HOST: " ).append( eventingLoc.getHost() ).append( ":" ).append( eventingLoc.getPort() ).append( "\r\n" );+ packet.append( "HOST: " ).append( eventingLoc.getHost() ).append( ':' ).append( eventingLoc.getPort() ).append( "\r\n" );packet.append( "SID: " ).append( sub.sub.getSID() ).append( "\r\n\r\n" );Socket skt = new Socket( eventingLoc.getHost(), eventingLoc.getPort() );skt.setSoTimeout( 30000 ); // 30 secs timeout according to the specsdiff --git a/source/net/sbbi/upnp/messages/ActionMessage.java b/source/net/sbbi/upnp/messages/ActionMessage.javaindex 551dc8de2..6c28f8f9d 100644--- a/source/net/sbbi/upnp/messages/ActionMessage.java+++ b/source/net/sbbi/upnp/messages/ActionMessage.java@@ -120,11 +120,11 @@ public class ActionMessage {// this action requires params so we just set them...for ( Iterator itr = inputParameters.iterator(); itr.hasNext(); ) {InputParamContainer container = (InputParamContainer)itr.next();- body.append( "<" ).append( container.name ).append( ">" ).append( container.value );- body.append( "</" ).append( container.name ).append( ">" );+ body.append( '<' ).append( container.name ).append( '>' ).append( container.value );+ body.append( "</" ).append( container.name ).append( '>' );}}- body.append( "</u:" ).append( serviceAction.getName() ).append( ">" );+ body.append( "</u:" ).append( serviceAction.getName() ).append( '>' );body.append( "</s:Body>" );body.append( "</s:Envelope>" );diff --git a/source/net/sbbi/upnp/messages/ActionResponse.java b/source/net/sbbi/upnp/messages/ActionResponse.javaindex 9853a45f8..40da7f5e8 100644--- a/source/net/sbbi/upnp/messages/ActionResponse.java+++ b/source/net/sbbi/upnp/messages/ActionResponse.java@@ -93,8 +93,8 @@ public class ActionResponse {for ( Iterator i = outArguments.keySet().iterator(); i.hasNext(); ) {String name = (String)i.next();String value = (String)outArgumentsVals.get( name );- rtrVal.append( name ).append( "=" ).append( value );- if ( i.hasNext() ) rtrVal.append( "\n" );+ rtrVal.append( name ).append( '=' ).append( value );+ if ( i.hasNext() ) rtrVal.append( '\n' );}return rtrVal.toString();}diff --git a/source/net/sbbi/upnp/services/ISO8601Date.java b/source/net/sbbi/upnp/services/ISO8601Date.javaindex 6194a7109..e89ab9506 100644--- a/source/net/sbbi/upnp/services/ISO8601Date.java+++ b/source/net/sbbi/upnp/services/ISO8601Date.java@@ -216,7 +216,7 @@ public class ISO8601Date {private static String twoDigit(int i) {if (i >= 0 && i < 10) {- return "0" + String.valueOf(i);+ return "0" + i;}return String.valueOf(i);}@@ -231,9 +231,9 @@ public class ISO8601Date {calendar.setTime(date);StringBuffer buffer = new StringBuffer();buffer.append(calendar.get(Calendar.YEAR));- buffer.append("-");+ buffer.append('-');buffer.append(twoDigit(calendar.get(Calendar.MONTH) + 1));- buffer.append("-");+ buffer.append('-');buffer.append(twoDigit(calendar.get(Calendar.DAY_OF_MONTH)));return buffer.toString();}@@ -248,17 +248,17 @@ public class ISO8601Date {calendar.setTime(date);StringBuffer buffer = new StringBuffer();buffer.append(calendar.get(Calendar.YEAR));- buffer.append("-");+ buffer.append('-');buffer.append(twoDigit(calendar.get(Calendar.MONTH) + 1));- buffer.append("-");+ buffer.append('-');buffer.append(twoDigit(calendar.get(Calendar.DAY_OF_MONTH)));- buffer.append("T");+ buffer.append('T');buffer.append(twoDigit(calendar.get(Calendar.HOUR_OF_DAY)));- buffer.append(":");+ buffer.append(':');buffer.append(twoDigit(calendar.get(Calendar.MINUTE)));- buffer.append(":");+ buffer.append(':');buffer.append(twoDigit(calendar.get(Calendar.SECOND)));- buffer.append(".");+ buffer.append('.');buffer.append(twoDigit(calendar.get(Calendar.MILLISECOND) / 10));return buffer.toString();}@@ -273,19 +273,19 @@ public class ISO8601Date {calendar.setTime(date);StringBuffer buffer = new StringBuffer();buffer.append(calendar.get(Calendar.YEAR));- buffer.append("-");+ buffer.append('-');buffer.append(twoDigit(calendar.get(Calendar.MONTH) + 1));- buffer.append("-");+ buffer.append('-');buffer.append(twoDigit(calendar.get(Calendar.DAY_OF_MONTH)));- buffer.append("T");+ buffer.append('T');buffer.append(twoDigit(calendar.get(Calendar.HOUR_OF_DAY)));- buffer.append(":");+ buffer.append(':');buffer.append(twoDigit(calendar.get(Calendar.MINUTE)));- buffer.append(":");+ buffer.append(':');buffer.append(twoDigit(calendar.get(Calendar.SECOND)));- buffer.append(".");+ buffer.append('.');buffer.append(twoDigit(calendar.get(Calendar.MILLISECOND) / 10));- buffer.append("Z");+ buffer.append('Z');return buffer.toString();}@@ -299,11 +299,11 @@ public class ISO8601Date {calendar.setTime(date);StringBuffer buffer = new StringBuffer();buffer.append(twoDigit(calendar.get(Calendar.HOUR_OF_DAY)));- buffer.append(":");+ buffer.append(':');buffer.append(twoDigit(calendar.get(Calendar.MINUTE)));- buffer.append(":");+ buffer.append(':');buffer.append(twoDigit(calendar.get(Calendar.SECOND)));- buffer.append(".");+ buffer.append('.');buffer.append(twoDigit(calendar.get(Calendar.MILLISECOND) / 10));return buffer.toString();}@@ -318,13 +318,13 @@ public class ISO8601Date {calendar.setTime(date);StringBuffer buffer = new StringBuffer();buffer.append(twoDigit(calendar.get(Calendar.HOUR_OF_DAY)));- buffer.append(":");+ buffer.append(':');buffer.append(twoDigit(calendar.get(Calendar.MINUTE)));- buffer.append(":");+ buffer.append(':');buffer.append(twoDigit(calendar.get(Calendar.SECOND)));- buffer.append(".");+ buffer.append('.');buffer.append(twoDigit(calendar.get(Calendar.MILLISECOND) / 10));- buffer.append("Z");+ buffer.append('Z');return buffer.toString();}diff --git a/source/net/yacy/ai/example/ConnectFour.java b/source/net/yacy/ai/example/ConnectFour.javaindex 53f3bed2d..7a4792e8f 100755--- a/source/net/yacy/ai/example/ConnectFour.java+++ b/source/net/yacy/ai/example/ConnectFour.java@@ -240,12 +240,12 @@ public class ConnectFour {StringBuffer s = new StringBuffer((width + 1) * height);Coin coin;for (int row = height - 1; row >= 0; row--) {- s.append("\"");+ s.append('\"');for (int column = 0; column < width; column++) {coin = b[row * width + column];s.append((coin == null) ? " " : coin.toString());}- if (row == 0) s.append("\""); else s.append("\"+\n");+ if (row == 0) s.append('\"'); else s.append("\"+\n");}return s.toString();}diff --git a/source/net/yacy/document/AbstractParser.java b/source/net/yacy/document/AbstractParser.javaindex dd842f7d0..6f98c7811 100644--- a/source/net/yacy/document/AbstractParser.java+++ b/source/net/yacy/document/AbstractParser.java@@ -91,16 +91,16 @@ public abstract class AbstractParser implements Idiom {public final File createTempFile(final String name) throws IOException {String parserClassName = this.getClass().getName();- int idx = parserClassName.lastIndexOf(".");+ int idx = parserClassName.lastIndexOf('.');if (idx != -1) {parserClassName = parserClassName.substring(idx+1);}// getting the file extension- idx = name.lastIndexOf("/");+ idx = name.lastIndexOf('/');final String fileName = (idx != -1) ? name.substring(idx+1) : name;- idx = fileName.lastIndexOf(".");+ idx = fileName.lastIndexOf('.');final String fileExt = (idx > -1) ? fileName.substring(idx+1) : "";// creates the temp filediff --git a/source/net/yacy/kelondro/io/AbstractWriter.java b/source/net/yacy/kelondro/io/AbstractWriter.javaindex beb463d41..28f2826ca 100644--- a/source/net/yacy/kelondro/io/AbstractWriter.java+++ b/source/net/yacy/kelondro/io/AbstractWriter.java@@ -129,7 +129,7 @@ public abstract class AbstractWriter extends AbstractReader implements Writer {line = line.trim();if (line.equals("# EOF")) return map;if ((line.length() == 0) || (line.charAt(0) == '#')) continue;- pos = line.indexOf("=");+ pos = line.indexOf('=');if (pos < 0) continue;map.put(line.substring(0, pos), line.substring(pos + 1));}diff --git a/source/net/yacy/kelondro/logging/SimpleLogFormatter.java b/source/net/yacy/kelondro/logging/SimpleLogFormatter.javaindex 4ca0be75f..d69974dd2 100644--- a/source/net/yacy/kelondro/logging/SimpleLogFormatter.java+++ b/source/net/yacy/kelondro/logging/SimpleLogFormatter.java@@ -30,6 +30,7 @@ import java.io.StringWriter;import java.text.FieldPosition;import java.text.SimpleDateFormat;import java.util.Date;+import java.util.Locale;import java.util.logging.LogRecord;import java.util.logging.SimpleFormatter;@@ -41,10 +42,9 @@ public final class SimpleLogFormatter extends SimpleFormatter {private final FieldPosition position = new FieldPosition(0);// e.g. 2005/05/25 11:22:53- private final SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");+ private final SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);private final StringBuffer buffer = new StringBuffer();-public SimpleLogFormatter() {super();@@ -99,7 +99,7 @@ public final class SimpleLogFormatter extends SimpleFormatter {record.getThrown().printStackTrace(printer);stringBuffer.append(writer.toString());} catch (final Exception e) {- stringBuffer.append("Failed to get stack trace: " + e.getMessage());+ stringBuffer.append("Failed to get stack trace: ").append(e.getMessage());} finally {if (writer != null) try {writer.close();} catch (final Exception ex) {}}diff --git a/source/net/yacy/kelondro/util/DateFormatter.java b/source/net/yacy/kelondro/util/DateFormatter.javaindex 8e823b1e4..b1666b6e0 100644--- a/source/net/yacy/kelondro/util/DateFormatter.java+++ b/source/net/yacy/kelondro/util/DateFormatter.java@@ -60,14 +60,14 @@ public final class DateFormatter {private static final Calendar CAL_GMT = Calendar.getInstance(TZ_GMT, Locale.US);/** Date formatter/parser for minimal yyyyMMdd pattern */- private static final SimpleDateFormat FORMAT_SHORT_DAY = new SimpleDateFormat(PATTERN_SHORT_DAY);+ private static final SimpleDateFormat FORMAT_SHORT_DAY = new SimpleDateFormat(PATTERN_SHORT_DAY, Locale.US);/** Date formatter/parser for minimal yyyyMMddHHmmss pattern */- private static final SimpleDateFormat FORMAT_SHORT_SECOND = new SimpleDateFormat(PATTERN_SHORT_SECOND);+ private static final SimpleDateFormat FORMAT_SHORT_SECOND = new SimpleDateFormat(PATTERN_SHORT_SECOND, Locale.US);/** Date formatter/parser for minimal yyyyMMddHHmmssSSS pattern */- private static final SimpleDateFormat FORMAT_SHORT_MILSEC = new SimpleDateFormat(PATTERN_SHORT_MILSEC);+ private static final SimpleDateFormat FORMAT_SHORT_MILSEC = new SimpleDateFormat(PATTERN_SHORT_MILSEC, Locale.US);/** Date formatter/non-sloppy parser for W3C datetime (ISO8601) in GMT/UTC */- private static final SimpleDateFormat FORMAT_ISO8601 = new SimpleDateFormat(PATTERN_ISO8601);+ private static final SimpleDateFormat FORMAT_ISO8601 = new SimpleDateFormat(PATTERN_ISO8601, Locale.US);/** Date formatter/parser for standard compliant HTTP header dates (RFC 1123) */private static final SimpleDateFormat FORMAT_RFC1123 = new SimpleDateFormat(PATTERN_RFC1123, Locale.US);diff --git a/source/net/yacy/kelondro/util/FileUtils.java b/source/net/yacy/kelondro/util/FileUtils.javaindex 84c84580e..7b0daae72 100644--- a/source/net/yacy/kelondro/util/FileUtils.java+++ b/source/net/yacy/kelondro/util/FileUtils.java@@ -498,7 +498,7 @@ public final class FileUtils {final HashMap<String, String> props = new HashMap<String, String>();while (li.hasNext()) {line = li.next();- pos = line.indexOf("=");+ pos = line.indexOf('=');if (pos > 0) props.put(line.substring(0, pos).trim(), line.substring(pos + 1).trim());}return props;@@ -530,7 +530,7 @@ public final class FileUtils {line = i.next().trim();if (line.length() > 0 && line.charAt(0) == '#') continue; // exclude comments//System.out.println("NXTOOLS_PROPS - LINE:" + line);- pos = line.indexOf("=");+ pos = line.indexOf('=');if (pos > 0) props.put(line.substring(0, pos).trim(), line.substring(pos + 1).trim());}return props;diff --git a/source/net/yacy/kelondro/util/MapTools.java b/source/net/yacy/kelondro/util/MapTools.javaindex 058c14f50..3a3f65a29 100644--- a/source/net/yacy/kelondro/util/MapTools.java+++ b/source/net/yacy/kelondro/util/MapTools.java@@ -45,7 +45,7 @@ public final class MapTools {String token;while (st.hasMoreTokens()) {token = st.nextToken().trim();- pos = token.indexOf("=");+ pos = token.indexOf('=');if (pos > 0) p.setProperty(token.substring(0, pos).trim(), token.substring(pos + 1).trim());}return p;@@ -56,13 +56,13 @@ public final class MapTools {if (string == null) return null;final HashMap<String, String> map = new HashMap<String, String>();int pos;- if ((pos = string.indexOf("{")) >= 0) string = string.substring(pos + 1).trim();- if ((pos = string.lastIndexOf("}")) >= 0) string = string.substring(0, pos).trim();+ if ((pos = string.indexOf('{')) >= 0) string = string.substring(pos + 1).trim();+ if ((pos = string.lastIndexOf('}')) >= 0) string = string.substring(0, pos).trim();final StringTokenizer st = new StringTokenizer(string, separator);String token;while (st.hasMoreTokens()) {token = st.nextToken().trim();- pos = token.indexOf("=");+ pos = token.indexOf('=');if (pos > 0) map.put(token.substring(0, pos).trim(), token.substring(pos + 1).trim());}return map;@@ -100,8 +100,8 @@ public final class MapTools {if (string == null) return null;final Set<String> set = Collections.synchronizedSet(new HashSet<String>());int pos;- if ((pos = string.indexOf("{")) >= 0) string = string.substring(pos + 1).trim();- if ((pos = string.lastIndexOf("}")) >= 0) string = string.substring(0, pos).trim();+ if ((pos = string.indexOf('{')) >= 0) string = string.substring(pos + 1).trim();+ if ((pos = string.lastIndexOf('}')) >= 0) string = string.substring(0, pos).trim();final StringTokenizer st = new StringTokenizer(string, separator);while (st.hasMoreTokens()) {set.add(st.nextToken().trim());diff --git a/source/net/yacy/kelondro/util/ScoreCluster.java b/source/net/yacy/kelondro/util/ScoreCluster.javaindex 8afedb98d..994b8c266 100644--- a/source/net/yacy/kelondro/util/ScoreCluster.java+++ b/source/net/yacy/kelondro/util/ScoreCluster.java@@ -25,6 +25,7 @@ import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Comparator;import java.util.Iterator;+import java.util.Locale;import java.util.Map;import java.util.Random;import java.util.SortedMap;@@ -94,7 +95,7 @@ public final class ScoreCluster<E> {}public static final String shortDateFormatString = "yyyyMMddHHmmss";- public static final SimpleDateFormat shortFormatter = new SimpleDateFormat(shortDateFormatString);+ public static final SimpleDateFormat shortFormatter = new SimpleDateFormat(shortDateFormatString, Locale.US);public static final long minutemillis = 60000;public static long date2000 = 0;diff --git a/source/net/yacy/migration.java b/source/net/yacy/migration.javaindex 03d6632ef..fa180b102 100644--- a/source/net/yacy/migration.java+++ b/source/net/yacy/migration.java@@ -49,7 +49,7 @@ public class migration {if(fromRev < NEW_OVERLAYS){migrateDefaultFiles(sb);}- Log.logInfo("MIGRATION", "Migrating from "+String.valueOf(fromRev)+ " to "+String.valueOf(toRev));+ Log.logInfo("MIGRATION", "Migrating from "+ fromRev + " to " + toRev);presetPasswords(sb);migrateSwitchConfigSettings(sb);migrateWorkFiles(sb);diff --git a/source/net/yacy/repository/Blacklist.java b/source/net/yacy/repository/Blacklist.javaindex dc955f453..59bf8f158 100644--- a/source/net/yacy/repository/Blacklist.java+++ b/source/net/yacy/repository/Blacklist.java@@ -402,7 +402,7 @@ public class Blacklist {allowRegex = properties.get("allowRegex").equalsIgnoreCase("true") ? true : false;}- if ((slashPos = element.indexOf("/")) == -1) {+ if ((slashPos = element.indexOf('/')) == -1) {host = element;path = ".*";} else {@@ -411,7 +411,7 @@ public class Blacklist {}if (!allowRegex || !isValidRegex(host)) {- final int i = host.indexOf("*");+ final int i = host.indexOf('*');// check whether host begins illegallyif (!host.matches("([A-Za-z0-9_-]+|\\*)(\\.([A-Za-z0-9_-]+|\\*))*")) {