mirror of https://github.com/apache/jclouds.git
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:
parent
3c2a9c9614
commit
e253f539d6
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue