Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java	(revision 9798)
@@ -52,7 +52,11 @@
     public String process(String xml_in) {
        
-	Element message = this.converter.getDOM(xml_in).getDocumentElement();
-	
-	Element result = process(message);
+	Document message_doc = this.converter.getDOM(xml_in);
+	if (message_doc == null) {
+	    System.err.println("Action.process(String) Error: Couldn't parse request");
+	    System.err.println(xml_in);
+	    return null;
+	}
+	Element result = process(message_doc.getDocumentElement());
 	return this.converter.getString(result);
     }
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java	(revision 9798)
@@ -101,5 +101,9 @@
 	}
 	// get the xml for both files
-	Element coll_config_elem = this.converter.getDOM(coll_config_file, CONFIG_ENCODING).getDocumentElement();
+	Document coll_config_doc = this.converter.getDOM(coll_config_file, CONFIG_ENCODING);
+	Element coll_config_elem = null;
+	if (coll_config_doc != null) {
+	    coll_config_elem = coll_config_doc.getDocumentElement();
+	}
 	return coll_config_elem;
 
@@ -116,6 +120,9 @@
 	    return null;
 	}
-	Element build_config_elem = this.converter.getDOM(build_config_file, CONFIG_ENCODING).getDocumentElement();
-
+	Document build_config_doc = this.converter.getDOM(build_config_file, CONFIG_ENCODING);
+	Element build_config_elem = null;
+	if (build_config_doc != null) {
+	    build_config_elem = build_config_doc.getDocumentElement();
+	}
 	return build_config_elem;
     }
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java	(revision 9798)
@@ -139,4 +139,8 @@
 
 	Document doc = this.converter.getDOM(config_file, CONFIG_ENCODING);
+	if (doc == null) {
+	    System.err.println("ServiceCluster: couldn't parse config file "+config_file.getPath());
+	    return false;
+	}
 	
 	// get the appropriate service cluster element
@@ -147,5 +151,5 @@
 	return this.configure(sc);
     }
- 
+    
     
     public boolean configure(Element service_cluster_info) {
@@ -159,5 +163,5 @@
 	    }
 	}
-
+	
 	// get the display info
 	Element display_list = (Element) GSXML.getChildByTagName(service_cluster_info, GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER);
@@ -528,5 +532,11 @@
 	}
 	
-	Element site_config_elem  = this.converter.getDOM(configFile).getDocumentElement();
+	Document site_config_doc  = this.converter.getDOM(configFile);
+	if (site_config_doc == null) {
+	    System.err.println("ServiceCluster: could not read in site config file: "+configFile.getPath());
+	    return false;
+	}
+	
+	Element site_config_elem = site_config_doc.getDocumentElement();
 	Element cluster_config_elem = GSXML.getNamedElement((Element)GSXML.getChildByTagName(site_config_elem, GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER), GSXML.CLUSTER_ELEM, GSXML.NAME_ATT, this.cluster_name);
 	if (cluster_config_elem == null) {
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java	(revision 9798)
@@ -133,7 +133,12 @@
 	this.module_map = new HashMap();
 
-	Element config = this.converter.getDOM(configFile).getDocumentElement();
-	
-	Element local_site_name = (Element)GSXML.getChildByTagName(config, GSXML.SITE_NAME_ELEM);
+	Document config_doc = this.converter.getDOM(configFile);
+	if (config_doc == null) {
+System.err.println("MessageRouter: couldn't parse site config file: "+configFile.getPath());
+	    return false;
+	}
+	Element config_elem = config_doc.getDocumentElement();
+	
+	Element local_site_name = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_NAME_ELEM);
 	if (local_site_name == null) {
 	    System.err.println("MessageRouter configure error:no site name in config file");
@@ -143,5 +148,5 @@
 	}
 	
-	Element http_address = (Element)GSXML.getChildByTagName(config, GSXML.SITE_HTTP_ADDRESS_ELEM);
+	Element http_address = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_HTTP_ADDRESS_ELEM);
 	if (http_address == null) {
 	    System.err.println("MessageRouter configure error: no http address  in config file");
@@ -151,5 +156,5 @@
 	}
 
-	Element proxy = (Element)GSXML.getChildByTagName(config, "proxy");
+	Element proxy = (Element)GSXML.getChildByTagName(config_elem, "proxy");
 	if (proxy != null) {
 	    String host = proxy.getAttribute("host");
@@ -180,9 +185,9 @@
 					 
 	// load up the services
-	Element service_rack_list = (Element)GSXML.getChildByTagName(config, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER);
+	Element service_rack_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER);
 	configureServices(service_rack_list);
 	
 	// load up the service clusters
