Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

misc bugfixes

orbiterbe6b48311c56
diff --git a/source/net/yacy/cora/protocol/http/HTTPClient.java b/source/net/yacy/cora/protocol/http/HTTPClient.java
index 09fdfcd16..b1ff81734 100644
--- a/source/net/yacy/cora/protocol/http/HTTPClient.java
+++ b/source/net/yacy/cora/protocol/http/HTTPClient.java
@@ -168,8 +168,10 @@ public class HTTPClient {
// uncompress gzip
((AbstractHttpClient) httpClient).addResponseInterceptor(new GzipResponseInterceptor());
- idledConnectionEvictor = new IdledConnectionEvictor(clientConnectionManager);
- idledConnectionEvictor.start();
+ if (idledConnectionEvictor == null) {
+ idledConnectionEvictor = new IdledConnectionEvictor(clientConnectionManager);
+ idledConnectionEvictor.start();
+ }
return httpClient;
}
diff --git a/source/net/yacy/kelondro/data/image/ImageReferenceVars.java b/source/net/yacy/kelondro/data/image/ImageReferenceVars.java
index 9945c9303..671252ca7 100644
--- a/source/net/yacy/kelondro/data/image/ImageReferenceVars.java
+++ b/source/net/yacy/kelondro/data/image/ImageReferenceVars.java
@@ -53,7 +53,7 @@ public class ImageReferenceVars extends AbstractReference implements ImageRefere
posinphrase, posofphrase,
urlcomps, urllength, virtualAge,
wordsintext, wordsintitle;
- ArrayList<Integer> positions;
+ private final ArrayList<Integer> positions;
public double termFrequency;
public ImageReferenceVars(
@@ -309,7 +309,7 @@ public class ImageReferenceVars extends AbstractReference implements ImageRefere
if (this.virtualAge > (v = other.virtualAge)) this.virtualAge = v;
if (this.wordsintext > (v = other.wordsintext)) this.wordsintext = v;
if (this.phrasesintext > (v = other.phrasesintext)) this.phrasesintext = v;
- this.positions = a(Math.min(min(this.positions), min(other.positions)));
+ if (other.positions != null) a(this.positions, Math.min(min(this.positions), min(other.positions)));
if (this.posinphrase > (v = other.posinphrase)) this.posinphrase = v;
if (this.posofphrase > (v = other.posofphrase)) this.posofphrase = v;
if (this.lastModified > (w = other.lastModified)) this.lastModified = w;
@@ -331,7 +331,7 @@ public class ImageReferenceVars extends AbstractReference implements ImageRefere
if (this.virtualAge < (v = other.virtualAge)) this.virtualAge = v;
if (this.wordsintext < (v = other.wordsintext)) this.wordsintext = v;
if (this.phrasesintext < (v = other.phrasesintext)) this.phrasesintext = v;
- this.positions = a(Math.max(max(this.positions), max(other.positions)));
+ if (other.positions != null) a(this.positions, Math.max(max(this.positions), max(other.positions)));
if (this.posinphrase < (v = other.posinphrase)) this.posinphrase = v;
if (this.posofphrase < (v = other.posofphrase)) this.posofphrase = v;
if (this.lastModified < (w = other.lastModified)) this.lastModified = w;
diff --git a/source/net/yacy/kelondro/data/word/WordReferenceVars.java b/source/net/yacy/kelondro/data/word/WordReferenceVars.java
index 207cf0a96..a9f14f2f0 100644
--- a/source/net/yacy/kelondro/data/word/WordReferenceVars.java
+++ b/source/net/yacy/kelondro/data/word/WordReferenceVars.java
@@ -60,7 +60,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferenc
posinphrase, posofphrase,
urlcomps, urllength, virtualAge,
wordsintext, wordsintitle;
- ArrayList<Integer> positions;
+ private final ArrayList<Integer> positions;
public double termFrequency;
public WordReferenceVars(
@@ -317,7 +317,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferenc
if (this.virtualAge > (v = other.virtualAge)) this.virtualAge = v;
if (this.wordsintext > (v = other.wordsintext)) this.wordsintext = v;
if (this.phrasesintext > (v = other.phrasesintext)) this.phrasesintext = v;
- this.positions = this.positions == null ? other.positions : other.positions == null ? this.positions : a(Math.min(min(this.positions), min(other.positions)));
+ if (other.positions != null) a(this.positions, Math.min(min(this.positions), min(other.positions)));
if (this.posinphrase > (v = other.posinphrase)) this.posinphrase = v;
if (this.posofphrase > (v = other.posofphrase)) this.posofphrase = v;
if (this.lastModified > (w = other.lastModified)) this.lastModified = w;
@@ -339,7 +339,7 @@ public class WordReferenceVars extends AbstractReference implements WordReferenc
if (this.virtualAge < (v = other.virtualAge)) this.virtualAge = v;
if (this.wordsintext < (v = other.wordsintext)) this.wordsintext = v;
if (this.phrasesintext < (v = other.phrasesintext)) this.phrasesintext = v;
- this.positions = this.positions == null ? other.positions : other.positions == null ? this.positions : a(Math.max(max(this.positions), max(other.positions)));
+ if (other.positions != null) a(this.positions, Math.max(max(this.positions), max(other.positions)));
if (this.posinphrase < (v = other.posinphrase)) this.posinphrase = v;
if (this.posofphrase < (v = other.posofphrase)) this.posofphrase = v;
if (this.lastModified < (w = other.lastModified)) this.lastModified = w;
diff --git a/source/net/yacy/kelondro/rwi/AbstractReference.java b/source/net/yacy/kelondro/rwi/AbstractReference.java
index 70b601a11..8c2ab30ba 100644
--- a/source/net/yacy/kelondro/rwi/AbstractReference.java
+++ b/source/net/yacy/kelondro/rwi/AbstractReference.java
@@ -31,12 +31,13 @@ import java.util.ArrayList;
public abstract class AbstractReference implements Reference {
- protected static ArrayList<Integer> a(int i) {
- ArrayList<Integer> l = new ArrayList<Integer>(1);
- l.add(i);
- return l;
+ protected static void a(ArrayList<Integer> a, int i) {
+ assert a != null;
+ a.clear();
+ a.add(i);
}
protected static int max(ArrayList<Integer> a) {
+ assert a != null;
assert !a.isEmpty();
if (a.size() == 1) return a.get(0);
if (a.size() == 2) return Math.max(a.get(0), a.get(1));
@@ -45,6 +46,7 @@ public abstract class AbstractReference implements Reference {
return r;
}
protected static int min(ArrayList<Integer> a) {
+ assert a != null;
assert !a.isEmpty();
if (a.size() == 1) return a.get(0);
if (a.size() == 2) return Math.min(a.get(0), a.get(1));