From svn-return-7687-apmail-forrest-svn-archive=forrest.apache.org@forrest.apache.org Mon Jun 30 13:10:03 2008 Return-Path: Delivered-To: apmail-forrest-svn-archive@www.apache.org Received: (qmail 34680 invoked from network); 30 Jun 2008 13:10:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jun 2008 13:10:02 -0000 Received: (qmail 80225 invoked by uid 500); 30 Jun 2008 13:10:04 -0000 Delivered-To: apmail-forrest-svn-archive@forrest.apache.org Received: (qmail 80192 invoked by uid 500); 30 Jun 2008 13:10:04 -0000 Mailing-List: contact svn-help@forrest.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Forrest Developers List" List-Id: Delivered-To: mailing list svn@forrest.apache.org Received: (qmail 80183 invoked by uid 99); 30 Jun 2008 13:10:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jun 2008 06:10:04 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jun 2008 13:09:21 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DBBB123889C4; Mon, 30 Jun 2008 06:09:41 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r672757 - /forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java Date: Mon, 30 Jun 2008 13:09:41 -0000 To: svn@forrest.apache.org From: thorsten@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080630130941.DBBB123889C4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: thorsten Date: Mon Jun 30 06:09:41 2008 New Revision: 672757 URL: http://svn.apache.org/viewvc?rev=672757&view=rev Log: Enhancing lookup of locations. If cached result has null location we will try to resolve it again. Modified: forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java Modified: forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java URL: http://svn.apache.org/viewvc/forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java?rev=672757&r1=672756&r2=672757&view=diff ============================================================================== --- forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java (original) +++ forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java Mon Jun 30 06:09:41 2008 @@ -208,23 +208,18 @@ } hasBeenCached = m_locationsCache.containsKey(name); - if (hasBeenCached == true) { + if (hasBeenCached == true && m_locationsCache.get(name)!=null) { result = m_locationsCache.get(name); if (getLogger().isDebugEnabled()) { getLogger().debug("Locationmap cached location returned for hint: " + name + " value: " + result); } - } + }else{ + result = getFreshResult(name, objectModel); + } } if (hasBeenCached == false) { - result = getLocationMap().locate(name,objectModel); - - if (m_cacheAll == true) { - m_locationsCache.put(name,result); - if (getLogger().isDebugEnabled()) { - getLogger().debug("Locationmap caching hint: " + name + " value: " + result); - } - } + result = getFreshResult(name, objectModel); } if (result == null) { @@ -243,6 +238,20 @@ return null; } + private Object getFreshResult(final String name, final Map objectModel) + throws Exception { + Object result; + result = getLocationMap().locate(name,objectModel); + + if (m_cacheAll == true) { + m_locationsCache.put(name,result); + if (getLogger().isDebugEnabled()) { + getLogger().debug("Locationmap caching hint: " + name + " value: " + result); + } + } + return result; + } + /** * The possibilities are endless. No way to enumerate them all. * Therefore returns null.