Author: daniele
Date: 2007-06-01 14:36:20 +0200 (Fri, 01 Jun 2007)
New Revision: 5251

Modified:
   
branches/2.13/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueSearchCommand.java
Log:
SEARCH-2085: back once again to Boolean objects, seems there was a good reason 
for them to be that way.

Modified: 
branches/2.13/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueSearchCommand.java
===================================================================
--- 
branches/2.13/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueSearchCommand.java
  2007-06-01 11:10:31 UTC (rev 5250)
+++ 
branches/2.13/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueSearchCommand.java
  2007-06-01 12:36:20 UTC (rev 5251)
@@ -79,8 +79,8 @@
     /** boolean flags to which get set during visitor pass.
      *  used by getSortBy to determin which rank profile to use.
      */
-    private boolean whoQueryIsCompanyName;
-    private boolean whoQueryIsKeyword;
+    private Boolean whoQueryIsCompanyName = null;
+    private Boolean whoQueryIsKeyword = null;
     
     /** Logger for this class. */
     private static final Logger LOG = 
Logger.getLogger(CatalogueSearchCommand.class);
@@ -418,7 +418,12 @@
         }else if(GeoSearchUtil.isGeoSearch(datamodel.getParameters())){    
             sortBy="iypgeosortable";
         }else{
-             sortBy = whoQueryIsKeyword
+
+            // must have values, to prevent NPE in infopage.
+            if(whoQueryIsKeyword==null) whoQueryIsKeyword = false;
+            if(whoQueryIsCompanyName==null) whoQueryIsCompanyName = false;
+            
+            sortBy = whoQueryIsKeyword
                      ? SORTBY_KEYWORD
                      : whoQueryIsCompanyName ? SORTBY_COMPANYNAME : 
super.getSortBy();
         }
@@ -581,7 +586,7 @@
     private void checkQueryForKeyword(final Clause clause){
        
         // check if this is a known keyword.
-        if(!whoQueryIsKeyword){
+        if(null == whoQueryIsKeyword){
             whoQueryIsKeyword = 
clause.getKnownPredicates().contains(TokenPredicate.COMPANY_KEYWORD);
         }
     }
@@ -589,7 +594,7 @@
     private void checkQueryForCompanyname(final Clause clause){
     
         // check if this is a known company name.
-        if(!whoQueryIsCompanyName){
+        if(null == whoQueryIsCompanyName){
             whoQueryIsCompanyName = 
clause.getKnownPredicates().contains(TokenPredicate.COMPANYENRICHMENT);
         }
     }

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to