Skip to content

Commit

Permalink
*) Better errorhandling for charset encoding problem during content p…
Browse files Browse the repository at this point in the history
…arsing

   See: http://www.yacy-forum.de/viewtopic.php?t=2952

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2737 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
theli committed Oct 10, 2006
1 parent 89ee215 commit 2264940
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/de/anomic/plasma/plasmaCrawlEURL.java
Expand Up @@ -86,6 +86,7 @@ public class plasmaCrawlEURL extends indexURL {

// wrong content
public static final String DENIED_WRONG_MIMETYPE_OR_EXT = "denied_(wrong_mimetype_or_extension)";
public static final String DENIED_UNSUPPORTED_CHARSET = "denied_(unsupported_charset)";
public static final String DENIED_REDIRECTION_HEADER_EMPTY = "denied_(redirection_header_empty)";
public static final String DENIED_REDIRECTION_COUNTER_EXCEEDED = "denied_(redirection_counter_exceeded)";
public static final String DENIED_WRONG_HTTP_STATUSCODE = "denied_(wrong_http_status_code_";
Expand Down
5 changes: 5 additions & 0 deletions source/de/anomic/plasma/plasmaParser.java
Expand Up @@ -52,6 +52,7 @@
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.util.Arrays;
Expand Down Expand Up @@ -600,6 +601,10 @@ public plasmaParserDocument parseSource(URL location, String theMimeType, String
}
return doc;

} catch (UnsupportedEncodingException e) {
String errorMsg = "Unsupported charset encoding: " + e.getMessage();
this.theLogger.logSevere("Unable to parse '" + location + "'. " + errorMsg, e);
throw new ParserException(errorMsg,location,plasmaCrawlEURL.DENIED_UNSUPPORTED_CHARSET);
} catch (Exception e) {
// Interrupted- and Parser-Exceptions should pass through
if (e instanceof InterruptedException) throw (InterruptedException) e;
Expand Down

0 comments on commit 2264940

Please sign in to comment.