W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2009

2006/unicorn/src/org/w3c/unicorn Framework.java,1.1.2.6,1.1.2.7

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 17 Aug 2009 14:08:24 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Md2sq-00028b-2u@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn
In directory hutz:/tmp/cvs-serv8203/src/org/w3c/unicorn

Modified Files:
      Tag: dev2
	Framework.java 
Log Message:
enabled comments in observers.list (# in front of a line)

Index: Framework.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/Attic/Framework.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -d -r1.1.2.6 -r1.1.2.7
--- Framework.java	17 Aug 2009 09:11:09 -0000	1.1.2.6
+++ Framework.java	17 Aug 2009 14:08:21 -0000	1.1.2.7
@@ -35,6 +35,7 @@
 import org.w3c.unicorn.contract.Observer;
 import org.w3c.unicorn.contract.WADLUnmarshaller;
 import org.w3c.unicorn.contract.WADLUnmarshallerXPath;
+import org.w3c.unicorn.exceptions.UnknownParserException;
 import org.w3c.unicorn.language.Language;
 import org.w3c.unicorn.response.parser.ResponseParser;
 import org.w3c.unicorn.tasklist.RDFUnmarshaller;
@@ -301,13 +302,13 @@
 				logger.fatal("Error while reading the observer list file", e);
 				return;
 			}
-			if ("".equals(readLine.trim()))
+			if ("".equals(readLine.trim()) || readLine.matches("^#.*$"))
 				continue;
 			String sWADL = readLine;
 			if (!readLine.matches(".*\\.wadl$")) {
 				sWADL += "/" + Property.get("OBSERVER_XML_FILENAME");
 			}
-			logger.debug("> Loading observer contract: " + sWADL);
+			logger.debug("- Loading observer contract: " + sWADL);
 			Observer obs = new Observer();
 			WADLUnmarshaller unmarshaller;
 			try {
@@ -315,7 +316,7 @@
 				unmarshaller.addURL(new URL(sWADL));
 				unmarshaller.unmarshal();
 			} catch (MalformedURLException e) {
-				logger.error("Invalid observer contract URL \"" + sWADL + "\". Check the observers list file.");
+				logger.error("Invalid observer contract URL \"" + sWADL + "\". Check the observers list file.", e);
 				logger.warn("> This observer will be skiped");
 				continue;
 			} catch (ParserConfigurationException e) {
@@ -330,6 +331,13 @@
 				logger.warn("> This observer will be skiped");
 				continue;
 			}
+			try {
+				obs.setResponseType(unmarshaller.getResponseType());
+			} catch (UnknownParserException e) {
+				logger.error("Unknown parser: " + unmarshaller.getResponseType() + ". Check observer contract or responseParsers.properties.", e);
+				logger.warn("> This observer will be skiped");
+				continue;
+			}
 			obs.setListOfCallMethod(unmarshaller.getListOfCallMethod());
 			obs.setParamLangName(unmarshaller.getNameOfLangParameter());
 			obs.setID(unmarshaller.getID());
@@ -338,7 +346,6 @@
 			obs.setHelpLocation(unmarshaller.getHelpLocation());
 			obs.setProvider(unmarshaller.getProvider());
 			obs.setMapOfInputMethod(unmarshaller.getMapOfInputMethod());
-			obs.setResponseType(unmarshaller.getResponseType());
 			obs.setSupportedMimeTypes(unmarshaller.getSupportedMimeTypes());
 			mapOfObserver.put(new String(obs.getID()), obs);
 		} while (readLine != null);
@@ -426,10 +433,10 @@
 			if (!Language.isISOLanguageCode(localeString))
 				logger.warn(langFile.getName() + " is not a language file: " + localeString + " is not a valid locale.");
 			else {
-				FileInputStream fis1 = new FileInputStream(langFile);
-				InputStreamReader os = new InputStreamReader(fis1, "UTF-8");
+				FileInputStream fis = new FileInputStream(langFile);
+				InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
 				Properties props = new Properties();
-				props.load(os);
+				props.load(isr);
 				props.put("lang", localeString);
 				props.put("tasklist", mapOfTask);
 				languageProperties.put(localeString, props);
Received on Monday, 17 August 2009 14:08:35 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:38 UTC