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 vl...@apache.org on 2002/11/17 21:32:48 UTC
cvs commit: xml-xindice/java/src/org/apache/xindice/server XindiceServlet.java
vladimir 2002/11/17 12:32:47
Modified: java/src/org/apache/xindice/server XindiceServlet.java
Log:
Some fixes using the Configuration class
Revision Changes Path
1.7 +13 -11 xml-xindice/java/src/org/apache/xindice/server/XindiceServlet.java
Index: XindiceServlet.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/server/XindiceServlet.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XindiceServlet.java 25 Oct 2002 08:21:12 -0000 1.6
+++ XindiceServlet.java 17 Nov 2002 20:32:47 -0000 1.7
@@ -120,16 +120,18 @@
throw new ServletException("Could not load database configuration", e);
}
- // The configuration is wrapped in a xindice element so we need to
- // pull root-collection.
- Element root = configuration.getDocumentElement();
- Node first = root.getElementsByTagName("root-collection").item(0);
- if ((first.getNodeType() == Node.ELEMENT_NODE) &&
- first.getNodeName().equals("root-collection")) {
- db.setConfig(new Configuration((Element) first, false));
- } else {
- throw new ServletException("The database configuration is missing the" +
- " root-collection element");
+ // The configuration is wrapped in a <xindice> element so we need to get
+ // the "root-collection" configuration.
+ Configuration conf = new Configuration(configuration, false);
+ try {
+ conf = conf.getChild("root-collection", false);
+ if (conf != null) {
+ db.setConfig(conf);
+ } else {
+ throw new ServletException("The database configuration is missing the <root-collection> element");
+ }
+ } catch (Exception e) {
+ throw new ServletException("Error while handling the configuration", e);
}
// Setup the XML-RPC impl to support UTF-8 input via Xerces.