From: <bra...@us...> - 2010-07-20 23:58:49
|
Revision: 3184 http://archive-access.svn.sourceforge.net/archive-access/?rev=3184&view=rev Author: bradtofel Date: 2010-07-20 23:58:43 +0000 (Tue, 20 Jul 2010) Log Message: ----------- Created IORuntimeException so ZiplinesIterator can maintain Iterator interface, but throws an exception discernible as an IO problem Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/LocalResourceIndex.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinesChunkIterator.java Added Paths: ----------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/exception/RuntimeIOException.java Added: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/exception/RuntimeIOException.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/exception/RuntimeIOException.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/exception/RuntimeIOException.java 2010-07-20 23:58:43 UTC (rev 3184) @@ -0,0 +1,36 @@ +/* RuntimeIOException + * + * $Id$: + * + * Created on Jun 24, 2010. + * + * Copyright (C) 2006 Internet Archive. + * + * This file is part of Wayback. + * + * Wayback is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Wayback is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with Wayback; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package org.archive.wayback.exception; + +/** + * @author brad + * + */ +public class RuntimeIOException extends RuntimeException { + + /** */ + private static final long serialVersionUID = -4762025404760379497L; +} Property changes on: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/exception/RuntimeIOException.java ___________________________________________________________________ Added: svn:keywords + Author Date Revision Id Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/LocalResourceIndex.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/LocalResourceIndex.java 2010-07-20 23:56:53 UTC (rev 3183) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/LocalResourceIndex.java 2010-07-20 23:58:43 UTC (rev 3184) @@ -43,6 +43,7 @@ import org.archive.wayback.exception.BadQueryException; import org.archive.wayback.exception.ResourceIndexNotAvailableException; import org.archive.wayback.exception.ResourceNotInArchiveException; +import org.archive.wayback.exception.RuntimeIOException; import org.archive.wayback.resourceindex.adapters.CaptureToUrlSearchResultIterator; import org.archive.wayback.resourceindex.filterfactory.AccessPointCaptureFilterGroupFactory; import org.archive.wayback.resourceindex.filterfactory.CaptureFilterGroup; @@ -173,6 +174,9 @@ WindowFilterGroup<CaptureSearchResult> window = new WindowFilterGroup<CaptureSearchResult>(wbRequest,this); List<CaptureFilterGroup> groups = getRequestFilterGroups(wbRequest); + if(filter != null) { + filters.addFilter(filter); + } for(CaptureFilterGroup cfg : groups) { filters.addFilters(cfg.getFilters()); @@ -182,16 +186,17 @@ CloseableIterator<CaptureSearchResult> itr = new ObjectFilterIterator<CaptureSearchResult>( source.getPrefixIterator(urlKey),filters); - - while(itr.hasNext()) { - results.addSearchResult(itr.next()); + try { + while(itr.hasNext()) { + results.addSearchResult(itr.next()); + } + } catch(RuntimeIOException e) { + throw new ResourceIndexNotAvailableException(e.getLocalizedMessage()); } - for(CaptureFilterGroup cfg : groups) { cfg.annotateResults(results); } window.annotateResults(results); - cleanupIterator(itr); return results; Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinesChunkIterator.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinesChunkIterator.java 2010-07-20 23:56:53 UTC (rev 3183) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinesChunkIterator.java 2010-07-20 23:58:43 UTC (rev 3184) @@ -38,6 +38,8 @@ import java.util.zip.GZIPInputStream; import org.apache.log4j.Logger; +import org.archive.wayback.exception.ResourceIndexNotAvailableException; +import org.archive.wayback.exception.RuntimeIOException; import org.archive.wayback.util.CloseableIterator; import org.archive.wayback.webapp.AccessPoint; @@ -88,7 +90,7 @@ try { br = blockItr.next().readBlock(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeIOException(); } } else { return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |