Author: ferdy
Date: Thu Nov 17 15:40:28 2011
New Revision: 1203224
URL: http://svn.apache.org/viewvc?rev=1203224&view=rev
Log:
NUTCH-1198 Less verbose logging when unmapped mimetypes are trying to be parsed.
Modified:
nutch/branches/nutchgora/CHANGES.txt
nutch/branches/nutchgora/src/java/org/apache/nutch/parse/ParseUtil.java
Modified: nutch/branches/nutchgora/CHANGES.txt
URL:
http://svn.apache.org/viewvc/nutch/branches/nutchgora/CHANGES.txt?rev=1203224&r1=1203223&r2=1203224&view=diff
==============================================================================
--- nutch/branches/nutchgora/CHANGES.txt (original)
+++ nutch/branches/nutchgora/CHANGES.txt Thu Nov 17 15:40:28 2011
@@ -2,6 +2,8 @@ Nutch Change Log
Release nutchgora - Current Development
+* NUTCH-1198 Less verbose logging when unmapped mimetypes are trying to be
parsed. (ferdy)
+
* NUTCH-1196 Update job should impose an upper limit on the number of inlinks
(nutchgora) (ferdy)
* NUTCH-1185 Decrease solr.commit.size to 250 (markus)
Modified:
nutch/branches/nutchgora/src/java/org/apache/nutch/parse/ParseUtil.java
URL:
http://svn.apache.org/viewvc/nutch/branches/nutchgora/src/java/org/apache/nutch/parse/ParseUtil.java?rev=1203224&r1=1203223&r2=1203224&view=diff
==============================================================================
--- nutch/branches/nutchgora/src/java/org/apache/nutch/parse/ParseUtil.java
(original)
+++ nutch/branches/nutchgora/src/java/org/apache/nutch/parse/ParseUtil.java Thu
Nov 17 15:40:28 2011
@@ -101,20 +101,16 @@ public class ParseUtil extends Configure
* returned. If the parse is unsuccessful, a message is logged to the
* <code>WARNING</code> level, and an empty parse is returned.
*
- * @throws ParseException If no suitable parser is found to perform the
parse.
+ * @throws ParserNotFound If there is no suitable parser found.
+ * @throws ParseException If there is an error parsing.
*/
- public Parse parse(String url, WebPage page) throws ParseException {
+ public Parse parse(String url, WebPage page) throws ParserNotFound,
+ ParseException {
Parser[] parsers = null;
String contentType = TableUtil.toString(page.getContentType());
- try {
- parsers = this.parserFactory.getParsers(contentType, url);
- } catch (ParserNotFound e) {
- LOG.warn("No suitable parser found when trying to parse content " + url +
- " of type " + contentType);
- throw new ParseException(e.getMessage());
- }
+ parsers = this.parserFactory.getParsers(contentType, url);
for (int i=0; i<parsers.length; i++) {
if (LOG.isDebugEnabled()) {
@@ -179,6 +175,10 @@ public class ParseUtil extends Configure
Parse parse;
try {
parse = parse(url, page);
+ } catch (ParserNotFound e) {
+ // do not print stacktrace for the fact that some types are not mapped.
+ LOG.warn("No suitable parser found: " + e.getMessage());
+ return redirectedPage;
} catch (final Exception e) {
LOG.warn("Error parsing: " + url + ": " +
StringUtils.stringifyException(e));
return redirectedPage;