fixed a null pointer exception problem reported in the forum.

I cant find the forum entry any more because my girlfriend switched
off the power while the forum window was open.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3039 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2006-12-01 22:36:32 +00:00
parent 83cdf056c1
commit f8efb3c948
5 changed files with 12 additions and 4 deletions

View File

@ -3,7 +3,7 @@ javacSource=1.4
javacTarget=1.4 javacTarget=1.4
# Release Configuration # Release Configuration
releaseVersion=0.487 releaseVersion=0.488
releaseFile=yacy_dev_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz releaseFile=yacy_dev_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
#releaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz #releaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
releaseDir=yacy_dev_v${releaseVersion}_${DSTAMP}_${releaseNr} releaseDir=yacy_dev_v${releaseVersion}_${DSTAMP}_${releaseNr}

View File

@ -149,6 +149,7 @@ public class indexRWIEntryNew implements Cloneable, indexRWIEntry {
} }
public indexRWIEntryNew(indexRWIEntryOld oldEntry) { public indexRWIEntryNew(indexRWIEntryOld oldEntry) {
assert oldEntry.urlHash() != null;
this.entry = urlEntryRow.newEntry(); this.entry = urlEntryRow.newEntry();
int mddlm = plasmaWordIndex.microDateDays(oldEntry.lastModified()); int mddlm = plasmaWordIndex.microDateDays(oldEntry.lastModified());
int mddct = plasmaWordIndex.microDateDays(System.currentTimeMillis()); int mddct = plasmaWordIndex.microDateDays(System.currentTimeMillis());

View File

@ -99,6 +99,7 @@ public class indexRWIEntryOld implements Cloneable, indexRWIEntry {
// more needed attributes: // more needed attributes:
// - boolean: appearance attributes: title, appears in header, anchor-descr, image-tag, hervorhebungen, meta-tags, word in link etc // - boolean: appearance attributes: title, appears in header, anchor-descr, image-tag, hervorhebungen, meta-tags, word in link etc
// - boolean: URL attributes // - boolean: URL attributes
assert (urlHash != null);
assert (urlHash.length() == 12) : "urlhash = " + urlHash; assert (urlHash.length() == 12) : "urlhash = " + urlHash;
if ((language == null) || (language.length() != urlEntryRow.width(col_language))) language = "uk"; if ((language == null) || (language.length() != urlEntryRow.width(col_language))) language = "uk";
this.entry = urlEntryRow.newEntry(); this.entry = urlEntryRow.newEntry();

View File

@ -239,8 +239,11 @@ public final class plasmaWordIndex implements indexRI {
} }
public indexContainer addEntry(String wordHash, indexRWIEntry entry, long updateTime, boolean dhtInCase) { public indexContainer addEntry(String wordHash, indexRWIEntry entry, long updateTime, boolean dhtInCase) {
if ((useCollectionIndex) && (entry instanceof indexRWIEntryOld)) entry = new indexRWIEntryNew((indexRWIEntryOld) entry); if ((useCollectionIndex) && (entry instanceof indexRWIEntryOld)) {
if (entry.urlHash() == null) return null;
entry = new indexRWIEntryNew((indexRWIEntryOld) entry);
}
// set dhtInCase depending on wordHash // set dhtInCase depending on wordHash
if ((!dhtInCase) && (yacyDHTAction.shallBeOwnWord(wordHash))) dhtInCase = true; if ((!dhtInCase) && (yacyDHTAction.shallBeOwnWord(wordHash))) dhtInCase = true;
@ -261,7 +264,9 @@ public final class plasmaWordIndex implements indexRI {
indexRWIEntryOld old; indexRWIEntryOld old;
while (i.hasNext()) { while (i.hasNext()) {
old = (indexRWIEntryOld) i.next(); old = (indexRWIEntryOld) i.next();
newentries.add(new indexRWIEntryNew(old)); if (old.urlHash() != null) {
newentries.add(new indexRWIEntryNew(old));
}
} }
return newentries; return newentries;
} }

View File

@ -553,6 +553,7 @@ public final class yacyClient {
// add the url entry to the word indexes // add the url entry to the word indexes
for (int m = 0; m < words; m++) { for (int m = 0; m < words; m++) {
if ((wordIndex.useCollectionIndex) && (entry instanceof indexRWIEntryOld)) { if ((wordIndex.useCollectionIndex) && (entry instanceof indexRWIEntryOld)) {
if (entry.urlHash() == null) continue;
entry = new indexRWIEntryNew((indexRWIEntryOld) entry); entry = new indexRWIEntryNew((indexRWIEntryOld) entry);
} }
container[m].add(new indexRWIEntry[]{entry}, System.currentTimeMillis()); container[m].add(new indexRWIEntry[]{entry}, System.currentTimeMillis());