enable warnings and fix most of it

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6196 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
f1ori 16 years ago
parent 8931c8d6b4
commit f814e0fa81

@ -202,7 +202,7 @@
includes="de/anomic/yacy/yacyBuildProperties.java"
source="${javacSource}" target="${javacTarget}">
<classpath refid="project.class.path" />
<!--<compilerarg value="-Xlint"/>-->
<compilerarg value="-Xlint"/>
</javac>
<delete file="${build}/BuildProperties.java" />
@ -212,7 +212,7 @@
debug="true" debuglevel="lines,vars,source"
source="${javacSource}" target="${javacTarget}">
<classpath refid="project.class.path" />
<!--<compilerarg value="-Xlint"/>-->
<compilerarg value="-Xlint"/>
</javac>
<!-- compiling htroot, htroot/yacy and htroot/htdocsdefault -->
@ -221,7 +221,7 @@
classpathref="project.class.path"
debug="true" debuglevel="lines,vars,source"
source="${javacSource}" target="${javacTarget}">
<!--<compilerarg value="-Xlint"/>-->
<compilerarg value="-Xlint"/>
</javac>
</target>

@ -87,7 +87,7 @@ public class Blog {
final int num = post.getInt("num",10); //indicates how many entries should be shown
if(!hasRights){
final userDB.Entry userentry = sb.userDB.proxyAuth((String)header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));
final userDB.Entry userentry = sb.userDB.proxyAuth(header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));
if(userentry != null && userentry.hasRight(userDB.Entry.BLOG_RIGHT)){
hasRights=true;
} else if(post.containsKey("login")) {
@ -97,7 +97,7 @@ public class Blog {
}
String pagename = post.get("page", DEFAULT_PAGE);
final String ip = (String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
final String ip = header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
String StrAuthor = post.get("author", "");

@ -73,7 +73,7 @@ public class BlogComments {
}
if(!hasRights){
final userDB.Entry userentry = sb.userDB.proxyAuth((String)header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));
final userDB.Entry userentry = sb.userDB.proxyAuth(header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));
if(userentry != null && userentry.hasRight(userDB.Entry.BLOG_RIGHT)){
hasRights=true;
}

@ -50,9 +50,9 @@ public class ConfigAccounts_p {
boolean localhostAccess = sb.getConfigBool("adminAccountForLocalhost", false);
if ((post != null) && (post.containsKey("setAdmin"))) {
localhostAccess = post.get("access", "").equals("localhost");
final String user = (post == null) ? "" : (String) post.get("adminuser", "");
final String pw1 = (post == null) ? "" : (String) post.get("adminpw1", "");
final String pw2 = (post == null) ? "" : (String) post.get("adminpw2", "");
final String user = (post == null) ? "" : post.get("adminuser", "");
final String pw1 = (post == null) ? "" : post.get("adminpw1", "");
final String pw2 = (post == null) ? "" : post.get("adminpw2", "");
// may be overwritten if new password is given
if ((user.length() > 0) && (pw1.length() > 3) && (pw1.equals(pw2))) {

@ -83,7 +83,7 @@ public class ConfigBasic {
}
// peer name settings
final String peerName = (post == null) ? env.getConfig("peerName","") : (String) post.get("peername", "");
final String peerName = (post == null) ? env.getConfig("peerName","") : post.get("peername", "");
// port settings
long port = env.getConfigLong("port", 8080); //this allows a low port, but it will only get one, if the user edits the config himself.

@ -114,7 +114,7 @@ public class ConfigLanguage_p {
//virtual entry
prop.put("langlist_0_file", "default");
prop.put("langlist_0_name", ((langNames.get("default") == null) ? "default" : (String) langNames.get("default")));
prop.put("langlist_0_name", ((langNames.get("default") == null) ? "default" : langNames.get("default")));
prop.put("langlist_0_selected", "selected=\"selected\"");
int count = 0;

@ -77,7 +77,7 @@ public class CrawlResults {
if (((tabletype > 0) && (tabletype < 6)) ||
(post != null && (post.containsKey("clearlist") ||
post.containsKey("deleteentry")))) {
final String authorization = ((String) header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));
final String authorization = (header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));
if (authorization.length() != 0) {
if (! sb.verifyAuthentication(header, true)){
// force log-in (again, because wrong password was given)

@ -82,7 +82,7 @@ public class MessageSend_p {
}
prop.putXML("mode_permission_peerName", peerName);
final String response = (result == null) ? null : (String) result.get("response");
final String response = (result == null) ? null : result.get("response");
if (response == null || result == null) {
// we don't have permission or other peer does not exist
prop.put("mode_permission", "0");

@ -39,7 +39,7 @@ public class SearchEventPicture {
public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
final String eventID = (String) header.get("event", QueryEvent.lastEventID);
final String eventID = header.get("event", QueryEvent.lastEventID);
if (eventID == null) return null;
final ymageMatrix yp = plasmaGrafics.getSearchEventPicture(sb.peers, eventID);
if (yp == null) return new ymageMatrix(1, 1, ymageMatrix.MODE_SUB, "000000"); // empty image

@ -160,7 +160,7 @@ public final class Settings_p {
}
// clientIP
prop.putXML("clientIP", (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "<unknown>")); // read an artificial header addendum
prop.putXML("clientIP", header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "<unknown>")); // read an artificial header addendum
/*
* seed upload settings

@ -53,7 +53,7 @@ public class User{
prop.put("logged-in_limit", "0");
prop.put("status", "0");
//identified via HTTPPassword
entry=sb.userDB.proxyAuth(((String) requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")));
entry=sb.userDB.proxyAuth((requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")));
if(entry != null){
prop.put("logged-in_identified-by", "1");
//try via cookie
@ -62,7 +62,7 @@ public class User{
prop.put("logged-in_identified-by", "2");
//try via ip
if(entry == null){
entry=sb.userDB.ipAuth(((String)requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")));
entry=sb.userDB.ipAuth((requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")));
if(entry != null){
prop.put("logged-in_identified-by", "0");
}
@ -145,7 +145,7 @@ public class User{
if(post!=null && post.containsKey("logout")){
prop.put("logged-in", "0");
if(entry != null){
entry.logout(((String)requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")), userDB.getLoginToken(requestHeader.getHeaderCookies())); //todo: logout cookie
entry.logout((requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")), userDB.getLoginToken(requestHeader.getHeaderCookies())); //todo: logout cookie
}else{
sb.userDB.adminLogout(userDB.getLoginToken(requestHeader.getHeaderCookies()));
}

@ -179,7 +179,7 @@ public class NoticeURLImporter extends AbstractImporter implements Importer {
this.importProfileHandleCache.add(profileHandle);
HashMap<String, String> mapclone = new HashMap<String, String>();
mapclone.putAll(sourceEntry.map());
this.activeCrawls.newEntry((HashMap<String, String>) mapclone);
this.activeCrawls.newEntry(mapclone);
} else {
this.log.logWarning("Profile '" + profileHandle + "' of url entry '" + nextHash + "' unknown.");
continue;

@ -367,7 +367,7 @@ public class RobotsTxt {
}
public String getSitemap() {
return this.mem.containsKey(SITEMAP)? (String)this.mem.get(SITEMAP): null;
return this.mem.containsKey(SITEMAP)? this.mem.get(SITEMAP): null;
}
public Date getLoadedDate() {

@ -493,7 +493,7 @@ public class httpDocument {
public yacyURL referrerURL() {
if (requestHeader == null) return null;
try {
return new yacyURL((String) requestHeader.get(httpRequestHeader.REFERER, ""), null);
return new yacyURL(requestHeader.get(httpRequestHeader.REFERER, ""), null);
} catch (final Exception e) {
return null;
}

@ -326,7 +326,7 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S
*/
public String mime() {
return (String) get(CONTENT_TYPE, "application/octet-stream");
return get(CONTENT_TYPE, "application/octet-stream");
}
/*
@ -450,7 +450,7 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S
if ((tag != '*') && (tag != '#')) { // '#' in key is reserved for proxy attributes as artificial header values
count = keyCount(key);
for (int j = 0; j < count; j++) {
theHeader.append(key).append(": ").append((String) getSingle(key, j)).append("\r\n");
theHeader.append(key).append(": ").append(getSingle(key, j)).append("\r\n");
}
}
}

@ -74,7 +74,7 @@ public class httpRequestHeader extends httpHeader {
}
public String referer() {
return (String) get(REFERER, "");
return get(REFERER, "");
}
public String refererHost() {
@ -100,7 +100,7 @@ public class httpRequestHeader extends httpHeader {
}
public String userAgent() {
return (String) get(USER_AGENT, "");
return get(USER_AGENT, "");
}
public boolean acceptGzip() {

@ -273,12 +273,12 @@ public final class httpd implements serverHandler, Cloneable {
// persistent by default, but closed with the "Connection: close"
// property.
boolean persistent = !(httpVersion.equals(httpHeader.HTTP_VERSION_0_9) || httpVersion.equals(httpHeader.HTTP_VERSION_1_0));
if (((String)header.get(httpRequestHeader.CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1 ||
((String)header.get(httpRequestHeader.PROXY_CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1) {
if ((header.get(httpRequestHeader.CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1 ||
(header.get(httpRequestHeader.PROXY_CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1) {
persistent = false;
}
final String transferEncoding = (String) header.get(httpHeader.TRANSFER_ENCODING, "identity");
final String transferEncoding = header.get(httpHeader.TRANSFER_ENCODING, "identity");
final boolean isPostRequest = this.prop.getProperty(httpHeader.CONNECTION_PROP_METHOD).equals(httpHeader.METHOD_POST);
final boolean hasContentLength = header.containsKey(httpHeader.CONTENT_LENGTH);
final boolean hasTransferEncoding = header.containsKey(httpHeader.TRANSFER_ENCODING) && !transferEncoding.equalsIgnoreCase("identity");
@ -357,14 +357,14 @@ public final class httpd implements serverHandler, Cloneable {
// the accessing client must identify with user:password, where
// user = addressed peer name
// pw = addressed peer hash (b64-hash)
final String auth = (String) header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");
final String auth = header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");
if (getAlternativeResolver() != null) {
final String test = Base64Order.standardCoder.encodeString(getAlternativeResolver().myName() + ":" + getAlternativeResolver().myID());
if (!test.equals(auth.trim().substring(6))) return false;
}
// the accessing client must use a yacy user-agent
if (!(((String) header.get(httpHeader.USER_AGENT,"")).startsWith("yacy"))) return false;
if (!((header.get(httpHeader.USER_AGENT,"")).startsWith("yacy"))) return false;
// furthermore, YaCy hops must not exceed a specific access frequency
@ -399,7 +399,7 @@ public final class httpd implements serverHandler, Cloneable {
}
if (this.use_proxyAccounts) {
final String auth = (String) header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");
final String auth = header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");
userDB.Entry entry=switchboard.userDB.ipAuth(this.clientIP);
if(entry == null){
entry=switchboard.userDB.proxyAuth(auth, this.clientIP);
@ -1395,7 +1395,7 @@ public final class httpd implements serverHandler, Cloneable {
if ((tag != '*') && (tag != '#')) { // '#' in key is reserved for proxy attributes as artificial header values
count = responseHeader.keyCount(key);
for (int j = 0; j < count; j++) {
header.append(key).append(": ").append((String) responseHeader.getSingle(key, j)).append("\r\n");
header.append(key).append(": ").append(responseHeader.getSingle(key, j)).append("\r\n");
}
//System.out.println("#" + key + ": " + value);
}

@ -1008,7 +1008,7 @@ public final class httpdFileHandler {
try {newOut.flush();}catch (final Exception e) {}
// wait a little time until everything closes so that clients can read from the streams/sockets
if ((contentLength >= 0) && ((String)requestHeader.get(httpRequestHeader.CONNECTION, "close")).indexOf("keep-alive") == -1) {
if ((contentLength >= 0) && (requestHeader.get(httpRequestHeader.CONNECTION, "close")).indexOf("keep-alive") == -1) {
// in case that the client knows the size in advance (contentLength present) the waiting will have no effect on the interface performance
// but if the client waits on a connection interruption this will slow down.
try {Thread.sleep(2000);} catch (final InterruptedException e) {} // FIXME: is this necessary?

@ -1010,7 +1010,7 @@ public final class httpdProxyHandler {
}
// only gzip-encoding is supported, remove other encodings (e. g. deflate)
if (((String)requestHeader.get(httpHeader.ACCEPT_ENCODING,"")).indexOf("gzip") != -1) {
if ((requestHeader.get(httpHeader.ACCEPT_ENCODING,"")).indexOf("gzip") != -1) {
requestHeader.put(httpHeader.ACCEPT_ENCODING, "gzip");
} else {
requestHeader.put(httpHeader.ACCEPT_ENCODING, "");
@ -1538,7 +1538,7 @@ public final class httpdProxyHandler {
private static synchronized String generateUserAgent(final httpHeader requestHeaders) {
userAgentStr.setLength(0);
final String browserUserAgent = (String) requestHeaders.get(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
final String browserUserAgent = requestHeaders.get(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
final int pos = browserUserAgent.lastIndexOf(')');
if (pos >= 0) {
userAgentStr

@ -371,8 +371,8 @@ public class HandleMap implements Iterable<Row.Entry> {
} catch (InterruptedException e) {
e.printStackTrace();
}
if (sortAtEnd && map.index instanceof ObjectIndexCache) {
((ObjectIndexCache) map.index).finishInitialization();
if (sortAtEnd) {
map.index.finishInitialization();
}
return map;
}

@ -83,7 +83,7 @@ public class IODispatcher extends Thread {
Log.logWarning("IODispatcher", "emergency dump of file " + file.getName());
cache.dump(file, (int) Math.min(MemoryControl.available() / 3, writeBufferSize));
} else {
DumpJob<? extends Reference> job = new DumpJob(cache, file, array);
DumpJob<? extends Reference> job = (DumpJob<? extends Reference>)new DumpJob(cache, file, array);
try {
this.dumpQueue.put(job);
this.controlQueue.release();

@ -91,7 +91,7 @@ public final class CitationReferenceRow implements Reference /*, Cloneable*/ {
this.entry.setCol(col_lother, lother);
this.entry.setCol(col_urlLength, urlLength);
this.entry.setCol(col_urlComps, urlComps);
this.entry.setCol(col_typeofurl, new byte[]{(byte) typeofurl});
this.entry.setCol(col_typeofurl, new byte[]{typeofurl});
this.entry.setCol(col_reserve, 0);
}

@ -225,7 +225,7 @@ public class DidYouMean {
public void run() {
try {
while(true) {
String s = (String)queue.take();
String s = queue.take();
if(s.equals("\n"))
this.interrupt();
else

@ -130,12 +130,12 @@ public class yacyNewsRecord {
public yacyNewsRecord(final String newsString) {
this.attributes = serverCodings.string2map(newsString, ",");
if (attributes.toString().length() > attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + attributesMaxLength + ")");
this.category = (attributes.containsKey("cat")) ? (String) attributes.get("cat") : "";
this.category = (attributes.containsKey("cat")) ? attributes.get("cat") : "";
if (category.length() > categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + categoryStringLength + ")");
this.received = (attributes.containsKey("rec")) ? DateFormatter.parseShortSecond(attributes.get("rec"), DateFormatter.UTCDiffString()) : new Date();
this.created = (attributes.containsKey("cre")) ? DateFormatter.parseShortSecond(attributes.get("cre"), DateFormatter.UTCDiffString()) : new Date();
this.distributed = (attributes.containsKey("dis")) ? Integer.parseInt(attributes.get("dis")) : 0;
this.originator = (attributes.containsKey("ori")) ? (String) attributes.get("ori") : "";
this.originator = (attributes.containsKey("ori")) ? attributes.get("ori") : "";
removeStandards();
}
@ -225,4 +225,4 @@ public class yacyNewsRecord {
public static void main(final String[] args) {
System.out.println((newRecord(args[0])).toString());
}
}
}

Loading…
Cancel
Save