moved printStackTrace() to logging

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@539 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 8e2a6059de
commit ba0a486328

@ -53,6 +53,7 @@ import de.anomic.plasma.plasmaCrawlProfile;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacyCore;
public class ProxyIndexingMonitor_p {
@ -102,8 +103,7 @@ public class ProxyIndexingMonitor_p {
} catch (Exception e) {
prop.put("info", 2); //Error: errmsg
prop.put("info_error", e.getMessage());
System.out.println("Case3");
e.printStackTrace();
serverLog.logError("SERVLET", "ProxyIndexingMonitor.case3", e);
}
}

@ -63,6 +63,7 @@ import de.anomic.server.serverCore;
import de.anomic.server.serverFileUtils;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacySeed;
@ -470,8 +471,7 @@ public class dir {
switchboard.removeReferences(urlhash, words);
switchboard.urlPool.loadedURL.remove(urlhash);
} catch (Exception e) {
System.out.println("INTERNAL ERROR in dir.deletePhrase:");
e.printStackTrace();
serverLog.logError("DIR", "INTERNAL ERROR in dir.deletePhrase", e);
}
}
}

@ -1038,8 +1038,7 @@ do upload
try {
return wput(url, 5000, null, null, null, 0, props);
} catch (IOException e) {
serverLog.logError("HTTPC", "wput exception for URL " + url + ": " + e.getMessage());
e.printStackTrace();
serverLog.logError("HTTPC", "wput exception for URL " + url + ": " + e.getMessage(), e);
Vector ll = new Vector();
ll.add("503 " + e.getMessage());
return ll;

@ -312,7 +312,7 @@ public class plasmaCrawlLURL extends plasmaURL {
dark = !dark;
c++;
} catch (Exception e) {
e.printStackTrace();
serverLog.logError("PLASMA", "genTableProps", e);
}
}
prop.put("table_indexed", c);
@ -385,8 +385,7 @@ public class plasmaCrawlLURL extends plasmaURL {
return;
}
} catch (Exception e) {
System.out.println("INTERNAL ERROR in plasmaLURL.entry/1: " + e.toString());
e.printStackTrace();
serverLog.logError("PLASMA", "INTERNAL ERROR in plasmaLURL.entry/1: " + e.toString(), e);
}
}
@ -418,8 +417,7 @@ public class plasmaCrawlLURL extends plasmaURL {
store();
//}
} catch (Exception e) {
System.out.println("INTERNAL ERROR in plasmaLURL.entry/2: " + e.toString());
e.printStackTrace();
serverLog.logError("PLASMA", "INTERNAL ERROR in plasmaLURL.entry/2: " + e.toString(), e);
}
}
@ -448,8 +446,7 @@ public class plasmaCrawlLURL extends plasmaURL {
};
urlHashCache.put(entry);
} catch (Exception e) {
System.out.println("INTERNAL ERROR AT plasmaCrawlLURL:store:" + e.toString());
e.printStackTrace();
serverLog.logError("PLASMA", "INTERNAL ERROR AT plasmaCrawlLURL:store:" + e.toString(), e);
}
}

@ -161,7 +161,7 @@ public final class plasmaCrawlLoader extends Thread {
this.stopped = true;
}
catch (Exception e) {
e.printStackTrace();
this.log.logError("plasmaCrawlLoader.run/loop", e);
}
}
@ -174,7 +174,7 @@ public final class plasmaCrawlLoader extends Thread {
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
this.log.logError("plasmaCrawlLoader.run/close", e);
}
}
@ -198,7 +198,7 @@ public final class plasmaCrawlLoader extends Thread {
this.theQueue.addMessage(theMsg);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
this.log.logError("plasmaCrawlLoader.loadParallel", e);
}
}
}

@ -52,6 +52,7 @@ import de.anomic.kelondro.kelondroDyn;
import de.anomic.kelondro.kelondroException;
import de.anomic.kelondro.kelondroMap;
import de.anomic.server.serverCodings;
import de.anomic.server.logging.serverLog;
public class plasmaCrawlProfile {
@ -78,7 +79,7 @@ public class plasmaCrawlProfile {
profileTableFile.getParentFile().mkdirs();
profileTable = new kelondroMap(new kelondroDyn(profileTableFile, 32000, plasmaURL.urlCrawlProfileHandleLength, 2000));
} catch (IOException e){
e.printStackTrace();
serverLog.logError("PLASMA", "plasmaCrawlProfile.resetDatabase", e);
}
}

