Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/beagle/ChangeLog,v
retrieving revision 1.248
diff -u -p -r1.248 ChangeLog
--- ChangeLog	21 Oct 2005 01:23:55 -0000	1.248
+++ ChangeLog	21 Oct 2005 13:32:35 -0000
@@ -1,3 +1,9 @@
+2005-10-21  Veerapuram Varadhan <vvaradhan@novell.com>
+
+	* BeagleClient/Indexable.cs: Check for the non-existence of both
+	Reader and Stream before returning a reader or stream from
+	GetTextReader() and GetBinaryStream (). Fixes 315056.
+
 2005-10-20  Debajyoti Bera <dbera.web@gmail.org>
 
 	* BlamQueryable.cs, LifereaQueryable.cs, AkregatorQueryable.cs:
Index: BeagleClient/Indexable.cs
===================================================================
RCS file: /cvs/gnome/beagle/BeagleClient/Indexable.cs,v
retrieving revision 1.38
diff -u -p -r1.38 Indexable.cs
--- BeagleClient/Indexable.cs	10 Oct 2005 21:02:19 -0000	1.38
+++ BeagleClient/Indexable.cs	21 Oct 2005 13:29:02 -0000
@@ -321,8 +321,17 @@ namespace Beagle {
 		{
 			if (NoContent)
 				return null;
-
-			if (textReader == null)
+			
+			// If we don't have a textReader or
+			// a binary_stream, then try to get it from
+			// the URI. This way we can avoid returning
+			// a TextReader instead of a Stream for 
+			// any binary-content.
+			// Ex: Child indexables of FilterArchive set
+			// binary streams and when TextReader is returned
+			// the "binary" contents don't get indexed.
+			if (textReader == null &&
+			    binary_stream == null)
 				textReader = ReaderFromUri (ContentUri);
 
 			return textReader;
@@ -338,7 +347,10 @@ namespace Beagle {
 			if (NoContent)
 				return null;
 
-			if (hotTextReader == null)
+			// Return a hotTextReader, iff a
+			// textReader is present.
+			if (hotTextReader == null &&
+			    textReader != null)
 				hotTextReader = ReaderFromUri (HotContentUri);
 			return hotTextReader;
 		}
@@ -353,7 +365,11 @@ namespace Beagle {
 			if (NoContent)
 				return null;
 
-			if (binary_stream == null)
+			// Try to generate a Stream from the ContentUri,
+			// iff textReader is null.
+			// See GetTextReader () for a more-detailed-comment. ;-)
+			if (binary_stream == null &&
+			    textReader == null)
 				binary_stream = StreamFromUri (ContentUri);
 
 			return binary_stream;
@@ -549,6 +565,9 @@ namespace Beagle {
 				if (read > 0)
 					bufferedStream.Write (buffer, 0, read);
 			} while (read > 0);
+
+			// Reset the position to point to the start of the stream
+			stream.Seek (0, SeekOrigin.Begin);
 
 			bufferedStream.Close ();
 
