From 19696518b34c35e8f3141bc79cb95229c03f804d Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Wed, 20 Jul 2005 00:00:08 +0000 Subject: [PATCH] add copyrights git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@219819 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultRepositoryMetadataManager.java | 39 ++++++++++++++----- .../InvalidRepositoryMetadataException.java | 16 ++++++++ 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java index 75e45a2ccc..09b0edb222 100644 --- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java +++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java @@ -1,5 +1,21 @@ package org.apache.maven.artifact.repository.metadata; +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.wagon.ResourceDoesNotExistException; @@ -31,7 +47,7 @@ public class DefaultRepositoryMetadataManager { resolve( metadata, null, local ); } - + public void resolve( RepositoryMetadata metadata, ArtifactRepository remote, ArtifactRepository local ) throws RepositoryMetadataManagementException { @@ -54,7 +70,8 @@ public class DefaultRepositoryMetadataManager if ( !metadataFile.exists() ) { throw new RepositoryMetadataManagementException( metadata, - "Remote repository metadata not found.", e ); + "Remote repository metadata not found.", + e ); } else { @@ -81,27 +98,28 @@ public class DefaultRepositoryMetadataManager { if ( !verifyFileNotEmpty( metadataFile ) ) { - throw new InvalidRepositoryMetadataException( metadata, "Metadata located in file: " + metadataFile + " appears to be corrupt (file is empty). DOWNLOAD FAILED." ); + throw new InvalidRepositoryMetadataException( metadata, "Metadata located in file: " + + metadataFile + " appears to be corrupt (file is empty). DOWNLOAD FAILED." ); } - + cachedMetadata.put( metadata.getRepositoryPath(), metadataFile ); } } - + metadata.setFile( metadataFile ); } private boolean verifyFileNotEmpty( File metadataFile ) { InputStream verifyInputStream = null; - + try { verifyInputStream = new FileInputStream( metadataFile ); - + return verifyInputStream.available() > 0; } - catch( IOException e ) + catch ( IOException e ) { return false; } @@ -156,12 +174,13 @@ public class DefaultRepositoryMetadataManager throws RepositoryMetadataManagementException { File metadataFile = constructLocalRepositoryFile( metadata, local ); - + if ( metadataFile.exists() ) { if ( !metadataFile.delete() ) { - throw new RepositoryMetadataManagementException( metadata, "Failed to purge local copy from: " + metadataFile ); + throw new RepositoryMetadataManagementException( metadata, + "Failed to purge local copy from: " + metadataFile ); } } } diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/InvalidRepositoryMetadataException.java b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/InvalidRepositoryMetadataException.java index 0df708bb2b..0259799c37 100644 --- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/InvalidRepositoryMetadataException.java +++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/InvalidRepositoryMetadataException.java @@ -1,5 +1,21 @@ package org.apache.maven.artifact.repository.metadata; +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + public class InvalidRepositoryMetadataException extends RepositoryMetadataManagementException {