@ -192,7 +192,7 @@ public final class plasmaCrawlWorker extends Thread {
this.setName(this.threadBaseName + "_inPool");
}
catch (Exception e1) {
e1.printStackTrace();
log.logError("pool error", e1);
}
}
}

@ -354,7 +354,7 @@ public final class plasmaParser {
newEnabledParsers.put(mimeType,availableParserList.get(mimeType));
} catch (Exception e) {
e.printStackTrace();
serverLog.logError("PARSER", "error in setEnabledParserList", e);
} finally {
if (theParser != null)
try { plasmaParser.theParserPool.returnObject(mimeType,theParser); } catch (Exception e) {}

@ -313,8 +313,7 @@ public final class plasmaSearch {
acc.addResult(entry);
}
} catch (kelondroException ee) {
serverLog.logError("PLASMA", "Database Failure during plasmaSearch.order: " + ee.getMessage());
ee.printStackTrace();
serverLog.logError("PLASMA", "Database Failure during plasmaSearch.order: " + ee.getMessage(), ee);
}
long startSortTime = System.currentTimeMillis();
acc.sortResults();

@ -203,103 +203,103 @@ public class plasmaSnippetCache {
private String computeSnippet(String[] sentences, Set queryhashes, int minLength, int maxLength) {
try {
if ((sentences == null) || (sentences.length == 0)) return null;
if ((queryhashes == null) || (queryhashes.size() == 0)) return null;
kelondroMScoreCluster hitTable = new kelondroMScoreCluster();
Iterator j;
HashMap hs;
String hash;
for (int i = 0; i < sentences.length; i++) {
//System.out.println("Sentence " + i + ": " + sentences[i]);
if (sentences[i].length() > minLength) {
hs = hashSentence(sentences[i]);
j = queryhashes.iterator();
while (j.hasNext()) {
hash = (String) j.next();
if (hs.containsKey(hash)) {
//System.out.println("hash " + hash + " appears in line " + i);
hitTable.incScore(new Integer(i));
if ((sentences == null) || (sentences.length == 0)) return null;
if ((queryhashes == null) || (queryhashes.size() == 0)) return null;
kelondroMScoreCluster hitTable = new kelondroMScoreCluster();
Iterator j;
HashMap hs;
String hash;
for (int i = 0; i < sentences.length; i++) {
//System.out.println("Sentence " + i + ": " + sentences[i]);
if (sentences[i].length() > minLength) {
hs = hashSentence(sentences[i]);
j = queryhashes.iterator();
while (j.hasNext()) {
hash = (String) j.next();
if (hs.containsKey(hash)) {
//System.out.println("hash " + hash + " appears in line " + i);
hitTable.incScore(new Integer(i));
}
}
}
}
}
int score = hitTable.getMaxScore(); // best number of hits
if (score <= 0) return null;
// we found (a) line(s) that have <score> hits.
// now find the shortest line of these hits
int shortLineIndex = -1;
int shortLineLength = Integer.MAX_VALUE;
for (int i = 0; i < sentences.length; i++) {
if ((hitTable.getScore(new Integer(i)) == score) &&
int score = hitTable.getMaxScore(); // best number of hits
if (score <= 0) return null;
// we found (a) line(s) that have <score> hits.
// now find the shortest line of these hits
int shortLineIndex = -1;
int shortLineLength = Integer.MAX_VALUE;
for (int i = 0; i < sentences.length; i++) {
if ((hitTable.getScore(new Integer(i)) == score) &&
(sentences[i].length() < shortLineLength)) {
shortLineIndex = i;
shortLineLength = sentences[i].length();
shortLineIndex = i;
shortLineLength = sentences[i].length();
}
}
}
// find a first result
String result = sentences[shortLineIndex];
// remove all hashes that appear in the result
hs = hashSentence(result);
j = queryhashes.iterator();
Integer pos;
Set remaininghashes = new HashSet();
int p, minpos = result.length(), maxpos = -1;
while (j.hasNext()) {
hash = (String) j.next();
pos = (Integer) hs.get(hash);
if (pos == null) {
remaininghashes.add(new String(hash));
} else {
p = pos.intValue();
if (p > maxpos) maxpos = p;
if (p < minpos) minpos = p;
// find a first result
String result = sentences[shortLineIndex];
// remove all hashes that appear in the result
hs = hashSentence(result);
j = queryhashes.iterator();
Integer pos;
Set remaininghashes = new HashSet();
int p, minpos = result.length(), maxpos = -1;
while (j.hasNext()) {
hash = (String) j.next();
pos = (Integer) hs.get(hash);
if (pos == null) {
remaininghashes.add(new String(hash));
} else {
p = pos.intValue();
if (p > maxpos) maxpos = p;
if (p < minpos) minpos = p;
}
}
}
// check result size
maxpos = maxpos + 10;
if (maxpos > result.length()) maxpos = result.length();
if (minpos < 0) minpos = 0;
// we have a result, but is it short enough?
if (maxpos - minpos + 10 > maxLength) {
// the string is too long, even if we cut at both ends
// so cut here in the middle of the string
int lenb = result.length();
result = result.substring(0, (minpos + 20 > result.length()) ? result.length() : minpos + 20).trim() +
" [..] " +
result.substring((maxpos + 26 > result.length()) ? result.length() : maxpos + 26).trim();
maxpos = maxpos + lenb - result.length() + 6;
}
if (maxpos > maxLength) {
// the string is too long, even if we cut it at the end
// so cut it here at both ends at once
int newlen = maxpos - minpos + 10;
int around = (maxLength - newlen) / 2;
result = "[..] " + result.substring(minpos - around, ((maxpos + around) > result.length()) ? result.length() : (maxpos + around)).trim() + " [..]";
minpos = around;
maxpos = result.length() - around - 5;
}
if (result.length() > maxLength) {
// trim result, 1st step (cut at right side)
result = result.substring(0, maxpos).trim() + " [..]";
}
if (result.length() > maxLength) {
// trim result, 2nd step (cut at left side)
result = "[..] " + result.substring(minpos).trim();
}
if (result.length() > maxLength) {
// trim result, 3rd step (cut in the middle)
result = result.substring(6, 20).trim() + " [..] " + result.substring(result.length() - 26, result.length() - 6).trim();
}
if (queryhashes.size() == 0) return result;
// the result has not all words in it.
// find another sentence that represents the missing other words
// and find recursively more sentences
maxLength = maxLength - result.length();
if (maxLength < 20) maxLength = 20;
String nextSnippet = computeSnippet(sentences, remaininghashes, minLength, maxLength);
return result + ((nextSnippet == null) ? "" : (" / " + nextSnippet));
// check result size
maxpos = maxpos + 10;
if (maxpos > result.length()) maxpos = result.length();
if (minpos < 0) minpos = 0;
// we have a result, but is it short enough?
if (maxpos - minpos + 10 > maxLength) {
// the string is too long, even if we cut at both ends
// so cut here in the middle of the string
int lenb = result.length();
result = result.substring(0, (minpos + 20 > result.length()) ? result.length() : minpos + 20).trim() +
" [..] " +
result.substring((maxpos + 26 > result.length()) ? result.length() : maxpos + 26).trim();
maxpos = maxpos + lenb - result.length() + 6;
}
if (maxpos > maxLength) {
// the string is too long, even if we cut it at the end
// so cut it here at both ends at once
int newlen = maxpos - minpos + 10;
int around = (maxLength - newlen) / 2;
result = "[..] " + result.substring(minpos - around, ((maxpos + around) > result.length()) ? result.length() : (maxpos + around)).trim() + " [..]";
minpos = around;
maxpos = result.length() - around - 5;
}
if (result.length() > maxLength) {
// trim result, 1st step (cut at right side)
result = result.substring(0, maxpos).trim() + " [..]";
}
if (result.length() > maxLength) {
// trim result, 2nd step (cut at left side)
result = "[..] " + result.substring(minpos).trim();
}
if (result.length() > maxLength) {
// trim result, 3rd step (cut in the middle)
result = result.substring(6, 20).trim() + " [..] " + result.substring(result.length() - 26, result.length() - 6).trim();
}
if (queryhashes.size() == 0) return result;
// the result has not all words in it.
// find another sentence that represents the missing other words
// and find recursively more sentences
maxLength = maxLength - result.length();
if (maxLength < 20) maxLength = 20;
String nextSnippet = computeSnippet(sentences, remaininghashes, minLength, maxLength);
return result + ((nextSnippet == null) ? "" : (" / " + nextSnippet));
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
log.logError("computeSnippet: error with string generation", e);
return "";
}
}

@ -568,8 +568,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
try {
sbQueue.push((plasmaSwitchboardQueue.Entry) job);
} catch (IOException e) {
log.logError("IOError in plasmaSwitchboard.enQueue: " + e.getMessage());
e.printStackTrace();
log.logError("IOError in plasmaSwitchboard.enQueue: " + e.getMessage(), e);
}
}
@ -595,8 +594,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
try {
nextentry = sbQueue.pop();
} catch (IOException e) {
log.logError("IOError in plasmaSwitchboard.deQueue: " + e.getMessage());
e.printStackTrace();
log.logError("IOError in plasmaSwitchboard.deQueue: " + e.getMessage(), e);
return false;
}
}
@ -1013,8 +1011,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
log.logDebug("Not Indexed Resource '" + entry.normalizedURLString() + "': process case=" + processCase);
}
} catch (Exception ee) {
log.logError("Could not index URL " + entry.url() + ": " + ee.getMessage());
ee.printStackTrace();
log.logError("Could not index URL " + entry.url() + ": " + ee.getMessage(), ee);
if ((processCase == 6) && (initiator != null)) {
yacyClient.crawlReceipt(initiator, "crawl", "exception", ee.getMessage(), null, "");
}
@ -1225,8 +1222,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
} catch (Exception e) {
// wrong values
log.logError("REMOTECRAWLTRIGGER: REMOTE CRAWL TO PEER " + remoteSeed.getName() + " FAILED. CLIENT RETURNED: " + page.toString());
e.printStackTrace();
log.logError("REMOTECRAWLTRIGGER: REMOTE CRAWL TO PEER " + remoteSeed.getName() + " FAILED. CLIENT RETURNED: " + page.toString(), e);
return false;
}
}
@ -1263,7 +1259,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// take some elements and fetch the snippets
snippetCache.fetch(acc, queryhashes, urlmask, fetchcount);
} catch (IOException e) {
e.printStackTrace();
log.logError("presearch: failed", e);
}
log.logDebug("presearch: job terminated");
}

