Merge pull request #763 from andrewgaul/filesystem-replace

Prefer string replacement over regular expression
This commit is contained in:
Adrian Cole 2012-07-30 14:16:14 -07:00
commit 00f5f0367d
2 changed files with 2 additions and 11 deletions

View File

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

View File

@ -123,15 +123,6 @@ public class FilesystemStorageStrategyImplTest {
storageStrategy.createDirectory(CONTAINER_NAME, null); 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() { public void testCreateContainer() {
boolean result; boolean result;