-	Element cluster_list = (Element)GSXML.getChildByTagName(config, GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER);	
+	Element cluster_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER);	
 	configureClusters(cluster_list);
 
@@ -191,5 +196,5 @@
 
 	// load up the external sites - this also adds their services/clusters/collections to the other lists - so must be done last
-	Element site_list = (Element)GSXML.getChildByTagName(config, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER);
+	Element site_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER);
 	configureSites(site_list);
 	
@@ -603,5 +608,10 @@
 				    continue;
 				}
-				site_config_elem  = this.converter.getDOM(configFile).getDocumentElement();
+				Document site_config_doc = this.converter.getDOM(configFile);
+				if (site_config_doc == null) {
+				    System.err.println("MessageRouter: couldn't parse site config file: "+configFile.getPath());
+				    continue;
+				}
+				site_config_elem  = site_config_doc.getDocumentElement();
 			    }
 			    if (subset.equals(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER)) {
@@ -684,20 +694,23 @@
 	File init_file = new File(GSFile.collectionInitFile(this.site_home, col_name));
 	if (init_file.exists()) {
-	    Element init_elem = this.converter.getDOM(init_file).getDocumentElement();
-	    String coll_class_name = init_elem.getAttribute("class");
-	    if (coll_class_name.equals("")) {
-		c = new Collection();
-	    } else {
-		try {
-		    c = (Collection)Class.forName("org.greenstone.gsdl3.collection."+coll_class_name).newInstance();
-		} catch (Exception e) {
-		    System.out.println("MessageRouter: couldn't create a new collection, type "+coll_class_name+", defaulting to class Collection");
-		    c = new Collection();
-		}
-	    }
-	} else {
-	    // use the defualt collection
+	    Document init_doc = this.converter.getDOM(init_file);
+	    if (init_doc != null) {
+		Element init_elem = init_doc.getDocumentElement();
+		if (init_elem != null) {
+		    String coll_class_name = init_elem.getAttribute("class");
+		    if (!coll_class_name.equals("")) {
+			try {
+			    c = (Collection)Class.forName("org.greenstone.gsdl3.collection."+coll_class_name).newInstance();
+			} catch (Exception e) {
+			    System.out.println("MessageRouter: couldn't create a new collection, type "+coll_class_name+", defaulting to class Collection");
+			}
+		    }
+		}
+	    }
+	}
+	if (c==null) { // we haven't found anpther classname to use
 	    c = new Collection();
 	}
+	
 	c.setCollectionName(col_name);
 	c.setSiteHome(this.site_home);
@@ -720,5 +733,5 @@
 	
     }
-
+    
     protected boolean activateSite(String site_name) {
 	System.out.println("MessageRouter:Activating site: "+site_name+".");
@@ -732,7 +745,12 @@
 	    return false;
 	}
-	Element config = this.converter.getDOM(configFile).getDocumentElement();
-	
-	Element site_list = (Element)GSXML.getChildByTagName(config, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER);
+	Document config_doc = this.converter.getDOM(configFile);
+	if (config_doc == null) {
+	    System.err.println("MessageRouter: couldn't parse site config file: "+configFile.getPath());
+	    return false;
+	}
+	Element config_elem = config_doc.getDocumentElement();
+	
+	Element site_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER);
 	if (site_list ==null ) {
 	    System.err.println("MessageRouter:activateSite, no sites found");
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/Receptionist.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/Receptionist.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/Receptionist.java	(revision 9798)
@@ -81,11 +81,16 @@
 	}
 	
-	Element config_doc = this.converter.getDOM(interface_config_file).getDocumentElement();
-	String base_interface = config_doc.getAttribute("baseInterface");
+	Document config_doc = this.converter.getDOM(interface_config_file);
+	if (config_doc == null) {
+	    System.err.println("Receptionist: could not parse interface config file: "+interface_config_file.getPath());
+	    return false;
+	}
+	Element config_elem = config_doc.getDocumentElement();
+	String base_interface = config_elem.getAttribute("baseInterface");
 	setUpBaseInterface(base_interface);
-	setUpInterfaceOptions(config_doc);
+	setUpInterfaceOptions(config_elem);
 
 	// load up the actions