@ -52,6 +52,7 @@ import de.anomic.http.httpHeader;
import de.anomic.kelondro.kelondroStack;
import de.anomic.server.serverCodings;
import de.anomic.server.serverDate;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacySeedDB;
public class plasmaSwitchboardQueue {
@ -224,7 +225,7 @@ public class plasmaSwitchboardQueue {
if (responseHeader == null) try {
responseHeader = htCache.getCachedResponse(plasmaURL.urlHash(url));
} catch (IOException e) {
e.printStackTrace();
serverLog.logError("PLASMA", "responseHeader: failed to get header", e);
return null;
}
return responseHeader;

@ -111,20 +111,18 @@ public final class plasmaWordIndexAssortment {
try {
assortments = new kelondroTree(assortmentFile, bufferSize);
if (log != null) log.logSystem("Opened Assortment Database, " + assortments.size() + " entries, width " + assortmentLength + ", " + bufferkb + "kb buffer");
return;
} catch (IOException e){
if (log != null) log.logError("unable to open assortment database: " + e.getMessage());
e.printStackTrace();
}
} else {
// create new assortment tree file
try {
assortments = new kelondroTree(assortmentFile, bufferSize, bufferStructure(assortmentLength));
if (log != null) log.logSystem("Created new Assortment Database, width " + assortmentLength + ", " + bufferkb + "kb buffer");
} catch (IOException e){
if (log != null) log.logError("unable to create assortment database: " + e.getMessage());
e.printStackTrace();
if (log != null) log.logError("unable to open assortment database, creating new: " + e.getMessage(), e);
}
}
// create new assortment tree file
try {
assortments = new kelondroTree(assortmentFile, bufferSize, bufferStructure(assortmentLength));
if (log != null) log.logSystem("Created new Assortment Database, width " + assortmentLength + ", " + bufferkb + "kb buffer");
} catch (IOException e){
if (log != null) log.logError("unable to create assortment database: " + e.getMessage(), e);
}
}
public void store(String wordHash, plasmaWordIndexEntryContainer newContainer) {
@ -147,12 +145,10 @@ public final class plasmaWordIndexAssortment {
try {
oldrow = assortments.put(row);
} catch (IOException e) {
log.logFailure("storeAssortment/IO-error: " + e.getMessage() + " - reset assortment-DB");
e.printStackTrace();
log.logFailure("storeAssortment/IO-error: " + e.getMessage() + " - reset assortment-DB", e);
resetDatabase();
} catch (kelondroException e) {
log.logFailure("storeAssortment/kelondro-error: " + e.getMessage() + " - reset assortment-DB");
e.printStackTrace();
log.logFailure("storeAssortment/kelondro-error: " + e.getMessage() + " - reset assortment-DB", e);
resetDatabase();
}
if (oldrow != null) throw new RuntimeException("Store to assortment ambiguous");
@ -165,13 +161,11 @@ public final class plasmaWordIndexAssortment {
try {
row = assortments.remove(wordHash.getBytes());
} catch (IOException e) {
log.logFailure("removeAssortment/IO-error: " + e.getMessage() + " - reset assortment-DB");
e.printStackTrace();
log.logFailure("removeAssortment/IO-error: " + e.getMessage() + " - reset assortment-DB", e);
resetDatabase();
return null;
} catch (kelondroException e) {
log.logFailure("removeAssortment/kelondro-error: " + e.getMessage() + " - reset assortment-DB");
e.printStackTrace();
log.logFailure("removeAssortment/kelondro-error: " + e.getMessage() + " - reset assortment-DB", e);
resetDatabase();
return null;
}
@ -194,8 +188,7 @@ public final class plasmaWordIndexAssortment {
try {
assortments = new kelondroTree(assortmentFile, bufferSize, bufferStructure(assortmentLength));
} catch (IOException e){
log.logError("unable to re-create assortment database: " + e.getMessage());
e.printStackTrace();
log.logError("unable to re-create assortment database: " + e.getMessage(), e);
}
}
@ -203,13 +196,11 @@ public final class plasmaWordIndexAssortment {
try {
return assortments.keys(up, rot, startWordHash.getBytes());
} catch (IOException e) {
log.logFailure("iterateAssortment/IO-error: " + e.getMessage() + " - reset assortment-DB");
e.printStackTrace();
log.logFailure("iterateAssortment/IO-error: " + e.getMessage() + " - reset assortment-DB", e);
resetDatabase();
return null;
} catch (kelondroException e) {
log.logFailure("iterateAssortment/kelondro-error: " + e.getMessage() + " - reset assortment-DB");
e.printStackTrace();
log.logFailure("iterateAssortment/kelondro-error: " + e.getMessage() + " - reset assortment-DB", e);
resetDatabase();
return null;
}
@ -223,8 +214,7 @@ public final class plasmaWordIndexAssortment {
try {
assortments.close();
} catch (IOException e){
log.logError("unable to close assortment database: " + e.getMessage());
e.printStackTrace();
log.logError("unable to close assortment database: " + e.getMessage(), e);
}
}

@ -64,7 +64,6 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
// environment constants
private static final String indexArrayFileName = "indexDump1.array";
private static final String indexStackFileName = "indexDump0.stack";
private static final String oldSingletonFileName = "indexSingletons0.db";
private static final String newSingletonFileName = "indexAssortment001.db";
private static final String indexAssortmentClusterPath = "ACLUSTER";
@ -128,8 +127,7 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
try {
restore();
} catch (IOException e){
log.logError("unable to restore cache dump: " + e.getMessage());
e.printStackTrace();
log.logError("unable to restore cache dump: " + e.getMessage(), e);
}
// start permanent flushing
@ -190,13 +188,6 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
}
private long restore() throws IOException {
if ((new File(databaseRoot, indexArrayFileName)).exists())
return restoreArray();
else
return restoreStack();
}
private long restoreArray() throws IOException {
File indexDumpFile = new File(databaseRoot, indexArrayFileName);
if (!(indexDumpFile.exists())) return 0;
kelondroArray dumpArray = new kelondroArray(indexDumpFile);
@ -239,60 +230,8 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
log.logSystem("restored " + cache.size() + " words in " + ((System.currentTimeMillis() - startTime) / 1000) + " seconds");
} catch (kelondroException e) {
// restore failed
log.logError("restore of indexCache array dump failed: " + e.getMessage());
e.printStackTrace();
}
return urlCount;
}
private long restoreStack() throws IOException {
File indexDumpFile = new File(databaseRoot, indexStackFileName);
if (!(indexDumpFile.exists())) return 0;
kelondroStack dumpStack = new kelondroStack(indexDumpFile, 1024);
log.logSystem("restore stack dump of index cache, " + dumpStack.size() + " word/url relations");
long startTime = System.currentTimeMillis();
long messageTime = System.currentTimeMillis() + 5000;
long urlCount = 0, urlsPerSecond = 0;
try {
synchronized (cache) {
Iterator i = dumpStack.iterator();
kelondroRecords.Node node;
String wordHash;
plasmaWordIndexEntryContainer container;
long creationTime;
plasmaWordIndexEntry wordEntry;
byte[][] row;
Runtime rt = Runtime.getRuntime();
while (i.hasNext()) {
// get out one entry
node = (kelondroRecords.Node) i.next();
row = node.getValues();
wordHash = new String(row[0]);
creationTime = kelondroRecords.bytes2long(row[2]);
wordEntry = new plasmaWordIndexEntry(new String(row[3]), new String(row[4]));
// store to cache
addEntry(wordHash, wordEntry, creationTime);
urlCount++;
// protect against memory shortage
while (rt.freeMemory() < 1000000) {flushFromMem(); java.lang.System.gc();}
// write a log
if (System.currentTimeMillis() > messageTime) {
System.gc(); // for better statistic
urlsPerSecond = 1 + urlCount * 1000 / (1 + System.currentTimeMillis() - startTime);
log.logInfo("restoring status: " + urlCount + " urls done, " + ((dumpStack.size() - urlCount) / urlsPerSecond) + " seconds remaining, free mem = " + (Runtime.getRuntime().freeMemory() / 1024 / 1024) + "MB");
messageTime = System.currentTimeMillis() + 5000;
}
}
}
dumpStack.close();
log.logSystem("restored " + cache.size() + " words in " + ((System.currentTimeMillis() - startTime) / 1000) + " seconds");
} catch (kelondroException e) {
// restore failed
log.logError("restore of indexCache dump failed: " + e.getMessage());
e.printStackTrace();
log.logError("restore of indexCache array dump failed: " + e.getMessage(), e);
}
indexDumpFile.delete();
return urlCount;
}
@ -412,8 +351,7 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
flushFromMem(hash);
}
} catch (Exception e) {
log.logError("flushFromMem: " + e.getMessage());
e.printStackTrace();
log.logError("flushFromMem: " + e.getMessage(), e);
}
flushThread.proceed();
}
@ -574,8 +512,7 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
try {
dump(waitingSeconds);
} catch (IOException e){
log.logError("unable to dump cache: " + e.getMessage());
e.printStackTrace();
log.logError("unable to dump cache: " + e.getMessage(), e);
}
}

