Return-Path: Delivered-To: apmail-avalon-cvs-archive@www.apache.org Received: (qmail 23862 invoked from network); 3 Dec 2003 20:41:55 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 3 Dec 2003 20:41:55 -0000 Received: (qmail 75423 invoked by uid 500); 3 Dec 2003 20:41:31 -0000 Delivered-To: apmail-avalon-cvs-archive@avalon.apache.org Received: (qmail 75347 invoked by uid 500); 3 Dec 2003 20:41:31 -0000 Mailing-List: contact cvs-help@avalon.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list cvs@avalon.apache.org Received: (qmail 75334 invoked by uid 500); 3 Dec 2003 20:41:31 -0000 Received: (qmail 75331 invoked from network); 3 Dec 2003 20:41:31 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 3 Dec 2003 20:41:31 -0000 Received: (qmail 23790 invoked by uid 1438); 3 Dec 2003 20:41:53 -0000 Date: 3 Dec 2003 20:41:53 -0000 Message-ID: <20031203204153.23789.qmail@minotaur.apache.org> From: mcconnell@apache.org To: avalon-sandbox-cvs@apache.org Subject: cvs commit: avalon-sandbox/repository/util/src/java/org/apache/avalon/repository/util LOADER.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N mcconnell 2003/12/03 12:41:53 Modified: repository/util/src/java/org/apache/avalon/repository/util LOADER.java Log: Add support for SNAPSHOT handling. Revision Changes Path 1.5 +28 -35 avalon-sandbox/repository/util/src/java/org/apache/avalon/repository/util/LOADER.java Index: LOADER.java =================================================================== RCS file: /home/cvs/avalon-sandbox/repository/util/src/java/org/apache/avalon/repository/util/LOADER.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- LOADER.java 30 Nov 2003 08:11:37 -0000 1.4 +++ LOADER.java 3 Dec 2003 20:41:53 -0000 1.5 @@ -104,9 +104,6 @@ File destination = new File( root, artifact.getPath() ); - /* - * Don't fail fast - keep trying until we get something. - */ for ( int i = 0; i < repositories.length; i++ ) { try @@ -120,20 +117,7 @@ } } - if( destination.exists() ) - { - try - { - return destination.toURL(); - } - catch( Throwable e ) - { - final String error = - "Internal error while attempting to create a url from the file: " - + destination; - throw new RepositoryException( error, e ); - } - } + if( destination.exists() ) return getURL( destination ); StringBuffer buffer = new StringBuffer(); buffer.append( @@ -180,9 +164,6 @@ File destination = new File( root, artifact.getPath() + "." + mime ); - /* - * Don't fail fast - keep trying until we get something. - */ for ( int i = 0; i < repositories.length; i++ ) { try @@ -196,20 +177,7 @@ } } - if( destination.exists() ) - { - try - { - return destination.toURL(); - } - catch( Throwable e ) - { - final String error = - "Internal error while attempting to create a url from the file: " - + destination; - throw new RepositoryException( error, e ); - } - } + if( destination.exists() ) return getURL( destination ); StringBuffer buffer = new StringBuffer(); buffer.append( @@ -276,6 +244,11 @@ } } + if( destination.exists() && !isSnapshot( destination ) ) + { + return getURL( destination ); + } + // // otherwise continue with classic processing // @@ -421,5 +394,25 @@ } } return destination.toURL(); + } + + private static boolean isSnapshot( File file ) + { + return file.getName().endsWith( "SNAPSHOT" ); + } + + private static URL getURL( File file ) throws RepositoryException + { + try + { + return file.toURL(); + } + catch( Throwable e ) + { + final String error = + "Internal error while attempting to create a url from the file: " + + file; + throw new RepositoryException( error, e ); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org For additional commands, e-mail: cvs-help@avalon.apache.org