Skip to content

Commit

Permalink
some fixes recommended by findbugs
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5618 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Feb 16, 2009
1 parent 4db8006 commit 6b450d0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
6 changes: 2 additions & 4 deletions source/de/anomic/http/httpdFileHandler.java
Expand Up @@ -77,7 +77,6 @@ public static java.util.Hashtable respond(java.util.HashMap, serverSwitch)
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;

Expand Down Expand Up @@ -608,9 +607,8 @@ public static void doResponse(final Properties conProp, final httpRequestHeader
}

// 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;
Expand Down
1 change: 1 addition & 0 deletions source/de/anomic/kelondro/index/BytesLongMap.java
Expand Up @@ -81,6 +81,7 @@ public BytesLongMap(final int keylength, final ByteOrder objectOrder, final File
if (c <= 0) break;
this.index.addUnique(this.rowdef.newEntry(a));
}
is.close();
assert this.index.size() == file.length() / (keylength + 8);
}

Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/kelondro/index/RAMIndex.java
Expand Up @@ -49,7 +49,7 @@ public void clear() {
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
Expand Down Expand Up @@ -77,7 +77,7 @@ public synchronized Row.Entry get(final byte[] key) {
return index1.get(key);
}

public boolean has(final byte[] key) {
public synchronized boolean has(final byte[] key) {
assert (key != null);
finishInitialization();
assert index0.isSorted();
Expand Down
8 changes: 7 additions & 1 deletion source/de/anomic/kelondro/util/FileUtils.java
Expand Up @@ -255,7 +255,13 @@ public static byte[] read(final InputStream source) throws IOException {
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);
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/kelondro/util/ScoreCluster.java
Expand Up @@ -44,7 +44,7 @@ public ScoreCluster() {
encnt = 0;
}

public void clear() {
public synchronized void clear() {
refkeyDB.clear();
keyrefDB.clear();
gcount = 0;
Expand Down

0 comments on commit 6b450d0

Please sign in to comment.