@ -171,8 +171,7 @@ public class plasmaWordIndexClassicCacheMigration {
remove(hash);
return true;
} catch (Exception e) {
serverLog.logError("PLASMA MIGRATION", "oneStepMigration error: " + e.getMessage());
e.printStackTrace();
serverLog.logError("PLASMA MIGRATION", "oneStepMigration error: " + e.getMessage(), e);
return false;
}
}

@ -193,8 +193,7 @@ public class plasmaWordIndexDistribution {
return -1;
}
} catch (IOException ee) {
log.logError("Deletion of indexes not possible:" + ee.getMessage());
ee.printStackTrace();
log.logError("Deletion of indexes not possible:" + ee.getMessage(), ee);
return -1;
}
} else {
@ -271,8 +270,7 @@ public class plasmaWordIndexDistribution {
log.logDebug("Selected whole index (" + indexEntity.size() + " URLs, " + unknownURLEntries.size() + " not bound) for word " + indexEntity.wordHash());
count -= indexEntity.size();
} catch (kelondroException e) {
log.logError("plasmaWordIndexDistribution/1: deleted DB for word " + indexEntity.wordHash());
e.printStackTrace();
log.logError("plasmaWordIndexDistribution/1: deleted DB for word " + indexEntity.wordHash(), e);
try {indexEntity.deleteComplete();} catch (IOException ee) {}
}
} else {
@ -306,8 +304,7 @@ public class plasmaWordIndexDistribution {
log.logDebug("Selected partial index (" + tmpEntity.size() + " from " + indexEntity.size() +" URLs, " + unknownURLEntries.size() + " not bound) for word " + tmpEntity.wordHash());
tmpEntities.add(tmpEntity);
} catch (kelondroException e) {
log.logError("plasmaWordIndexDistribution/2: deleted DB for word " + indexEntity.wordHash());
e.printStackTrace();
log.logError("plasmaWordIndexDistribution/2: deleted DB for word " + indexEntity.wordHash(), e);
try {indexEntity.deleteComplete();} catch (IOException ee) {}
}
indexEntity.close(); // important: is not closed elswhere and cannot be deleted afterwards
@ -320,12 +317,10 @@ public class plasmaWordIndexDistribution {
for (int i = 0; i < tmpEntities.size(); i++) indexEntities[i] = (plasmaWordIndexEntity) tmpEntities.elementAt(i);
return new Object[]{indexEntities, knownURLs};
} catch (IOException e) {
log.logError("selectTransferIndexes IO-Error (hash=" + nexthash + "): " + e.getMessage());
e.printStackTrace();
log.logError("selectTransferIndexes IO-Error (hash=" + nexthash + "): " + e.getMessage(), e);
return new Object[]{new plasmaWordIndexEntity[0], new HashMap()};
} catch (kelondroException e) {
log.logError("selectTransferIndexes database corrupted: " + e.getMessage());
e.printStackTrace();
log.logError("selectTransferIndexes database corrupted: " + e.getMessage(), e);
return new Object[]{new plasmaWordIndexEntity[0], new HashMap()};
}
}

