mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Relaxed path requirements. foo://figwump/thneedle///wart/ is now seen
as equivalent to foo:/figwump/thneedle/wart. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3392 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,6 +39,24 @@ import org.alfresco.service.namespace.QName;
|
|||||||
*/
|
*/
|
||||||
public class AVMServiceTest extends AVMServiceTestBase
|
public class AVMServiceTest extends AVMServiceTestBase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Test goofy paths.
|
||||||
|
*/
|
||||||
|
public void testGoofyPaths()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
setupBasicTree();
|
||||||
|
fService.getFileInputStream(-1, "main://a/b/c/foo").close();
|
||||||
|
fService.getDirectoryListing(-1, "main:/a/");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test getting deleted names.
|
* Test getting deleted names.
|
||||||
*/
|
*/
|
||||||
|
@@ -519,18 +519,21 @@ class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
{
|
{
|
||||||
throw new AVMException("Invalid path: " + path);
|
throw new AVMException("Invalid path: " + path);
|
||||||
}
|
}
|
||||||
if (path.length() > 1)
|
while (path.startsWith("/"))
|
||||||
{
|
{
|
||||||
path = path.substring(1);
|
path = path.substring(1);
|
||||||
}
|
}
|
||||||
String[] pathElements = path.split("/");
|
while (path.endsWith("/"))
|
||||||
|
{
|
||||||
|
path = path.substring(0, path.length() - 1);
|
||||||
|
}
|
||||||
|
String[] pathElements = path.split("/+");
|
||||||
// Grab the root node to start the lookup.
|
// Grab the root node to start the lookup.
|
||||||
DirectoryNode dir = null;
|
DirectoryNode dir = null;
|
||||||
// Versions less than 0 mean get current.
|
// Versions less than 0 mean get current.
|
||||||
if (version < 0)
|
if (version < 0)
|
||||||
{
|
{
|
||||||
dir = fRoot; // TODO How to factor out this kind of Hibernate goofiness.
|
dir = fRoot;
|
||||||
// (DirectoryNode)AVMNodeUnwrapper.Unwrap(fRoot);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -539,7 +542,7 @@ class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
// Add an entry for the root.
|
// Add an entry for the root.
|
||||||
result.add(dir, "", write);
|
result.add(dir, "", write);
|
||||||
dir = (DirectoryNode)result.getCurrentNode();
|
dir = (DirectoryNode)result.getCurrentNode();
|
||||||
if (pathElements.length == 0)
|
if (pathElements.length == 1 && pathElements[0].equals(""))
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user