- removed unnecessary semicolons

- added default case for switch
pull/1/head
Michael Peter Christen 13 years ago
parent 132afaf687
commit 5bd3c90907

@ -55,7 +55,7 @@ org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore

@ -138,7 +138,7 @@ public class Surftips {
try{
if(Switchboard.urlBlacklist.isListed(BlacklistType.SURFTIPS ,new DigestURI(url)))
continue;
}catch(final MalformedURLException e){continue;};
}catch(final MalformedURLException e){continue;}
title = row.getColUTF8(1);
description = row.getColUTF8(2);
if ((url == null) || (title == null) || (description == null)) continue;

@ -21,7 +21,7 @@ public class xbel {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
int count = 0;;
int count = 0;
String root = "/";
int style = 0;

@ -9,7 +9,7 @@
// $LastChangedBy$
//
// LICENSE
//
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
@ -52,8 +52,8 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
private final StringBuilder folderstring;
private YMarkEntry bmk;
private final XMLReader xmlReader;
// Statics
// Statics
public static enum XBEL {
NOTHING (""),
XBEL ("<xbel"),
@ -65,10 +65,10 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
ALIAS ("<alias"),
INFO ("<info"),
METADATA ("<metadata");
private static StringBuilder buffer = new StringBuilder(25);;
private static StringBuilder buffer = new StringBuilder(25);
private String tag;
private XBEL(String t) {
this.tag = t;
}
@ -77,9 +77,9 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
}
public String endTag(boolean empty) {
buffer.setLength(0);
buffer.append(tag);
buffer.append(this.tag);
if(empty) {
buffer.append('/');
buffer.append('/');
} else {
buffer.insert(1, '/');
}
@ -88,7 +88,7 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
}
public String startTag(boolean att) {
buffer.setLength(0);
buffer.append(tag);
buffer.append(this.tag);
if(!att)
buffer.append('>');
return buffer.toString();
@ -100,12 +100,12 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
private final HashSet<YMarkEntry> aliasRef;
private final StringBuilder buffer;
private final StringBuilder folder;
private YMarkEntry ref;
private XBEL outer_state; // BOOKMARK, FOLDER, NOTHING
private XBEL inner_state; // DESC, TITLE, INFO, ALIAS, (METADATA), NOTHING
private boolean parse_value;
public YMarkXBELImporter (final Reader bmk_file, final int queueSize, final String root) throws SAXException {
this.bookmarks = new ArrayBlockingQueue<YMarkEntry>(queueSize);
this.bmk_file = bmk_file;
@ -119,19 +119,20 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
this.xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
this.xmlReader.setFeature("http://xml.org/sax/features/namespaces", false);
this.xmlReader.setFeature("http://xml.org/sax/features/validation", false);
this.bmkRef = new HashMap<String,YMarkEntry>();
this.aliasRef = new HashSet<YMarkEntry>();
this.buffer = new StringBuilder();
this.folder = new StringBuilder(YMarkTables.BUFFER_LENGTH);
this.folder.append(this.RootFolder);
}
@Override
public void run() {
try {
this.xmlReader.parse(new InputSource(this.bmk_file));
} catch (SAXParseException e) {
Log.logException(e);
Log.logException(e);
} catch (SAXException e) {
Log.logException(e);
} catch (IOException e) {
@ -145,7 +146,8 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
}
}
}
@Override
public void endDocument() throws SAXException {
// put alias references in the bookmark queue to ensure that folders get updated
// we do that at endDocument to ensure all referenced bookmarks already exist
@ -153,15 +155,16 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
this.aliasRef.clear();
this.bmkRef.clear();
}
@Override
public void startElement(final String uri, final String name, String tag, final Attributes atts) throws SAXException {
YMarkDate date = new YMarkDate();
if (tag == null) return;
tag = tag.toLowerCase();
tag = tag.toLowerCase();
if (XBEL.BOOKMARK.tag().equals(tag)) {
this.bmk = new YMarkEntry();
this.bmk = new YMarkEntry();
this.bmk.put(YMarkEntry.BOOKMARK.URL.key(), atts.getValue(uri, YMarkEntry.BOOKMARK.URL.xbel_attrb()));
//TODO: include a dynamic loop over all annotation tags
//TODO: include a dynamic loop over all annotation tags
this.bmk.put(YMarkEntry.BOOKMARK.TAGS.key(), atts.getValue(uri, YMarkEntry.BOOKMARK.TAGS.xbel_attrb()));
this.bmk.put(YMarkEntry.BOOKMARK.PUBLIC.key(), atts.getValue(uri, YMarkEntry.BOOKMARK.PUBLIC.xbel_attrb()));
this.bmk.put(YMarkEntry.BOOKMARK.VISITS.key(), atts.getValue(uri, YMarkEntry.BOOKMARK.VISITS.xbel_attrb()));
@ -186,7 +189,7 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
UpdateBmkRef(atts.getValue(uri, YMarkEntry.BOOKMARKS_ID), true);
this.outer_state = XBEL.BOOKMARK;
this.inner_state = XBEL.NOTHING;
this.parse_value = false;
this.parse_value = false;
} else if(XBEL.FOLDER.tag().equals(tag)) {
this.outer_state = XBEL.FOLDER;
this.inner_state = XBEL.NOTHING;
@ -200,14 +203,14 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
this.inner_state = XBEL.INFO;
this.parse_value = false;
} else if (XBEL.METADATA.tag().equals(tag)) {
// Support for old YaCy BookmarksDB XBEL Metadata (non valid XBEL)
// Support for old YaCy BookmarksDB XBEL Metadata (non valid XBEL)
if(this.outer_state == XBEL.BOOKMARK) {
final boolean isMozillaShortcutURL = atts.getValue(uri, "owner").equals("Mozilla") && !atts.getValue(uri, "ShortcutURL").isEmpty();
final boolean isYacyPublic = atts.getValue(uri, "owner").equals("YaCy") && !atts.getValue(uri, "public").isEmpty();
if(isMozillaShortcutURL)
this.bmk.put(YMarkEntry.BOOKMARK.TAGS.key(), YMarkUtil.cleanTagsString(atts.getValue(uri, "ShortcutURL")));
if(isYacyPublic)
this.bmk.put(YMarkEntry.BOOKMARK.PUBLIC.key(), atts.getValue(uri, "public"));
this.bmk.put(YMarkEntry.BOOKMARK.PUBLIC.key(), atts.getValue(uri, "public"));
}
} else if (XBEL.ALIAS.tag().equals(tag)) {
final String r = atts.getValue(uri, YMarkEntry.BOOKMARKS_REF);
@ -221,16 +224,17 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
}
}
@Override
public void endElement(final String uri, final String name, String tag) {
if (tag == null) return;
tag = tag.toLowerCase();
if(XBEL.BOOKMARK.tag().equals(tag)) {
// write bookmark
if (!this.bmk.isEmpty()) {
if (!this.bmk.isEmpty()) {
this.bmk.put(YMarkEntry.BOOKMARK.FOLDERS.key(), this.folder.toString());
try {
this.bookmarks.put(this.bmk);
bmk = new YMarkEntry();
this.bmk = new YMarkEntry();
} catch (InterruptedException e) {
Log.logException(e);
}
@ -240,7 +244,7 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
// go up one folder
//TODO: get rid of .toString.equals()
if(!this.folder.toString().equals(this.RootFolder)) {
folder.setLength(folder.lastIndexOf(YMarkUtil.FOLDERS_SEPARATOR));
this.folder.setLength(this.folder.lastIndexOf(YMarkUtil.FOLDERS_SEPARATOR));
}
this.outer_state = XBEL.FOLDER;
} else if (XBEL.INFO.tag().equals(tag)) {
@ -250,24 +254,25 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
}
}
@Override
public void characters(final char ch[], final int start, final int length) {
if (parse_value) {
buffer.append(ch, start, length);
switch(outer_state) {
if (this.parse_value) {
this.buffer.append(ch, start, length);
switch(this.outer_state) {
case BOOKMARK:
switch(inner_state) {
case DESC:
this.bmk.put(YMarkEntry.BOOKMARK.DESC.key(), buffer.toString().trim());
switch(this.inner_state) {
case DESC:
this.bmk.put(YMarkEntry.BOOKMARK.DESC.key(), this.buffer.toString().trim());
break;
case TITLE:
this.bmk.put(YMarkEntry.BOOKMARK.TITLE.key(), buffer.toString().trim());
this.bmk.put(YMarkEntry.BOOKMARK.TITLE.key(), this.buffer.toString().trim());
break;
default:
break;
break;
}
break;
case FOLDER:
switch(inner_state) {
switch(this.inner_state) {
case DESC:
break;
case TITLE:
@ -275,7 +280,7 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
this.folder.append(this.buffer);
break;
default:
break;
break;
}
break;
default:
@ -294,10 +299,10 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
return null;
}
}
private void UpdateBmkRef(final String id, final boolean url) {
this.folderstring.setLength(0);
if(this.bmkRef.containsKey(id)) {
this.folderstring.append(this.bmkRef.get(id).get(YMarkEntry.BOOKMARK.FOLDERS.key()));
this.folderstring.append(',');
@ -309,6 +314,6 @@ public class YMarkXBELImporter extends DefaultHandler implements Runnable {
if(url)
this.ref.put(YMarkEntry.BOOKMARK.URL.key(), this.bmk.get(YMarkEntry.BOOKMARK.URL.key()));
this.ref.put(YMarkEntry.BOOKMARK.FOLDERS.key(), this.folderstring.toString());
this.bmkRef.put(id, ref);
this.bmkRef.put(id, this.ref);
}
}

@ -38,6 +38,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import org.apache.commons.httpclient.HttpMethod;
/**
* <p>Transparently coalesces chunks of a HTTP stream that uses
@ -451,7 +453,6 @@ public class ChunkedInputStream extends InputStream {
// read and discard the remainder of the message
byte buffer[] = new byte[1024];
while (inStream.read(buffer) >= 0) {
;
}
}
}

@ -52,7 +52,7 @@ public class UPnP {
private final static String mappedName = "YaCy";
private final static String mappedProtocol = "TCP";
private static int mappedPort = 0;
private static String localHostIP = null;;
private static String localHostIP = null;
/* Discovery message sender IP /10.100.100.2 does not match device description IP /192.168.1.254 skipping message,
set the net.yacy.upnp.ddos.matchip system property to false to avoid this check
@ -181,7 +181,8 @@ public class UPnP {
protected static class Handler implements DiscoveryEventHandler {
public void eventSSDPAlive(String usn, String udn, String nt, String maxAge, URL location) {
@Override
public void eventSSDPAlive(String usn, String udn, String nt, String maxAge, URL location) {
InternetGatewayDevice[] newIGD = { null };
boolean error = false;
String errorMsg = null;
@ -207,7 +208,8 @@ public class UPnP {
Listener.unregister();
}
public void eventSSDPByeBye(String usn, String udn, String nt) {}
@Override
public void eventSSDPByeBye(String usn, String udn, String nt) {}
}

@ -46,7 +46,7 @@ public class RSSReader extends DefaultHandler {
private final RSSFeed theChannel;
private Type type;
public enum Type { rss, atom, rdf, none };
public enum Type { rss, atom, rdf, none }
private RSSReader(final int maxsize) {
this.theChannel = new RSSFeed(maxsize);
@ -57,7 +57,7 @@ public class RSSReader extends DefaultHandler {
this.parsingItem = false;
this.type = Type.none;
}
private static final ThreadLocal<SAXParser> tlSax = new ThreadLocal<SAXParser>();
private static SAXParser getParser() throws SAXException {
SAXParser parser = tlSax.get();
@ -71,7 +71,7 @@ public class RSSReader extends DefaultHandler {
}
return parser;
}
public RSSReader(final int maxsize, InputStream stream, final Type type) throws IOException {
this(maxsize);
this.type = type;

@ -152,7 +152,7 @@ public class Word {
public static final byte[] hash2private(final byte[] hash, byte privateType) {
byte[] p = new byte[commonHashLength];
p[0] = highByte; p[1] = highByte; p[2] = highByte; ; p[3] = highByte; ; p[4] = highByte; p[5] = privateType;
p[0] = highByte; p[1] = highByte; p[2] = highByte; p[3] = highByte; p[4] = highByte; p[5] = privateType;
System.arraycopy(hash, 0, p, 6, commonHashLength - 6); // 36 bits left for private hashes should be enough
return p;
}

@ -253,6 +253,12 @@ public final class Column implements Cloneable, Serializable {
s.append('-');
s.append(this.cellwidth);
break;
default:
s.append("String ");
s.append(this.nickname);
s.append('-');
s.append(this.cellwidth);
break;
}
switch (this.encoder) {
@ -262,6 +268,9 @@ public final class Column implements Cloneable, Serializable {
case encoder_b256:
s.append(" {b256}");
break;
default:
s.append(" {b256}");
break;
}
return s.toString();
}

@ -151,8 +151,8 @@ public abstract class AbstractThread extends Thread implements WorkflowThread {
}
@Override
public void open() {}; // dummy definition; should be overriden
public void open() {} // dummy definition; should be overriden
@Override
public void close() {}; // dummy definition; should be overriden
public void close() {} // dummy definition; should be overriden
}

@ -34,7 +34,7 @@ public class FilterEngine {
public static final int ERR_DOUBLE_OCCURANCE = 6;
public static final int ERR_HOST_REGEX = 7;
protected enum listTypes { type1 };
protected enum listTypes { type1 }
protected class FilterEntry implements Comparable<FilterEntry> {
public String path;

@ -216,7 +216,7 @@ public final class yacy {
try {
channel = new RandomAccessFile(f,"rw").getChannel();
lock = channel.tryLock(); // lock yacy.running
} catch (final Exception e) { };
} catch (final Exception e) { }
final String oldconf = "DATA/SETTINGS/httpProxy.conf".replace("/", File.separator);
final String newconf = "DATA/SETTINGS/yacy.conf".replace("/", File.separator);

Loading…
Cancel
Save