velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r546186 - /velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java
Date Mon, 11 Jun 2007 16:36:16 GMT
Author: nbubna
Date: Mon Jun 11 09:36:15 2007
New Revision: 546186

URL: http://svn.apache.org/viewvc?view=rev&rev=546186
Log:
make criteria handling more subclass-friendly

Modified:
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java?view=diff&rev=546186&r1=546185&r2=546186
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java
(original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java
Mon Jun 11 09:36:15 2007
@@ -149,10 +149,10 @@
         super.setup(request);
 
         // only change these settings if they're present in the params
-        String criteria = request.getParameter(getCriteriaKey());
-        if (criteria != null)
+        String findMe = request.getParameter(getCriteriaKey());
+        if (findMe != null)
         {
-            setCriteria(criteria);
+            setCriteria(findMe);
         }
     }
 
@@ -176,7 +176,7 @@
     public void reset()
     {
         super.reset();
-        criteria = null;
+        setCriteria(null);
     }
 
 
@@ -215,8 +215,9 @@
      */
     public List getItems()
     {
+        Object findMe = getCriteria();
         /* return empty list if we have no criteria */
-        if (criteria == null)
+        if (findMe == null)
         {
             return Collections.EMPTY_LIST;
         }
@@ -231,11 +232,15 @@
             /* safely perform a new query */
             try
             {
-                list = executeQuery(criteria);
+                list = executeQuery(findMe);
             }
             catch (Throwable t)
             {
-                LOG.error("AbstractSearchTool : failed to execute query", t);
+                if (LOG != null)
+                {
+                    LOG.error("AbstractSearchTool: executeQuery(" + findMe +
+                              ") failed", t);
+                }
             }
 
             /* because we can't trust executeQuery() not to return null
@@ -260,7 +265,7 @@
 
         /* if the criteria equals that of the stored results,
          * then return the stored result list */
-        if (sr != null && criteria.equals(sr.getCriteria()))
+        if (sr != null && getCriteria().equals(sr.getCriteria()))
         {
             return sr.getList();
         }
@@ -270,7 +275,7 @@
 
     protected void setStoredItems(List items)
     {
-        setStoredResults(new StoredResults(criteria, items));
+        setStoredResults(new StoredResults(getCriteria(), items));
     }
 
 



Mime
View raw message