diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerifier.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerifier.java index c3878fddc4..ac8df7329c 100644 --- a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerifier.java +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerifier.java @@ -83,7 +83,15 @@ public class DigestVerifier { 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 ) { diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/DefaultArtifactDiscoverer.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/DefaultArtifactDiscoverer.java index f161a8b656..122d97c0d6 100644 --- a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/DefaultArtifactDiscoverer.java +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/DefaultArtifactDiscoverer.java @@ -70,7 +70,7 @@ public class DefaultArtifactDiscoverer Artifact result; List pathParts = new ArrayList(); - StringTokenizer st = new StringTokenizer( path, "/" ); + StringTokenizer st = new StringTokenizer( path, "/\\" ); while ( st.hasMoreTokens() ) { pathParts.add( st.nextToken() ); @@ -80,7 +80,7 @@ public class DefaultArtifactDiscoverer 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; } diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/phase/RewritePhase.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/phase/RewritePhase.java index eb0e82d668..6d7adece39 100644 --- a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/phase/RewritePhase.java +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/phase/RewritePhase.java @@ -456,9 +456,10 @@ public class RewritePhase boolean reportOnly ) throws IOException, DigestException, ReportWriteException { - if ( source.exists() ) + if ( source.exists() && !source.getCanonicalFile().equals( target.getCanonicalFile() ) ) { File targetParent = target.getParentFile(); + if ( !targetParent.exists() ) { targetParent.mkdirs(); @@ -516,6 +517,11 @@ public class RewritePhase { File artifactSource = artifact.getFile(); + if ( artifactSource.getCanonicalFile().equals( artifactTarget.getCanonicalFile() ) ) + { + return; + } + InputStream inStream = null; OutputStream outStream = null; try