mirror of https://github.com/apache/maven.git
PR: MNG-447
ensure the checksums don't get overwritten by the extra put commands git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@180072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
00644fbd38
commit
075932b36d
|
@ -136,7 +136,8 @@ public class DefaultWagonManager
|
|||
wagon.addTransferListener( downloadMonitor );
|
||||
}
|
||||
|
||||
Map checksums = new HashMap();
|
||||
Map checksums = new HashMap( 2 );
|
||||
Map sums = new HashMap( 2 );
|
||||
|
||||
// TODO: configure these on the repository
|
||||
try
|
||||
|
@ -161,16 +162,23 @@ public class DefaultWagonManager
|
|||
|
||||
wagon.removeTransferListener( downloadMonitor );
|
||||
|
||||
// We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself
|
||||
// Pre-store the checksums as any future puts will overwrite them
|
||||
for ( Iterator i = checksums.keySet().iterator(); i.hasNext(); )
|
||||
{
|
||||
String extension = (String) i.next();
|
||||
ChecksumObserver observer = (ChecksumObserver) checksums.get( extension );
|
||||
sums.put( extension, observer.getActualChecksum() );
|
||||
}
|
||||
|
||||
// We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself
|
||||
for ( Iterator i = checksums.keySet().iterator(); i.hasNext(); )
|
||||
{
|
||||
String extension = (String) i.next();
|
||||
|
||||
// TODO: shouldn't need a file intermediatary - improve wagon to take a stream
|
||||
File temp = File.createTempFile( "maven-artifact", null );
|
||||
temp.deleteOnExit();
|
||||
FileUtils.fileWrite( temp.getAbsolutePath(), observer.getActualChecksum() );
|
||||
FileUtils.fileWrite( temp.getAbsolutePath(), (String) sums.get( extension ) );
|
||||
|
||||
wagon.put( temp, remotePath + "." + extension );
|
||||
}
|
||||
|
@ -499,4 +507,4 @@ public class DefaultWagonManager
|
|||
|
||||
mirrors.put( mirrorOf, mirror );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue