Skip to content

Commit

Permalink
NullPointer fix
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3061 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
borg-0300 committed Dec 9, 2006
1 parent 937ccd4 commit 8b7c543
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions source/de/anomic/plasma/plasmaCrawlLURL.java
Expand Up @@ -89,13 +89,13 @@ public final class plasmaCrawlLURL {
private final LinkedList proxyResultStack; // 4 - local index: result of proxy fetch/prefetch
private final LinkedList lcrawlResultStack; // 5 - local index: result of local crawling
private final LinkedList gcrawlResultStack; // 6 - local index: triggered external

// the class object
private kelondroIndex urlIndexFile = null;
private kelondroIndex urlIndexFile;

public plasmaCrawlLURL(File indexPath, long buffer, long preloadTime) {
super();

try {
urlIndexFile = new kelondroFlexSplitTable(new File(indexPath, "PUBLIC/TEXT"), "urls", buffer, preloadTime, indexURLEntryNew.rowdef);
} catch (IOException e) {
Expand All @@ -111,43 +111,43 @@ public plasmaCrawlLURL(File indexPath, long buffer, long preloadTime) {
lcrawlResultStack = new LinkedList();
gcrawlResultStack = new LinkedList();
}

public int size() {
try {
return urlIndexFile.size() ;
} catch (IOException e) {
return 0;
}
return urlIndexFile.size();
} catch (IOException e) {
return 0;
}
}

public void close() throws IOException {
if (urlIndexFile != null) {
urlIndexFile.close();
urlIndexFile = null;
}
}

public int cacheNodeChunkSize() {
if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeChunkSize();
if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeChunkSize();
if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeChunkSize();
return 0;
}

public int[] cacheNodeStatus() {
if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheNodeStatus();
if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheNodeStatus();
if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheNodeStatus();
return new int[]{0,0,0,0,0,0,0,0,0,0};
}

public int cacheObjectChunkSize() {
if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectChunkSize();
if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectChunkSize();
if (urlIndexFile instanceof kelondroFlexTable) return ((kelondroFlexTable) urlIndexFile).cacheObjectChunkSize();
return 0;
}

public long[] cacheObjectStatus() {
if (urlIndexFile instanceof kelondroTree) return ((kelondroTree) urlIndexFile).cacheObjectStatus();
if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).cacheObjectStatus();
Expand Down Expand Up @@ -186,13 +186,13 @@ public synchronized void flushCacheSome() {
if (urlIndexFile instanceof kelondroCache) ((kelondroCache) urlIndexFile).flushSome();
} catch (IOException e) {}
}

public synchronized int writeCacheSize() {
if (urlIndexFile instanceof kelondroFlexSplitTable) return ((kelondroFlexSplitTable) urlIndexFile).writeBufferSize();
if (urlIndexFile instanceof kelondroCache) return ((kelondroCache) urlIndexFile).writeBufferSize();
return 0;
}

public synchronized indexURLEntry load(String urlHash, indexRWIEntryNew searchedWord) {
// generates an plasmaLURLEntry using the url hash
// to speed up the access, the url-hashes are buffered
Expand Down Expand Up @@ -232,9 +232,9 @@ public synchronized void store(indexURLEntry entry) throws IOException {

urlIndexFile.put(entry.toRowEntry(), entry.loaddate());
}

public synchronized indexURLEntry newEntry(String propStr) {
if (propStr.startsWith("{") && propStr.endsWith("}")) {
if (propStr != null && propStr.startsWith("{") && propStr.endsWith("}")) {
return new indexURLEntryNew(serverCodings.s2p(propStr.substring(1, propStr.length() - 1)));
} else {
return null;
Expand Down Expand Up @@ -266,7 +266,7 @@ public synchronized indexURLEntry newEntry(
return new indexURLEntryNew(url, descr, author, tags, ETag, mod, load, fresh, referrer, md5,
size, wc, dt, flags, lang, llocal, lother, laudio, limage, lvideo, lapp);
}

public synchronized int getStackSize(int stack) {
switch (stack) {
case 1: return externResultStack.size();
Expand Down Expand Up @@ -481,18 +481,18 @@ public void urldbcleanup() {
public Cleaner makeCleaner() {
return new Cleaner();
}

public class Cleaner extends Thread {

private boolean run = true;
private boolean pause = false;
private boolean pause;
public int blacklistedUrls = 0;
public int totalSearchedUrls = 1;
public String lastBlacklistedUrl = "";
public String lastBlacklistedHash = "";
public String lastUrl = "";
public String lastHash = "";

public Cleaner() {
}

Expand Down Expand Up @@ -578,8 +578,8 @@ public void endPause() {
}
}
}


public static void main(String[] args) {
// test-generation of url hashes for debugging
// one argument requires, will be treated as url
Expand Down

0 comments on commit 8b7c543

Please sign in to comment.