From 0135279f47d66c33bb12ca99fec7dfc27dd90ecd Mon Sep 17 00:00:00 2001 From: Britt Park Date: Thu, 17 Aug 2006 18:30:34 +0000 Subject: [PATCH] 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 --- .../org/alfresco/repo/avm/AVMContext.java | 2 +- .../org/alfresco/repo/avm/AVMRepository.java | 49 +++++++++---------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/source/java/org/alfresco/repo/avm/AVMContext.java b/source/java/org/alfresco/repo/avm/AVMContext.java index 9b4f7df4f5..1af884aa50 100644 --- a/source/java/org/alfresco/repo/avm/AVMContext.java +++ b/source/java/org/alfresco/repo/avm/AVMContext.java @@ -14,7 +14,7 @@ import org.springframework.context.ApplicationContextAware; * point for access to needed global instances. * @author britt */ -class AVMContext implements ApplicationContextAware +public class AVMContext implements ApplicationContextAware { /** * The single instance of an AVMContext. diff --git a/source/java/org/alfresco/repo/avm/AVMRepository.java b/source/java/org/alfresco/repo/avm/AVMRepository.java index 6aefc83888..3f1cd2597d 100644 --- a/source/java/org/alfresco/repo/avm/AVMRepository.java +++ b/source/java/org/alfresco/repo/avm/AVMRepository.java @@ -719,26 +719,32 @@ class AVMRepository public Lookup lookup(int version, String path) { Integer count = fLookupCount.get(); - if (count == null) + try { - fLookupCount.set(1); + if (count == null) + { + fLookupCount.set(1); + } + else + { + fLookupCount.set(count + 1); + } + if (fLookupCount.get() > 50) + { + throw new AVMCycleException("Cycle in lookup."); + } + String [] pathParts = SplitPath(path); + AVMStore store = getAVMStoreByName(pathParts[0]); + Lookup result = store.lookup(version, pathParts[1], false); + return result; } - else + finally { - fLookupCount.set(count + 1); + if (count == null) + { + fLookupCount.set(null); + } } - if (fLookupCount.get() > 50) - { - // throw new AVMCycleException("Cycle in lookup."); - } - String [] pathParts = SplitPath(path); - AVMStore store = getAVMStoreByName(pathParts[0]); - Lookup result = store.lookup(version, pathParts[1], false); - if (count == null) - { - fLookupCount.set(null); - } - return result; } /** @@ -789,18 +795,9 @@ class AVMRepository */ 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) { - // throw new AVMCycleException("Cycle in lookup."); + throw new AVMCycleException("Cycle in lookup."); } String [] pathParts = SplitPath(path); AVMStore store = getAVMStoreByName(pathParts[0]);