fixed a NPE which may appear for freeworld peers without any rwi index

data. This the NPE looked like:
Caused by: java.lang.NullPointerException
	at net.yacy.search.query.SearchEvent.<init>(SearchEvent.java:279)
	at
net.yacy.search.query.SearchEventCache.getEvent(SearchEventCache.java:155)
	at search.respond(search.java:314)
	... 12 more
pull/1/head
Michael Peter Christen 12 years ago
parent 4faa07c214
commit db49e91724

@ -276,29 +276,24 @@ public final class SearchEvent {
long mindhtdistance = Long.MAX_VALUE, l;
byte[] wordhash;
assert this.rankingProcess.searchContainerMap() != null;
for ( final Map.Entry<byte[], ReferenceContainer<WordReference>> entry : this.rankingProcess
.searchContainerMap()
.entrySet() ) {
wordhash = entry.getKey();
final ReferenceContainer<WordReference> container = entry.getValue();
assert (Base64Order.enhancedCoder.equal(container.getTermHash(), wordhash)) : "container.getTermHash() = "
+ ASCII.String(container.getTermHash())
+ ", wordhash = "
+ ASCII.String(wordhash);
if ( container.size() > maxcount ) {
this.IAmaxcounthash = wordhash;
maxcount = container.size();
}
l = Distribution.horizontalDHTDistance(wordhash, ASCII.getBytes(peers.mySeed().hash));
if ( l < mindhtdistance ) {
// calculate the word hash that is closest to our dht position
mindhtdistance = l;
this.IAneardhthash = wordhash;
if (this.rankingProcess.searchContainerMap() != null) {
for (final Map.Entry<byte[], ReferenceContainer<WordReference>> entry : this.rankingProcess.searchContainerMap().entrySet()) {
wordhash = entry.getKey();
final ReferenceContainer<WordReference> container = entry.getValue();
assert (Base64Order.enhancedCoder.equal(container.getTermHash(), wordhash)) : "container.getTermHash() = " + ASCII.String(container.getTermHash()) + ", wordhash = " + ASCII.String(wordhash);
if ( container.size() > maxcount ) {
this.IAmaxcounthash = wordhash;
maxcount = container.size();
}
l = Distribution.horizontalDHTDistance(wordhash, ASCII.getBytes(peers.mySeed().hash));
if ( l < mindhtdistance ) {
// calculate the word hash that is closest to our dht position
mindhtdistance = l;
this.IAneardhthash = wordhash;
}
this.IACount.put(wordhash, LargeNumberCache.valueOf(container.size()));
this.IAResults.put(wordhash, WordReferenceFactory.compressIndex(container, null, 1000).toString());
}
this.IACount.put(wordhash, LargeNumberCache.valueOf(container.size()));
this.IAResults.put(wordhash, WordReferenceFactory
.compressIndex(container, null, 1000)
.toString());
}
EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.EventSearch(this.query.id(true), SearchEventType.ABSTRACTS, "", this.rankingProcess.searchContainerMap().size(), System.currentTimeMillis() - timer), false);
} else {
@ -500,7 +495,9 @@ public final class SearchEvent {
ReversibleScoreMap<String> fcts;
if (this.hostNavigator != null) {
fcts = facets.get(YaCySchema.host_s.getSolrFieldName());
if (fcts != null) this.hostNavigator.inc(fcts);
if (fcts != null) {
this.hostNavigator.inc(fcts);
}
}
if (this.filetypeNavigator != null) {
@ -511,7 +508,7 @@ public final class SearchEvent {
while (i.hasNext()) {
String ext = i.next();
if (TextParser.supportsExtension(ext) != null && !Classification.isAnyKnownExtension(ext)) {
//Log.logInfo("SearchEvent", "removed unknown externsion " + ext + " from navigation.");
//Log.logInfo("SearchEvent", "removed unknown extension " + ext + " from navigation.");
i.remove();
}
}

Loading…
Cancel
Save