2006/unicorn/src/org/w3c/unicorn/contract Observer.java,1.1.2.1,1.1.2.2

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/contract
In directory hutz:/tmp/cvs-serv8922/src/org/w3c/unicorn/contract

Modified Files:
      Tag: dev2
	Observer.java 
Log Message:
throws an UnknownParserException in case a contract specify an unknown parser

Index: Observer.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/contract/Attic/Observer.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- Observer.java	11 Aug 2009 16:05:32 -0000	1.1.2.1
+++ Observer.java	17 Aug 2009 14:11:33 -0000	1.1.2.2
@@ -11,7 +11,9 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.w3c.unicorn.exceptions.UnknownParserException;
 import org.w3c.unicorn.util.LocalizedString;
+import org.w3c.unicorn.util.Property;
 
 /**
  * Observer<br />
@@ -261,7 +263,10 @@
 		return responseType;
 	}
 
-	public void setResponseType(String responseType) {
+	public void setResponseType(String responseType) throws UnknownParserException {
+		if (!Property.getProps("responseParsers.properties").containsKey(responseType))
+			throw new UnknownParserException("Unknown parser: " + responseType + ". Check observer contract or responseParsers.properties.");
+			
 		this.responseType = responseType;
 	}
 

Received on Monday, 17 August 2009 14:11:46 UTC