From: <bra...@us...> - 2007-08-23 21:26:18
|
Revision: 1922 http://archive-access.svn.sourceforge.net/archive-access/?rev=1922&view=rev Author: bradtofel Date: 2007-08-23 14:26:20 -0700 (Thu, 23 Aug 2007) Log Message: ----------- BUGFIX: was not throwing LiveResourceNotAvailable on 302's TWEAK: cleaned up some really messy error handling/bubbling code. This whole class needs another cleanup pass.. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java 2007-08-23 21:25:12 UTC (rev 1921) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java 2007-08-23 21:26:20 UTC (rev 1922) @@ -113,8 +113,12 @@ LaxURI lURI = new LaxURI(urlString,true); method.setURI(lURI); try { - http.executeMethod(method); + int code = http.executeMethod(method); os.close(); + // TODO: Contstant 200 + if(code != 200) { + throw new LiveDocumentNotAvailableException(urlString); + } } catch (HttpException e) { e.printStackTrace(); throw new LiveDocumentNotAvailableException(urlString); @@ -196,12 +200,13 @@ try { writer = cache.getWriter(); location = storeFile(tmpFile, writer, urlString, method); - } catch (IOException e2) { - cache.returnWriter(writer); - tmpFile.delete(); - throw e2; + } catch(IOException e) { + e.printStackTrace(); + throw e; } finally { - cache.returnWriter(writer); + if(writer != null) { + cache.returnWriter(writer); + } tmpFile.delete(); } return location; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2007-09-11 00:59:43
|
Revision: 1987 http://archive-access.svn.sourceforge.net/archive-access/?rev=1987&view=rev Author: bradtofel Date: 2007-09-10 17:59:47 -0700 (Mon, 10 Sep 2007) Log Message: ----------- BUGFIX: (unreported) now correctly handling NoRouteToHost and ConnectExceptions by rethrowing LiveDocumentNotAvailableExceptions. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java 2007-09-11 00:53:43 UTC (rev 1986) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java 2007-09-11 00:59:47 UTC (rev 1987) @@ -30,7 +30,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.ConnectException; import java.net.MalformedURLException; +import java.net.NoRouteToHostException; import java.net.URL; import java.net.UnknownHostException; import java.util.Arrays; @@ -128,6 +130,12 @@ } catch(ConnectTimeoutException e) { LOGGER.info("Connection Timeout for URL " + urlString); throw new LiveDocumentNotAvailableException(urlString); + } catch(NoRouteToHostException e) { + LOGGER.info("No route to host for URL " + urlString); + throw new LiveDocumentNotAvailableException(urlString); + } catch(ConnectException e) { + LOGGER.info("ConnectException URL " + urlString); + throw new LiveDocumentNotAvailableException(urlString); } LOGGER.info("Stored " + urlString + " in " + file.getAbsolutePath()); return method; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2007-09-28 22:40:12
|
Revision: 2018 http://archive-access.svn.sourceforge.net/archive-access/?rev=2018&view=rev Author: bradtofel Date: 2007-09-28 15:40:12 -0700 (Fri, 28 Sep 2007) Log Message: ----------- FEATURE: now attempts to create missing tmp directory. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java 2007-09-28 22:39:36 UTC (rev 2017) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java 2007-09-28 22:40:12 UTC (rev 2018) @@ -117,7 +117,7 @@ try { int code = http.executeMethod(method); os.close(); - // TODO: Contstant 200 + // TODO: Constant 200 if(code != 200) { throw new LiveDocumentNotAvailableException(urlString); } @@ -449,6 +449,9 @@ */ public void setTmpDir(String tmpDir) { this.tmpDir = new File(tmpDir); + if(!this.tmpDir.exists()) { + this.tmpDir.mkdirs(); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2008-04-11 03:51:07
|
Revision: 2227 http://archive-access.svn.sourceforge.net/archive-access/?rev=2227&view=rev Author: bradtofel Date: 2008-04-10 20:51:10 -0700 (Thu, 10 Apr 2008) Log Message: ----------- INTERFACE: urlToFile() is now protected, not private Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java 2008-04-11 03:48:48 UTC (rev 2226) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/liveweb/URLCacher.java 2008-04-11 03:51:10 UTC (rev 2227) @@ -106,7 +106,7 @@ return tmpFile; } - private ExtendedGetMethod urlToFile(String urlString, File file) + protected ExtendedGetMethod urlToFile(String urlString, File file) throws LiveDocumentNotAvailableException, URIException, IOException { HttpClient http = getHttpClient(); @@ -282,7 +282,7 @@ private String remoteIP = ""; private Date captureDate = null; - private String mime = ""; + private String mime = "unk"; private OutputStream os = null; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |