You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by vg...@apache.org on 2007/04/08 23:26:05 UTC

svn commit: r526603 - /xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java

Author: vgritsenko
Date: Sun Apr  8 14:26:04 2007
New Revision: 526603

URL: http://svn.apache.org/viewvc?view=rev&rev=526603
Log:
fix NPE in case collection is not compressed

Modified:
    xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java

Modified: xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java?view=diff&rev=526603&r1=526602&r2=526603
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java Sun Apr  8 14:26:04 2007
@@ -25,6 +25,7 @@
 import org.apache.xindice.server.rpc.RPCDefaultMessage;
 import org.apache.xindice.util.SymbolSerializer;
 import org.apache.xindice.xml.TextWriter;
+import org.apache.xindice.xml.dom.CompressedDocument;
 
 import org.w3c.dom.Document;
 
@@ -78,15 +79,16 @@
             int timestamp = ((Integer) message.get("timestamp")).intValue();
             */
 
-            Document doc = (Document)obj;
-            if (/*( timestamp != -1) &&*/ (symbolSerializer != null)) {
+            // Document might be compressed (with bytes) or not. In a latter case, convert to string.
+            Document doc = (Document) obj;
+            if (/*( timestamp != -1) &&*/ symbolSerializer != null && ((CompressedDocument) doc).getDataBytes() != null) {
                 result.put(RESULT,
                            symbolSerializer.convertFromDocument(doc, timestamp));
             } else {
                 result.put(RESULT, TextWriter.toString(doc));
             }
         } else {
-            Document doc = (Document)obj;
+            Document doc = (Document) obj;
             result.put(RESULT, TextWriter.toString(doc));
         }