vgritsenko 2003/12/19 05:55:28
Modified: java/src/org/apache/xindice/client/xmldb/embed
CollectionImpl.java
java/src/org/apache/xindice/server/rpc/messages Query.java
Log:
Found some duplicated code. Have not done any refactorings
as may be Kevin is working on this piece of code
Revision Changes Path
1.26 +9 -3
xml-xindice/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java
Index: CollectionImpl.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- CollectionImpl.java 12 Dec 2003 01:27:22 -0000 1.25
+++ CollectionImpl.java 19 Dec 2003 13:55:28 -0000 1.26
@@ -583,6 +583,12 @@
// search result handling
private Document nodesetToDocument(NodeSet ns) {
+
+ //
+ // FIXME: There is a copy of this same code in
org.apache.xindice.server.xmldb.rpc.messages.Query#queryWrapper
+ // It should be refactored into some common place. May be,
NodeSetUtil?
+ //
+
// Turn the NodeSet into a document.
DocumentImpl doc = new DocumentImpl();
@@ -608,7 +614,7 @@
} else if (element instanceof String) {
root.appendChild(doc.createTextNode((String) element));
} else {
- throw new XindiceRuntimeException("Unknown result type (" +
element.getClass().getName() + "in nodeset");
+ throw new XindiceRuntimeException("Unknown result type (" +
element.getClass().getName() + ") in nodeset");
}
count++;
1.8 +9 -6
xml-xindice/java/src/org/apache/xindice/server/rpc/messages/Query.java
Index: Query.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/server/rpc/messages/Query.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Query.java 9 Aug 2003 21:19:53 -0000 1.7
+++ Query.java 19 Dec 2003 13:55:28 -0000 1.8
@@ -143,9 +143,14 @@
*
* @param ns The NodeSet containing the query results.
* @return the result set as an XML document
- * @exception Exception
*/
private String queryWrapper(NodeSet ns) {
+
+ //
+ // FIXME: There is a copy of this same code in
org.apache.xindice.client.xmldb.embed.CollectionImpl#nodesetToDocument
+ // It should be refactored into some common place. May be,
NodeSetUtil?
+ //
+
// Turn the NodeSet into a document.
DocumentImpl doc = new DocumentImpl();
@@ -178,7 +183,7 @@
}
else
{
- throw new XindiceRuntimeException("Unknown result type (" +
element.getClass().getName() + "in nodeset");
+ throw new XindiceRuntimeException("Unknown result type (" +
element.getClass().getName() + ") in nodeset");
}
count++;
@@ -186,8 +191,6 @@
}
root.setAttribute("count", Integer.toString(count));
-
return TextWriter.toString(doc);
}
-
}