@ -170,29 +170,24 @@ public class plasmaWordIndexEntity {
}
}
public int addEntries(plasmaWordIndexEntryContainer container) {
public int addEntries(plasmaWordIndexEntryContainer container) throws IOException {
//System.out.println("* adding " + newEntries.size() + " cached word index entries for word " + wordHash); // debug
// fetch the index cache
if ((container == null) || (container.size() == 0)) return 0;
// open file
try {
int count = 0;
// write from vector
if (container != null) {
Iterator i = container.entries();
while (i.hasNext()) {
if (addEntry((plasmaWordIndexEntry) i.next())) count++;
}
int count = 0;
// write from vector
if (container != null) {
Iterator i = container.entries();
while (i.hasNext()) {
if (addEntry((plasmaWordIndexEntry) i.next())) count++;
}
// close and return
return count;
} catch (IOException e) {
e.printStackTrace();
return 0;
}
// close and return
return count;
}
public boolean deleteComplete() throws IOException {

@ -179,8 +179,7 @@ public final class serverCodings {
return out;
} catch (ArrayIndexOutOfBoundsException e) {
// maybe the input was not base64
e.printStackTrace();
return null;
throw new RuntimeException("input probably not base64");
}
}

@ -84,8 +84,7 @@ public final class serverInstantThread extends serverAbstractThread implements s
} catch (IllegalArgumentException e) {
return -1;
} catch (InvocationTargetException e) {
System.out.println("Runtime Error in serverInstantThread, thread '" + this.getName() + "': " + e.getMessage());
e.printStackTrace();
serverLog.logError("SERVER", "invocation serverInstantThread of thread '" + this.getName() + "': " + e.getMessage(), e);
return -1;
}
}
@ -97,16 +96,15 @@ public final class serverInstantThread extends serverAbstractThread implements s
if (result == null) jobHasDoneSomething = true;
else if (result instanceof Boolean) jobHasDoneSomething = ((Boolean) result).booleanValue();
} catch (IllegalAccessException e) {
System.out.println("Internal Error in serverInstantThread: " + e.getMessage());
System.out.println("shutting down thread '" + this.getName() + "'");
serverLog.logError("SERVER", "Internal Error in serverInstantThread: " + e.getMessage());
serverLog.logError("SERVER", "shutting down thread '" + this.getName() + "'");
this.terminate(false);
} catch (IllegalArgumentException e) {
System.out.println("Internal Error in serverInstantThread: " + e.getMessage());
System.out.println("shutting down thread '" + this.getName() + "'");
serverLog.logError("SERVER", "Internal Error in serverInstantThread: " + e.getMessage());
serverLog.logError("SERVER", "shutting down thread '" + this.getName() + "'");
this.terminate(false);
} catch (InvocationTargetException e) {
System.out.println("Runtime Error in serverInstantThread, thread '" + this.getName() + "': " + e.getMessage());
e.printStackTrace();
serverLog.logError("SERVER", "Runtime Error in serverInstantThread, thread '" + this.getName() + "': " + e.getMessage(), e);
}
return jobHasDoneSomething;
}

