This fixes spurious cycle exception bug. AVMContext is public to

allow reallybad.jsp to work so that we have a way of browsing and 
modifying content in the AVM repository in a running Alfresco 
instance, until I get AVMNodeService fully hooked up.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3541 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park 2006-08-17 18:30:34 +00:00
parent 19544c2574
commit 0135279f47
2 changed files with 24 additions and 27 deletions

View File

@ -14,7 +14,7 @@ import org.springframework.context.ApplicationContextAware;
* point for access to needed global instances. * point for access to needed global instances.
* @author britt * @author britt
*/ */
class AVMContext implements ApplicationContextAware public class AVMContext implements ApplicationContextAware
{ {
/** /**
* The single instance of an AVMContext. * The single instance of an AVMContext.

View File

@ -719,6 +719,8 @@ class AVMRepository
public Lookup lookup(int version, String path) public Lookup lookup(int version, String path)
{ {
Integer count = fLookupCount.get(); Integer count = fLookupCount.get();
try
{
if (count == null) if (count == null)
{ {
fLookupCount.set(1); fLookupCount.set(1);
@ -729,16 +731,20 @@ class AVMRepository
} }
if (fLookupCount.get() > 50) if (fLookupCount.get() > 50)
{ {
// throw new AVMCycleException("Cycle in lookup."); throw new AVMCycleException("Cycle in lookup.");
} }
String [] pathParts = SplitPath(path); String [] pathParts = SplitPath(path);
AVMStore store = getAVMStoreByName(pathParts[0]); AVMStore store = getAVMStoreByName(pathParts[0]);
Lookup result = store.lookup(version, pathParts[1], false); Lookup result = store.lookup(version, pathParts[1], false);
return result;
}
finally
{
if (count == null) if (count == null)
{ {
fLookupCount.set(null); fLookupCount.set(null);
} }
return result; }
} }
/** /**
@ -789,18 +795,9 @@ class AVMRepository
*/ */
public Lookup lookupDirectory(int version, String path) public Lookup lookupDirectory(int version, String path)
{ {
Integer count = fLookupCount.get();
if (count == null)
{
fLookupCount.set(1);
}
else
{
fLookupCount.set(count + 1);
}
if (fLookupCount.get() > 50) if (fLookupCount.get() > 50)
{ {
// throw new AVMCycleException("Cycle in lookup."); throw new AVMCycleException("Cycle in lookup.");
} }
String [] pathParts = SplitPath(path); String [] pathParts = SplitPath(path);
AVMStore store = getAVMStoreByName(pathParts[0]); AVMStore store = getAVMStoreByName(pathParts[0]);