-	Element action_list = (Element)GSXML.getChildByTagName(config_doc, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER);
+	Element action_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER);
 	NodeList actions = action_list.getElementsByTagName(GSXML.ACTION_ELEM);
 
@@ -109,5 +114,5 @@
 	}
 
-	this.language_list = (Element)GSXML.getChildByTagName(config_doc, "languageList");
+	this.language_list = (Element)GSXML.getChildByTagName(config_elem, "languageList");
 	if (language_list == null) {
 	    System.err.println("Receptionist: didn't find a language list in the config file!!");
@@ -229,12 +234,17 @@
 	    base_interfaces.add(base_interface);
 	    // now see if this has a base interface
-	    Element config_doc = this.converter.getDOM(base_interface_config_file).getDocumentElement();
-	    base_interface = config_doc.getAttribute("baseInterface");
+	    Document config_doc = this.converter.getDOM(base_interface_config_file);
+	    if (config_doc == null) {
+		System.err.println("Receptionist: could not parse base interface config file: "+base_interface_config_file.getPath());
+		return false;
+	    }
+	    Element config_elem = config_doc.getDocumentElement();
+	    base_interface = config_elem.getAttribute("baseInterface");
 	}
 	return true;
     }
 
-    protected boolean setUpInterfaceOptions(Element config_doc) {
-	Element option_list = (Element)GSXML.getChildByTagName(config_doc, "optionList");
+    protected boolean setUpInterfaceOptions(Element config_elem) {
+	Element option_list = (Element)GSXML.getChildByTagName(config_elem, "optionList");
 	if (option_list != null) {
 	    System.err.println("found an option list");
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java	(revision 9798)
@@ -52,11 +52,15 @@
 	    return false;
 	}
-	
-	Element config_doc = this.converter.getDOM(interface_config_file, "utf-8").getDocumentElement();
-	String base_interface = config_doc.getAttribute("baseInterface");
+	Document config_doc = this.converter.getDOM(interface_config_file, "utf-8");
+	if (config_doc == null) {
+	    System.err.println("TransformingReceptionist: could not parse interface config file: "+interface_config_file.getPath());
+	    return false;
+	}
+	Element config_elem = config_doc.getDocumentElement();
+	String base_interface = config_elem.getAttribute("baseInterface");
 	setUpBaseInterface(base_interface);
-	setUpInterfaceOptions(config_doc);
-
-	Element action_list = (Element)GSXML.getChildByTagName(config_doc, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER);
+	setUpInterfaceOptions(config_elem);
+
+	Element action_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER);
 	NodeList actions = action_list.getElementsByTagName(GSXML.ACTION_ELEM);
 
@@ -97,5 +101,5 @@
 	   
 	}
-	Element lang_list = (Element)GSXML.getChildByTagName(config_doc, "languageList");
+	Element lang_list = (Element)GSXML.getChildByTagName(config_elem, "languageList");
 	if (lang_list == null) {
 	    System.err.println("TransformingReceptionist: didn't find a language list in the config file!!");
@@ -157,4 +161,9 @@
 	}
 	Document style_doc = this.converter.getDOM(new File(xslt_file), "UTF-8");
+	if (style_doc == null) {
+	    System.err.println("TransformingReceptionist: cant parse the xslt file needed, so returning the original page!");
+	    return page;
+	    
+	}
 
 	// look for the format element in the page response
@@ -166,12 +175,17 @@
 	    // need to transform the format info
 	    String stylesheet_file = GSFile.stylesheetFile((String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.SITE_NAME), collection, (String)this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces,   "config_format.xsl");
-	    Document stylesheet = this.converter.getDOM(new File(stylesheet_file));
-	    Document format_doc = this.converter.newDOM();
-	    format_doc.appendChild(format_doc.importNode(format_elem, true));
-	    Element new_format = (Element)this.transformer.transform(stylesheet, format_doc);
+	    Document stylesheet_doc = this.converter.getDOM(new File(stylesheet_file));
+	    if (stylesheet_doc != null) {
+		Document format_doc = this.converter.newDOM();
+		format_doc.appendChild(format_doc.importNode(format_elem, true));
+		Element new_format = (Element)this.transformer.transform(stylesheet_doc, format_doc);
 	    ///ystem.err.println("new format elem="+this.converter.getPrettyString(new_format));
 	    
 	    // add it in to the main stylesheet
-	    GSXSLT.mergeStylesheets(style_doc, new_format);
+		GSXSLT.mergeStylesheets(style_doc, new_format);
+	    } else {
+		System.err.println("TransformingReceptionist: couldn't parse the config_format stylesheet, adding the format info as is");
+		GSXSLT.mergeStylesheets(style_doc, format_elem);
+	    }
 	    ///ystem.out.println("the converted stylesheet is:");
 	    ///ystem.out.println(this.converter.getPrettyString(style_doc.getDocumentElement()));
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/GATEServices.java.tmp
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/GATEServices.java.tmp	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/GATEServices.java.tmp	(revision 9798)
@@ -226,7 +226,12 @@
 
 	    annotated_text = "<nodeContent>" + annotated_text + "</nodeContent>";
