From: <bra...@us...> - 2011-02-06 14:51:31
|
Revision: 3406 http://archive-access.svn.sourceforge.net/archive-access/?rev=3406&view=rev Author: bradtofel Date: 2011-02-06 14:51:25 +0000 (Sun, 06 Feb 2011) Log Message: ----------- BUGFIX: no longer catching and eating ConnectTimeoutExceptions Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLtoARCCacher.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLtoARCCacher.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLtoARCCacher.java 2011-02-06 14:49:24 UTC (rev 3405) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLtoARCCacher.java 2011-02-06 14:51:25 UTC (rev 3406) @@ -38,8 +38,10 @@ import org.apache.commons.httpclient.SimpleHttpConnectionManager; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.io.IOUtils; import org.archive.httpclient.HttpRecorderGetMethod; import org.archive.io.RecordingInputStream; +import org.archive.io.ReplayInputStream; import org.archive.io.arc.ARCWriter; import org.archive.net.LaxURI; import org.archive.util.Recorder; @@ -140,10 +142,10 @@ } catch (URIException e) { e.printStackTrace(); } catch (UnknownHostException e) { - LOGGER.warning("Unknown host for " + url); - } catch (ConnectTimeoutException e) { - // TODO: should we act like it's a full block? - LOGGER.warning("Timeout out connecting to " + url); + LOGGER.warning("Unknown host for " + url); +// } catch (ConnectTimeoutException e) { +// // TODO: should we act like it's a full block? +// LOGGER.warning("Timeout out connecting to " + url); } catch (ConnectException e) { LOGGER.warning("ConnectionRefused to " + url); @@ -164,21 +166,24 @@ // now write the content, or a fake record: ARCWriter writer = null; + ReplayInputStream replayIS = null; try { writer = cache.getWriter(); if(gotUrl) { RecordingInputStream ris = recorder.getRecordedInput(); + replayIS = ris.getReplayInputStream(); region = storeInputStreamARCRecord(writer, url, getMethod.getMime(), getMethod.getRemoteIP(), getMethod.getCaptureDate(), - ris.getReplayInputStream(), (int) ris.getSize()); + replayIS, (int) ris.getSize()); } else { region = storeNotAvailable(writer, url); } } finally { + IOUtils.closeQuietly(replayIS); if(writer != null) { cache.returnWriter(writer); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |