Author: ssmiweve
Date: 2008-04-22 22:23:38 +0200 (Tue, 22 Apr 2008)
New Revision: 6538

Modified:
   
branches/2.17/core-api/src/main/java/no/sesat/search/view/output/SyndicationGenerator.java
Log:
SEARCH-4661 - NullPointerException: <init>(SyndicationGenerator.java:133)

Modified: 
branches/2.17/core-api/src/main/java/no/sesat/search/view/output/SyndicationGenerator.java
===================================================================
--- 
branches/2.17/core-api/src/main/java/no/sesat/search/view/output/SyndicationGenerator.java
  2008-04-22 18:07:54 UTC (rev 6537)
+++ 
branches/2.17/core-api/src/main/java/no/sesat/search/view/output/SyndicationGenerator.java
  2008-04-22 20:23:38 UTC (rev 6538)
@@ -63,6 +63,8 @@
 import java.util.List;
 import java.util.Properties;
 import java.util.TimeZone;
+import javax.resource.NotSupportedException;
+import no.sesat.search.result.BasicResultList;
 
 /**
  * Used by the rssDecorator.jsp to print out the results in rss format.
@@ -125,17 +127,21 @@
      * Creates a new instance.
      *
      * @param context The context this class needs to do its work.
+     * @throws SyndicationNotSupportedException 
      */
-    public SyndicationGenerator(final Context context) {
+    public SyndicationGenerator(final Context context) throws 
SyndicationNotSupportedException{
+        
+        if(null == context.getTab().getRssResultName()){ throw new 
SyndicationNotSupportedException(); }
 
         this.context = context;
 
-        this.result = 
context.getDataModel().getSearch(context.getTab().getRssResultName()).getResults();
+        this.result = null != 
context.getDataModel().getSearch(context.getTab().getRssResultName())
+                ? 
context.getDataModel().getSearch(context.getTab().getRssResultName()).getResults()
+                : new BasicResultList<ResultItem>();
+        
         this.site = context.getSite();
 
         this.text = TextMessages.valueOf(getTextMessagesContext());
-        //this.channels = Channels.instanceOf(getChannelContext());
-
         this.uri = context.getURL();
 
         final String type = getParameter("feedType");
@@ -387,4 +393,8 @@
 //    }
     
     // Inner classes -------------------------------------------------
+    
+    public static final class SyndicationNotSupportedException extends 
Exception{
+        
+    }
 }

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

Reply via email to