From 93dfb51fd4fcc1424abcf33805cf3ed1b9d06fdb Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 29 Jun 2009 22:22:35 +0000 Subject: [PATCH] problems with code style git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6153 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .checkstyle | 8 ++++++++ source/de/anomic/content/DCEntry.java | 3 ++- source/de/anomic/crawler/IndexingStack.java | 4 ++-- source/de/anomic/http/httpRequestHeader.java | 4 ---- .../de/anomic/kelondro/blob/ArrayStack.java | 9 ++++----- .../de/anomic/kelondro/index/HandleMap.java | 9 ++++----- source/de/anomic/kelondro/util/FileUtils.java | 9 ++++----- source/de/anomic/net/UPnP.java | 2 -- source/de/anomic/plasma/parser/Condenser.java | 20 +++++++++---------- source/de/anomic/yacy/dht/Dispatcher.java | 7 +++---- 10 files changed, 37 insertions(+), 38 deletions(-) create mode 100644 .checkstyle diff --git a/.checkstyle b/.checkstyle new file mode 100644 index 000000000..d7cb5e4da --- /dev/null +++ b/.checkstyle @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/source/de/anomic/content/DCEntry.java b/source/de/anomic/content/DCEntry.java index 9c8745b69..90a67b94b 100644 --- a/source/de/anomic/content/DCEntry.java +++ b/source/de/anomic/content/DCEntry.java @@ -118,7 +118,8 @@ public class DCEntry extends TreeMap { public String language() { String l = this.get("language"); if (l == null) l = this.get("dc:language"); - if (l == null) return url().language(); else return l; + if (l == null) return url().language(); + return l; } public String title() { diff --git a/source/de/anomic/crawler/IndexingStack.java b/source/de/anomic/crawler/IndexingStack.java index 604de3345..cc85fafac 100644 --- a/source/de/anomic/crawler/IndexingStack.java +++ b/source/de/anomic/crawler/IndexingStack.java @@ -114,9 +114,9 @@ public class IndexingStack { } if (sbQueueStack.size() < sizeBefore) { return new QueueEntry(b); - } else { - Log.logSevere("IndexingStack", "sbQueueStack " + sbQueueStack.filename + " does not shrink after pot() != null; trying pop()"); } + Log.logSevere("IndexingStack", "sbQueueStack " + sbQueueStack.filename + " does not shrink after pot() != null; trying pop()"); + sizeBefore = sbQueueStack.size(); b = sbQueueStack.pop(); if (b == null) { diff --git a/source/de/anomic/http/httpRequestHeader.java b/source/de/anomic/http/httpRequestHeader.java index 5a7670595..ff977f16e 100755 --- a/source/de/anomic/http/httpRequestHeader.java +++ b/source/de/anomic/http/httpRequestHeader.java @@ -37,9 +37,6 @@ import de.anomic.server.serverCore; public class httpRequestHeader extends httpHeader { // request header properties - public static final String ACCEPT = "Accept"; - public static final String ACCEPT_CHARSET = "Accept-Charset"; - public static final String ACCEPT_LANGUAGE = "Accept-Language"; public static final String CONNECTION = "Connection"; public static final String PROXY_CONNECTION = "Proxy-Connection"; @@ -58,7 +55,6 @@ public class httpRequestHeader extends httpHeader { public static final String COOKIE = "Cookie"; - public static final String ACCEPT_ENCODING = "Accept-Encoding"; public static final String IF_MODIFIED_SINCE = "If-Modified-Since"; public static final String IF_RANGE = "If-Range"; public static final String REFERER = "Referer"; diff --git a/source/de/anomic/kelondro/blob/ArrayStack.java b/source/de/anomic/kelondro/blob/ArrayStack.java index 813a6e047..b9bd33503 100755 --- a/source/de/anomic/kelondro/blob/ArrayStack.java +++ b/source/de/anomic/kelondro/blob/ArrayStack.java @@ -460,7 +460,7 @@ public class ArrayStack implements BLOB { * @throws IOException */ public synchronized CloneableIterator keys(boolean up, boolean rotating) throws IOException { - assert rotating = false; + assert rotating == false; final List> c = new ArrayList>(blobs.size()); final Iterator i = blobs.iterator(); while (i.hasNext()) { @@ -726,11 +726,10 @@ public class ArrayStack implements BLOB { FileUtils.deletedelete(f1); if (f2.renameTo(newFile)) return newFile; return f2; - } else { - FileUtils.deletedelete(f1); - FileUtils.deletedelete(f2); - return null; } + FileUtils.deletedelete(f1); + FileUtils.deletedelete(f2); + return null; } else if (!i2.hasNext()) { FileUtils.deletedelete(f2); if (f1.renameTo(newFile)) return newFile; diff --git a/source/de/anomic/kelondro/index/HandleMap.java b/source/de/anomic/kelondro/index/HandleMap.java index 0868a05bd..df7d5c823 100644 --- a/source/de/anomic/kelondro/index/HandleMap.java +++ b/source/de/anomic/kelondro/index/HandleMap.java @@ -206,12 +206,11 @@ public class HandleMap implements Iterable { newentry.setCol(1, a); index.addUnique(newentry); return 1; - } else { - long i = indexentry.getColLong(1) + a; - indexentry.setCol(1, i); - index.put(indexentry); - return i; } + long i = indexentry.getColLong(1) + a; + indexentry.setCol(1, i); + index.put(indexentry); + return i; } public synchronized long inc(final byte[] key) { diff --git a/source/de/anomic/kelondro/util/FileUtils.java b/source/de/anomic/kelondro/util/FileUtils.java index c8dcb4974..406d39d6e 100644 --- a/source/de/anomic/kelondro/util/FileUtils.java +++ b/source/de/anomic/kelondro/util/FileUtils.java @@ -264,12 +264,11 @@ public final class FileUtils { return bb; } return b; - } else { - final ByteArrayOutputStream baos = new ByteArrayOutputStream(512); - copy(source, baos, count); - baos.close(); - return baos.toByteArray(); } + final ByteArrayOutputStream baos = new ByteArrayOutputStream(512); + copy(source, baos, count); + baos.close(); + return baos.toByteArray(); } public static byte[] read(final File source) throws IOException { diff --git a/source/de/anomic/net/UPnP.java b/source/de/anomic/net/UPnP.java index c65a1ad66..83532d338 100644 --- a/source/de/anomic/net/UPnP.java +++ b/source/de/anomic/net/UPnP.java @@ -178,8 +178,6 @@ public class UPnP { } private static class Handler implements DiscoveryEventHandler { - - private final Log log = UPnP.log; public void eventSSDPAlive(String usn, String udn, String nt, String maxAge, URL location) { InternetGatewayDevice[] newIGD = { null }; diff --git a/source/de/anomic/plasma/parser/Condenser.java b/source/de/anomic/plasma/parser/Condenser.java index 68a2c665c..70c748ded 100644 --- a/source/de/anomic/plasma/parser/Condenser.java +++ b/source/de/anomic/plasma/parser/Condenser.java @@ -481,17 +481,17 @@ public final class Condenser { public final static boolean invisible(final char c) { final int type = Character.getType(c); - if( - (type == Character.LOWERCASE_LETTER) - || (type == Character.DECIMAL_DIGIT_NUMBER) - || (type == Character.UPPERCASE_LETTER) - || (type == Character.MODIFIER_LETTER) - || (type == Character.OTHER_LETTER) - || (type == Character.TITLECASE_LETTER) - || (htmlFilterContentScraper.punctuation(c))) + if ( + (type == Character.LOWERCASE_LETTER) + || (type == Character.DECIMAL_DIGIT_NUMBER) + || (type == Character.UPPERCASE_LETTER) + || (type == Character.MODIFIER_LETTER) + || (type == Character.OTHER_LETTER) + || (type == Character.TITLECASE_LETTER) + || (htmlFilterContentScraper.punctuation(c))) { return false; - else - return true; + } + return true; } public static Enumeration wordTokenizer(final String s, final String charset) { diff --git a/source/de/anomic/yacy/dht/Dispatcher.java b/source/de/anomic/yacy/dht/Dispatcher.java index 9ae739a07..9ff5871fa 100755 --- a/source/de/anomic/yacy/dht/Dispatcher.java +++ b/source/de/anomic/yacy/dht/Dispatcher.java @@ -377,11 +377,10 @@ public class Dispatcher { return null; } return chunk; - } else { - this.log.logInfo("STORE: Chunk " + new String(chunk.primaryTarget()) + " has not enough targets left. This transmission has failed, putting back index to backend"); - chunk.restore(); - return null; } + this.log.logInfo("STORE: Chunk " + new String(chunk.primaryTarget()) + " has not enough targets left. This transmission has failed, putting back index to backend"); + chunk.restore(); + return null; } public void close() {