some fixes recommended by findbugs

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5618 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 4db80065ac
commit 6b450d09ca

@ -77,7 +77,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.zip.GZIPOutputStream;
@ -608,9 +607,8 @@ public final class httpdFileHandler {
}
// add values from request header to environment (see: http://hoohoo.ncsa.uiuc.edu/cgi/env.html#headers)
Set<String> requestHeaderKeys = requestHeader.keySet();
for (String requestHeaderKey : requestHeaderKeys) {
env.put("HTTP_" + requestHeaderKey.toUpperCase().replace("-", "_"), requestHeader.get(requestHeaderKey));
for (Map.Entry<String, String> requestHeaderEntry : requestHeader.entrySet()) {
env.put("HTTP_" + requestHeaderEntry.getKey().toUpperCase().replace("-", "_"), requestHeaderEntry.getValue());
}
int exitValue = 0;

@ -81,6 +81,7 @@ public class BytesLongMap {
if (c <= 0) break;
this.index.addUnique(this.rowdef.newEntry(a));
}
is.close();
assert this.index.size() == file.length() / (keylength + 8);
}

@ -49,7 +49,7 @@ public class RAMIndex implements ObjectIndex {
reset(0);
}
public void reset(final int initialspace) {
public synchronized void reset(final int initialspace) {
this.index0 = null; // first flush RAM to make room
this.index0 = new RowSet(rowdef, initialspace);
this.index1 = null; // to show that this is the initialization phase
@ -77,7 +77,7 @@ public class RAMIndex implements ObjectIndex {
return index1.get(key);
}
public boolean has(final byte[] key) {
public synchronized boolean has(final byte[] key) {
assert (key != null);
finishInitialization();
assert index0.isSorted();

@ -255,7 +255,13 @@ public final class FileUtils {
public static byte[] read(final InputStream source, final int count) throws IOException {
if (count > 0) {
byte[] b = new byte[count];
source.read(b, 0, count);
int c = source.read(b, 0, count);
assert c == count: "count = " + count + ", c = " + c;
if (c != count) {
byte[] bb = new byte[c];
System.arraycopy(b, 0, bb, 0, c);
return bb;
}
return b;
} else {
final ByteArrayOutputStream baos = new ByteArrayOutputStream(512);

@ -44,7 +44,7 @@ public final class ScoreCluster<E> {
encnt = 0;
}
public void clear() {
public synchronized void clear() {
refkeyDB.clear();
keyrefDB.clear();
gcount = 0;

Loading…
Cancel
Save