← Back to team overview

slub.team team mailing list archive

[Merge] lp:~henning-gerhardt/goobi-production/bug-932595 into lp:goobi-production

 

Henning Gerhardt has proposed merging lp:~henning-gerhardt/goobi-production/bug-932595 into lp:goobi-production.

Requested reviews:
  Ralf Claussnitzer (ralf-claussnitzer)
Related bugs:
  Bug #932595 in Goobi.Production: "work-flow steps trigger exception"
  https://bugs.launchpad.net/goobi-production/+bug/932595

For more details, see:
https://code.launchpad.net/~henning-gerhardt/goobi-production/bug-932595/+merge/97604

Changes should fix the FileNotFound exceptions.
-- 
https://code.launchpad.net/~henning-gerhardt/goobi-production/bug-932595/+merge/97604
Your team Saxon State Library Team is subscribed to branch lp:goobi-production.
=== modified file 'src/org/goobi/production/api/property/xmlbasedprovider/impl/Parser.java'
--- src/org/goobi/production/api/property/xmlbasedprovider/impl/Parser.java	2012-02-22 07:43:02 +0000
+++ src/org/goobi/production/api/property/xmlbasedprovider/impl/Parser.java	2012-03-15 10:25:36 +0000
@@ -25,6 +25,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 
+import org.apache.log4j.Logger;
 import org.jdom.Document;
 import org.jdom.Element;
 import org.jdom.JDOMException;
@@ -42,6 +43,9 @@
  * 
  *******************************************************************************/
 public class Parser {
+
+	private static final Logger logger = Logger.getLogger(Parser.class);
+
 	// Strings used in xml
 	private static final String PROPERTY = "property";
 	private static final String NAME = "name";
@@ -68,7 +72,13 @@
 	@SuppressWarnings("unchecked")
 	public ArrayList<PropertyTemplate> createModelFromXML(String filename, boolean validate, IGoobiEntity inEntity) throws JDOMException, IOException {
 
-		validate = false;
+		ArrayList<PropertyTemplate> propList = new ArrayList<PropertyTemplate>();
+
+		if ((filename == null) || !(new java.io.File(filename).exists())) {
+			logger.info("File name empty or file does not exists: '" + filename + "'. Continue with empty property list!");
+			return propList;
+		}
+
 		SAXBuilder builder = new SAXBuilder(validate);
 		Document doc;
 		doc = builder.build(filename);
@@ -77,7 +87,6 @@
 		ArrayList<Element> ePropertyList = new ArrayList<Element>();
 		ePropertyList.addAll(rootElement.getChildren(PROPERTY, ns));
 
-		ArrayList<PropertyTemplate> propList = new ArrayList<PropertyTemplate>();
 		for (Element eProperty : ePropertyList) {
 			PropertyTemplate property = generateProperty(eProperty, inEntity);
 			if (property != null) {


Follow ups