From: <vin...@us...> - 2012-01-08 04:57:35
|
Revision: 3592 http://archive-access.svn.sourceforge.net/archive-access/?rev=3592&view=rev Author: vinaygoel Date: 2012-01-08 04:57:28 +0000 (Sun, 08 Jan 2012) Log Message: ----------- Wrapped DNSParseException(RecoverableRecordException) as ResourceParseException. Added catch for other possible RecoverableRecordException that may be thrown. Modified Paths: -------------- trunk/archive-access/projects/archive-commons/src/main/java/org/archive/extract/ResourceExtractor.java trunk/archive-access/projects/archive-commons/src/main/java/org/archive/resource/warc/record/DNSResourceFactory.java Modified: trunk/archive-access/projects/archive-commons/src/main/java/org/archive/extract/ResourceExtractor.java =================================================================== --- trunk/archive-access/projects/archive-commons/src/main/java/org/archive/extract/ResourceExtractor.java 2012-01-08 03:09:20 UTC (rev 3591) +++ trunk/archive-access/projects/archive-commons/src/main/java/org/archive/extract/ResourceExtractor.java 2012-01-08 04:57:28 UTC (rev 3592) @@ -13,6 +13,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; +import org.archive.RecoverableRecordFormatException; import org.archive.format.gzip.GZIPFormatException; import org.archive.resource.Resource; import org.archive.resource.ResourceConstants; @@ -66,7 +67,7 @@ if(args.length < 1) { return USAGE(1); } - if(args.length > 2) { + if(args.length > 3) { return USAGE(1); } int max = Integer.MAX_VALUE; @@ -118,14 +119,31 @@ out.output(r); } catch(GZIPFormatException e) { + LOG.severe(String.format("%s: %s",exProducer.getContext(),e.getMessage())); + //Log is not coming out for some damn reason....needs to be studied + System.err.format("%s: %s",exProducer.getContext(),e.getMessage()); + if(ProducerUtils.STRICT_GZ) { - LOG.severe(String.format("%s: %s",exProducer.getContext(),e.getMessage())); throw e; } e.printStackTrace(); } catch(ResourceParseException e) { LOG.severe(String.format("%s: %s",exProducer.getContext(),e.getMessage())); - throw e; + //Log is not coming out for some damn reason....needs to be studied + System.err.format("%s: %s",exProducer.getContext(),e.getMessage()); + + if(ProducerUtils.STRICT_GZ) { + throw e; + } + e.printStackTrace(); + } catch(RecoverableRecordFormatException e) { + // this should not get here - ResourceFactory et al should wrap as ResourceParseExceptions... + LOG.severe(String.format("RECOVERABLE - %s: %s",exProducer.getContext(),e.getMessage())); + //Log is not coming out for some damn reason....needs to be studied + System.err.format("%s: %s",exProducer.getContext(),e.getMessage()); + + e.printStackTrace(); + } } return 0; Modified: trunk/archive-access/projects/archive-commons/src/main/java/org/archive/resource/warc/record/DNSResourceFactory.java =================================================================== --- trunk/archive-access/projects/archive-commons/src/main/java/org/archive/resource/warc/record/DNSResourceFactory.java 2012-01-08 03:09:20 UTC (rev 3591) +++ trunk/archive-access/projects/archive-commons/src/main/java/org/archive/resource/warc/record/DNSResourceFactory.java 2012-01-08 04:57:28 UTC (rev 3592) @@ -3,6 +3,7 @@ import java.io.IOException; import java.io.InputStream; +import org.archive.RecoverableRecordFormatException; import org.archive.format.dns.DNSResponse; import org.archive.format.dns.DNSResponseParser; import org.archive.resource.MetaData; @@ -20,7 +21,11 @@ ResourceContainer container) throws ResourceParseException, IOException { DNSResponse response = new DNSResponse(); - parser.parse(is, response); + try { + parser.parse(is, response); + } catch(RecoverableRecordFormatException e) { + throw new ResourceParseException(e); + } parentMetaData.putString(PAYLOAD_CONTENT_TYPE, PAYLOAD_TYPE_DNS); return new DNSResource(parentMetaData.createChild(DNS_METADATA), container, response); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |