split path using Pattern.quote to be windoz friendly

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1383613 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
skygo 2012-09-11 21:12:32 +00:00
parent 23204cdc28
commit 0495fe9bc6
1 changed files with 4 additions and 3 deletions

View File

@ -54,6 +54,7 @@ import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.regex.Pattern;
/** /**
* *
@ -203,9 +204,9 @@ public class Maven2RepositoryMerger
METADATA_FILENAME ); METADATA_FILENAME );
if ( versionMetaDataFileInSourceRepo.exists() ) if ( versionMetaDataFileInSourceRepo.exists() )
{ {//Pattern quote for windows path
String relativePathToVersionMetadataFile = String relativePathToVersionMetadataFile =
versionMetaDataFileInSourceRepo.getAbsolutePath().split( sourceRepoPath )[1]; versionMetaDataFileInSourceRepo.getAbsolutePath().split( Pattern.quote( sourceRepoPath ) )[1];
File versionMetaDataFileInTargetRepo = new File( targetRepoPath, relativePathToVersionMetadataFile ); File versionMetaDataFileInTargetRepo = new File( targetRepoPath, relativePathToVersionMetadataFile );
if ( !versionMetaDataFileInTargetRepo.exists() ) if ( !versionMetaDataFileInTargetRepo.exists() )
@ -226,7 +227,7 @@ public class Maven2RepositoryMerger
if ( projectMetadataFileInSourceRepo.exists() ) if ( projectMetadataFileInSourceRepo.exists() )
{ {
String relativePathToProjectMetadataFile = String relativePathToProjectMetadataFile =
projectMetadataFileInSourceRepo.getAbsolutePath().split( sourceRepoPath )[1]; projectMetadataFileInSourceRepo.getAbsolutePath().split( Pattern.quote( sourceRepoPath ) )[1];
File projectMetadataFileInTargetRepo = new File( targetRepoPath, relativePathToProjectMetadataFile ); File projectMetadataFileInTargetRepo = new File( targetRepoPath, relativePathToProjectMetadataFile );
if ( !projectMetadataFileInTargetRepo.exists() ) if ( !projectMetadataFileInTargetRepo.exists() )