don't zero out files that are the same

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290380 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-20 07:07:23 +00:00
parent 2b44ccee57
commit 4330db96ab
3 changed files with 18 additions and 4 deletions

View File

@ -83,7 +83,15 @@ public class DigestVerifier
{ {
try try
{ {
FileUtils.copyFile( digestSourceFile, digestTargetFile ); if ( digestTargetFile == null )
{
reporter.error( "No target digest file for path [" + artifactSource +
"] from source to target for digest algorithm: \'" + digestAlgorithm + "\'." );
}
else if ( !digestSourceFile.getCanonicalFile().equals( digestTargetFile.getCanonicalFile() ) )
{
FileUtils.copyFile( digestSourceFile, digestTargetFile );
}
} }
catch ( IOException e ) catch ( IOException e )
{ {

View File

@ -70,7 +70,7 @@ public class DefaultArtifactDiscoverer
Artifact result; Artifact result;
List pathParts = new ArrayList(); List pathParts = new ArrayList();
StringTokenizer st = new StringTokenizer( path, "/" ); StringTokenizer st = new StringTokenizer( path, "/\\" );
while ( st.hasMoreTokens() ) while ( st.hasMoreTokens() )
{ {
pathParts.add( st.nextToken() ); pathParts.add( st.nextToken() );
@ -80,7 +80,7 @@ public class DefaultArtifactDiscoverer
if ( pathParts.size() < 4 ) if ( pathParts.size() < 4 )
{ {
reporter.error( "Not enough parts (4) in path " + path ); reporter.error( "Not enough parts (" + pathParts.size() + "/4) in path " + path );
return null; return null;
} }

View File

@ -456,9 +456,10 @@ public class RewritePhase
boolean reportOnly ) boolean reportOnly )
throws IOException, DigestException, ReportWriteException throws IOException, DigestException, ReportWriteException
{ {
if ( source.exists() ) if ( source.exists() && !source.getCanonicalFile().equals( target.getCanonicalFile() ) )
{ {
File targetParent = target.getParentFile(); File targetParent = target.getParentFile();
if ( !targetParent.exists() ) if ( !targetParent.exists() )
{ {
targetParent.mkdirs(); targetParent.mkdirs();
@ -516,6 +517,11 @@ public class RewritePhase
{ {
File artifactSource = artifact.getFile(); File artifactSource = artifact.getFile();
if ( artifactSource.getCanonicalFile().equals( artifactTarget.getCanonicalFile() ) )
{
return;
}
InputStream inStream = null; InputStream inStream = null;
OutputStream outStream = null; OutputStream outStream = null;
try try