-	    Element annotated_content = this.converter.getDOM(annotated_text).getDocumentElement();
-	    doc_node.replaceChild(doc_node.getOwnerDocument().importNode(annotated_content, true), content);
-	}
+	    Document annotated_content_doc = this.converter.getDOM(annotated_text);
+	    if (annotated_content_doc != null) {
+		Element annotated_content = annotated_content_doc.getDocumentElement();
+		doc_node.replaceChild(doc_node.getOwnerDocument().importNode(annotated_content, true), content);
+	    } else {
+		System.err.println("GATEServices.processGatePOSTag Error: Couldn't parse annotated text for doc node "+i);
+	    }
+	}	
 
 	result.appendChild(this.doc.importNode(doc_node_list, true));
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/IViaProxy.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/IViaProxy.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/IViaProxy.java	(revision 9798)
@@ -405,7 +405,11 @@
 	doc_node.setAttribute(GSXML.NODE_ID_ATT, doc_id);
 	
-	Element content_element = this.converter.getDOM(processed_content.toString()).getDocumentElement();
-	doc_node.appendChild(this.doc.importNode(content_element, true));
-	
+	Document content_doc = this.converter.getDOM(processed_content.toString());
+	if (content_doc != null) {
+	    Element content_element = content_doc.getDocumentElement();
+	    doc_node.appendChild(this.doc.importNode(content_element, true));
+	} else {
+	    System.err.println("IViaProxy.getDocument Error: Couldn't parse the node content");
+	}
 	return doc_node;
 	
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/IViaRetrieve.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/IViaRetrieve.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/IViaRetrieve.java	(revision 9798)
@@ -98,5 +98,12 @@
 	processed_content.append("</nodeContent>");
 	    
-	Element content_element = this.converter.getDOM(processed_content.toString()).getDocumentElement();
+	Document content_doc = this.converter.getDOM(processed_content.toString());
+	if (content_doc == null) {
+	    System.err.println("IViaRetrieve.getNodeContent Error: Couldn't parse node content");
+	    System.err.println(processed_content.toString());
+	    return null;
+	}
+	
+	Element content_element = content_doc.getDocumentElement();
 
 	return (Element)this.doc.importNode(content_element,true);
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/PhindPhraseBrowse.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/PhindPhraseBrowse.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/PhindPhraseBrowse.java	(revision 9798)
@@ -89,7 +89,11 @@
 	
 	Document dom = this.converter.getDOM(app_info);
+	if (dom==null) {
+	    System.err.println("PhindPhraseBrowse.configure Error: Couldn't parse applet info");
+	    return false;
+	}
 	Element app_elem = dom.getDocumentElement();
 	applet_description.appendChild(this.doc.importNode(app_elem, true));
-	
+
 	return true;
     }
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceRack.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceRack.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/ServiceRack.java	(revision 9798)
@@ -144,5 +144,9 @@
 	
 	Document doc = this.converter.getDOM(xml_in);
-	
+	if (doc == null) {
+	    System.err.println("ServiceRack.process(String) Error: Couldn't parse request");
+	    System.err.println(xml_in);
+	    return null;
+	}
 	Element res = process(doc.getDocumentElement());
 	return this.converter.getString(res);
Index: /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/Visualizer.java
===================================================================
--- /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/Visualizer.java	(revision 9797)
+++ /branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/service/Visualizer.java	(revision 9798)
@@ -75,4 +75,8 @@
 	   
 	Document dom = converter.getDOM(app_info);
+	if (dom == null) {
+	    System.err.println("Visualizer.configure Error: Couldn't parse applet info");
+	    return false;
+	}
 	Element app_elem = dom.getDocumentElement();
 	applet_description.appendChild(this.doc.importNode(app_elem, true));
