*) Bugfix for suppressing of stacktrace in log on crawler error "MalformedURLException"

See: http://www.yacy-forum.de/viewtopic.php?p=8840

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@623 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 2ee4f9f4e5
commit 59b8a98c7e

@ -430,78 +430,74 @@ public final class plasmaCrawlWorker extends Thread {
} catch (Exception e) { } catch (Exception e) {
boolean retryCrawling = false; boolean retryCrawling = false;
String errorMsg = e.getMessage(); String errorMsg = e.getMessage();
if (errorMsg != null) {
if (e instanceof MalformedURLException) { if (e instanceof MalformedURLException) {
log.logWarning("CRAWLER Malformed URL '" + url.toString() + "' detected. "); log.logWarning("CRAWLER Malformed URL '" + url.toString() + "' detected. ");
} else if ((e instanceof UnknownHostException) || (errorMsg.indexOf("unknown host") >= 0)) { } else if ((e instanceof UnknownHostException) ||
log.logWarning("CRAWLER Unknown host in URL '" + url.toString() + "'. " + ((errorMsg != null) && (errorMsg.indexOf("unknown host") >= 0))) {
"Referer URL: " + ((referer == null) ?"Unknown":referer)); log.logWarning("CRAWLER Unknown host in URL '" + url.toString() + "'. " +
} else if (e instanceof java.net.BindException) { "Referer URL: " + ((referer == null) ?"Unknown":referer));
log.logWarning("CRAWLER BindException detected while trying to download content from '" + url.toString() + } else if (e instanceof java.net.BindException) {
"'. Retrying request."); log.logWarning("CRAWLER BindException detected while trying to download content from '" + url.toString() +
retryCrawling = true; "'. Retrying request.");
} else if (errorMsg.indexOf("Corrupt GZIP trailer") >= 0) { retryCrawling = true;
log.logWarning("CRAWLER Problems detected while receiving gzip encoded content from '" + url.toString() + } else if ((errorMsg != null) && (errorMsg.indexOf("Corrupt GZIP trailer") >= 0)) {
"'. Retrying request without using gzip content encoding."); log.logWarning("CRAWLER Problems detected while receiving gzip encoded content from '" + url.toString() +
retryCrawling = true; "'. Retrying request without using gzip content encoding.");
} else if (errorMsg.indexOf("Read timed out") >= 0) { retryCrawling = true;
log.logWarning("CRAWLER Read timeout while receiving content from '" + url.toString() + } else if ((errorMsg != null) && (errorMsg.indexOf("Read timed out") >= 0)) {
"'. Retrying request."); log.logWarning("CRAWLER Read timeout while receiving content from '" + url.toString() +
retryCrawling = true; "'. Retrying request.");
} else if (errorMsg.indexOf("connect timed out") >= 0) { retryCrawling = true;
log.logWarning("CRAWLER Timeout while trying to connect to '" + url.toString() + } else if ((errorMsg != null) && (errorMsg.indexOf("connect timed out") >= 0)) {
"'. Retrying request."); log.logWarning("CRAWLER Timeout while trying to connect to '" + url.toString() +
retryCrawling = true; "'. Retrying request.");
} else if (errorMsg.indexOf("Connection timed out") >= 0) { retryCrawling = true;
log.logWarning("CRAWLER Connection timeout while receiving content from '" + url.toString() + } else if ((errorMsg != null) && (errorMsg.indexOf("Connection timed out") >= 0)) {
"'. Retrying request."); log.logWarning("CRAWLER Connection timeout while receiving content from '" + url.toString() +
retryCrawling = true; "'. Retrying request.");
} else if (errorMsg.indexOf("Connection refused") >= 0) { retryCrawling = true;
log.logWarning("CRAWLER Connection refused while trying to connect to '" + url.toString() + "'."); } else if ((errorMsg != null) && (errorMsg.indexOf("Connection refused") >= 0)) {
} else if (errorMsg.indexOf("There is not enough space on the disk") >= 0) { log.logWarning("CRAWLER Connection refused while trying to connect to '" + url.toString() + "'.");
log.logSevere("CRAWLER Not enough space on the disk detected while crawling '" + url.toString() + "'. " + } else if ((errorMsg != null) && (errorMsg.indexOf("There is not enough space on the disk") >= 0)) {
"Pausing crawlers. "); log.logSevere("CRAWLER Not enough space on the disk detected while crawling '" + url.toString() + "'. " +
plasmaCrawlLoader.switchboard.pauseCrawling(); "Pausing crawlers. ");
} else { plasmaCrawlLoader.switchboard.pauseCrawling();
log.logSevere("CRAWLER Unexpected Error with URL '" + url.toString() + "': " + e.toString(),e); } else {
log.logSevere("CRAWLER Unexpected Error with URL '" + url.toString() + "': " + e.toString(),e);
}
if (retryCrawling) {
// if we are already doing a shutdown we don't need to retry crawling
if (Thread.currentThread().isInterrupted()) {
log.logSevere("CRAWLER Retry of URL=" + url.toString() + " aborted because of server shutdown.");
return;
} }
if (retryCrawling) { // returning the used httpc
// if we are already doing a shutdown we don't need to retry crawling httpc.returnInstance(remote);
if (Thread.currentThread().isInterrupted()) { remote = null;
log.logSevere("CRAWLER Retry of URL=" + url.toString() + " aborted because of server shutdown.");
return; // setting the retry counter to 1
} if (crawlingRetryCount > 2) crawlingRetryCount = 2;
// returning the used httpc // retry crawling
httpc.returnInstance(remote); load(url,
remote = null; name,
referer,
// setting the retry counter to 1 initiator,
if (crawlingRetryCount > 2) crawlingRetryCount = 2; depth,
profile,
// retry crawling socketTimeout,
load(url, remoteProxyHost,
name, remoteProxyPort,
referer, remoteProxyUse,
initiator, cacheManager,
depth, log,
profile, --crawlingRetryCount,
socketTimeout, false
remoteProxyHost, );
remoteProxyPort,
remoteProxyUse,
cacheManager,
log,
--crawlingRetryCount,
false
);
}
} else {
// this may happen if the targeted host does not exist or anything with the
// remote server was wrong.
log.logSevere("CRAWLER LOADER ERROR2 with URL=" + url.toString() + ": " + e.toString(),e);
} }
} finally { } finally {
if (remote != null) httpc.returnInstance(remote); if (remote != null) httpc.returnInstance(remote);

Loading…
Cancel
Save