Prefer string replacement over regular expression

Previously this method threw an PatternSyntaxException due to a
missing level of escaping.  Also remove bogus test.
This commit is contained in:
Andrew Gaul 2012-07-30 11:51:24 -07:00 committed by Andrew Gaul
parent 3c2a9c9614
commit e253f539d6
2 changed files with 2 additions and 11 deletions

View File

@ -349,10 +349,10 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
* @param pathToBeNormalized
* @return
*/
private String normalize(String pathToBeNormalized) {
private static String normalize(String pathToBeNormalized) {
if (null != pathToBeNormalized && pathToBeNormalized.contains(BACK_SLASH)) {
if (!BACK_SLASH.equals(File.separator)) {
return pathToBeNormalized.replaceAll(BACK_SLASH, File.separator);
return pathToBeNormalized.replace(BACK_SLASH, File.separator);
}
}
return pathToBeNormalized;

View File

@ -123,15 +123,6 @@ public class FilesystemStorageStrategyImplTest {
storageStrategy.createDirectory(CONTAINER_NAME, null);
}
@Test(dataProvider = "ignoreOnWindows", description = "see http://code.google.com/p/jclouds/issues/detail?id=737")
public void testCreateDirectory_WrongDirectoryName() {
try {
storageStrategy.createDirectory(CONTAINER_NAME, "$%&!'`\\/");
fail("No exception thrown");
} catch (Exception e) {
}
}
public void testCreateContainer() {
boolean result;