@ -337,8 +337,7 @@ public class yacyCore {
log.logInfo("publish: handshaked " + this.seed.get("PeerType", "senior") + " peer '" + this.seed.getName() + "' at " + this.seed.getAddress());
}
} catch (Exception e) {
log.logError("publishThread: error with target seed " + seed.getMap() + ": " + e.getMessage());
e.printStackTrace();
log.logError("publishThread: error with target seed " + seed.getMap() + ": " + e.getMessage(), e);
this.error = e;
} finally {
this.syncList.add(this);
@ -388,7 +387,7 @@ public class yacyCore {
else
seedDB.mySeed.put("news", de.anomic.tools.crypt.simpleEncode(record.toString()));
} catch (IOException e) {
e.printStackTrace();
log.logError("publishMySeed: problem with news encoding", e);
}
// holding a reference to all started threads

@ -42,7 +42,9 @@
package de.anomic.yacy;
import java.io.IOException;
import de.anomic.server.serverCodings;
import de.anomic.server.logging.serverLog;
public class yacyNewsAction implements yacyPeerAction {
@ -67,7 +69,9 @@ public class yacyNewsAction implements yacyPeerAction {
}
try {
synchronized (pool) {this.pool.enqueueIncomingNews(record);}
} catch (IOException e) {e.printStackTrace();}
} catch (IOException e) {
serverLog.logError("YACY", "processPeerArrival", e);
}
}
public void processPeerDeparture(yacySeed peer) {

@ -173,7 +173,7 @@ public class yacySeedDB {
// create new seed database
seedDB = openSeedTable(seedDBFile);
} catch (IOException e) {
e.printStackTrace();
yacyCore.log.logDebug("resetSeedTable", e);
}
return seedDB;
}
@ -187,7 +187,7 @@ public class yacySeedDB {
seedActiveDB.close();
seedPassiveDB.close();
} catch (IOException e) {
e.printStackTrace();
yacyCore.log.logDebug("close", e);
}
}
@ -300,8 +300,7 @@ public class yacySeedDB {
return result;
} catch (kelondroException e) {
seedActiveDB = resetSeedTable(seedActiveDB, seedActiveDBFile);
System.out.println("Internal Error at yacySeedDB.seedsByAge: " + e.getMessage());
e.printStackTrace();
yacyCore.log.logDebug("Internal Error at yacySeedDB.seedsByAge: " + e.getMessage(), e);
return null;
}
}
@ -350,16 +349,13 @@ public class yacySeedDB {
seedPassiveDB.remove(seed.hash);
seedPotentialDB.remove(seed.hash);
} catch (IOException e){
System.out.println("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
seedActiveDB = resetSeedTable(seedActiveDB, seedActiveDBFile);
} catch (kelondroException e){
System.out.println("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
seedActiveDB = resetSeedTable(seedActiveDB, seedActiveDBFile);
} catch (IllegalArgumentException e) {
System.out.println("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
seedActiveDB = resetSeedTable(seedActiveDB, seedActiveDBFile);
}
}
@ -375,16 +371,13 @@ public class yacySeedDB {
try {
seedPassiveDB.set(seed.hash, seed.getMap());
} catch (IOException e) {
System.out.println("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
seedPassiveDB = resetSeedTable(seedPassiveDB, seedPassiveDBFile);
} catch (kelondroException e) {
System.out.println("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
seedPassiveDB = resetSeedTable(seedPassiveDB, seedPassiveDBFile);
} catch (IllegalArgumentException e) {
System.out.println("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
seedPassiveDB = resetSeedTable(seedPassiveDB, seedPassiveDBFile);
}
}
@ -401,16 +394,13 @@ public class yacySeedDB {
try {
seedPotentialDB.set(seed.hash, seed.getMap());
} catch (IOException e) {
System.out.println("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
seedPassiveDB = resetSeedTable(seedPassiveDB, seedPassiveDBFile);
} catch (kelondroException e) {
System.out.println("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
seedPassiveDB = resetSeedTable(seedPassiveDB, seedPassiveDBFile);
} catch (IllegalArgumentException e) {
System.out.println("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR add: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
seedPassiveDB = resetSeedTable(seedPassiveDB, seedPassiveDBFile);
}
}
@ -656,14 +646,12 @@ public class yacySeedDB {
it = (firstKey == null) ? database.maps(up, rot) : database.maps(up, rot, firstKey);
nextSeed = internalNext();
} catch (IOException e) {
System.out.println("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
if (database == seedActiveDB) seedActiveDB = resetSeedTable(seedActiveDB, seedActiveDBFile);
if (database == seedPassiveDB) seedPassiveDB = resetSeedTable(seedPassiveDB, seedPassiveDBFile);
it = null;
} catch (kelondroException e) {
System.out.println("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
if (database == seedActiveDB) seedActiveDB = resetSeedTable(seedActiveDB, seedActiveDBFile);
if (database == seedPassiveDB) seedPassiveDB = resetSeedTable(seedPassiveDB, seedPassiveDBFile);
it = null;
@ -676,8 +664,7 @@ public class yacySeedDB {
it = database.maps(up, field);
nextSeed = internalNext();
} catch (kelondroException e) {
System.out.println("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db");
e.printStackTrace();
yacyCore.log.logDebug("ERROR seedLinEnum: seed.db corrupt (" + e.getMessage() + "); resetting seed.db", e);
if (database == seedActiveDB) seedActiveDB = resetSeedTable(seedActiveDB, seedActiveDBFile);
if (database == seedPassiveDB) seedPassiveDB = resetSeedTable(seedPassiveDB, seedPassiveDBFile);
if (database == seedPotentialDB) seedPotentialDB = resetSeedTable(seedPotentialDB, seedPotentialDBFile);

@ -444,7 +444,6 @@ public final class yacy {
}
} catch (Exception ee) {
serverLog.logFailure("STARTUP", "FATAL ERROR: " + ee.getMessage(),ee);
ee.printStackTrace();
}
serverLog.logSystem("SHUTDOWN", "goodbye. (this is the last line)");
try {

Loading…
Cancel
Save