Re: RSS renderer trouble



Hello, Lukas.

One of the earlier version of the renderer tried to display the first n
words of the weblog entry.  However, if the weblog entry contained less
than n words, then the renderer would barf.

It looks like the patch for this fix hasn't been committed to cvs yet --
in fact, I'm not sure I even posted it to the list.  (My laptop has been
mostly dead all week.)  I will commit the patch that should correct this
problem. 

(I've also attached the patch to this e-mail message.)

--Kevin Godby  <godbyk yahoo com>


On Fri, 2004-03-05 at 21:49 +0100, Lukas Lipka wrote:

> I get an error while trying to render an RSS file. What could be the 
> problem?
> 
> Here is the output:
> 
> <-- matches -- RSS (Matches: 119, New Clues: 0)
> Incorporating backend result into engine result
>  
> Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out 
> of range
> in [0x0001c] (at /tmp/xx/mcs-0.30.1/class/corlib/System/String.cs:1047) 
> System.String:Join (string,string[],int,int)
> in [0x000c2] (at 
> /home/lukas/downloads/dashboard/renderers/RSSMatchRenderer.cs:118) 
> Dashboard.RSSMatchRenderer:HTMLRenderSingleRSSItem 
> (Dashboard.Match,System.Xml.XmlWriter,bool)
> in [0x000da] (at 
> /home/lukas/downloads/dashboard/renderers/RSSMatchRenderer.cs:90) 
> Dashboard.RSSMatchRenderer:HTMLRenderSingleRSSTitle 
> (string,System.Collections.ArrayList,System.Xml.XmlWriter)
> in [0x000b8] (at 
> /home/lukas/downloads/dashboard/renderers/RSSMatchRenderer.cs:55) 
> Dashboard.RSSMatchRenderer:HTMLRenderMatches (System.Collections.ArrayList)
> in [0x0003b] (at /home/lukas/downloads/dashboard/engine/gui.cs:296) 
> Dashboard.Window:MatchesToHtml (System.Collections.ArrayList)
> in [0x000ca] (at /home/lukas/downloads/dashboard/engine/gui.cs:277) 
> Dashboard.Window:EngineMatchSetToHtmlGroupByType (Dashboard.EngineMatchSet)
> in [0x00028] (at /home/lukas/downloads/dashboard/engine/gui.cs:212) 
> Dashboard.Window:UpdateGUI ()
> in <0x0004e> (wrapper delegate-invoke) 
> System.MulticastDelegate:invoke_bool ()
> in <0x00014> GtkSharp.FunctionWrapper:NativeCallback (intptr)
> in <0x00034> (wrapper native-to-managed) 
> GtkSharp.FunctionWrapper:NativeCallback (intptr)
> in (unmanaged) (wrapper managed-to-native) Gtk.Application:gtk_main ()
> in <0x00004> (wrapper managed-to-native) Gtk.Application:gtk_main ()
> in <0x00007> Gtk.Application:Run ()
> in <0x00007> Gnome.Program:Run ()
> in [0x00032] (at /home/lukas/downloads/dashboard/engine/dashboard.cs:36) 
> Dashboard.Driver:Main (string[])
>  
> Found an RSS 1.0 feed.
> <-- matches -- RSS (Matches: 119, New Clues: 0)
> Incorporating backend result into engine result
> 
> --lukas

--- dashboard-pristine-2004-03-05/renderers/RSSMatchRenderer.cs	2004-03-05 00:28:49.000000000 -0600
+++ dashboard/renderers/RSSMatchRenderer.cs	2004-03-05 14:57:22.000000000 -0600
@@ -114,7 +114,15 @@
 
 			// Grab first few words...
 			string [] words = BareDescription.Split (' ');
-			string Blurb = String.Join (" ", words, 0, 20);
+
+			int MaxWords;
+			if (words.Length > 20) {
+				MaxWords = 20;
+			} else {
+				MaxWords = words.Length;
+			}
+
+			string Blurb = String.Join (" ", words, 0, MaxWords);
 			Sentence = Blurb + " . . .";
 
 			xw.WriteStartElement ("tr");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]