2006/unicorn/src/org/w3c/unicorn UnicornCall.java,1.8,1.9

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

Modified Files:
	UnicornCall.java 
Log Message:
throw a UnsupportedMimeType exception if the task does not support the request mime-type

Index: UnicornCall.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/UnicornCall.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- UnicornCall.java	4 Sep 2009 13:51:06 -0000	1.8
+++ UnicornCall.java	4 Sep 2009 15:35:15 -0000	1.9
@@ -30,6 +30,7 @@
 import org.w3c.unicorn.exceptions.EmptyDocumentException;
 import org.w3c.unicorn.exceptions.NoDocumentException;
 import org.w3c.unicorn.exceptions.NoMimeTypeException;
+import org.w3c.unicorn.exceptions.UnsupportedMimeTypeException;
 import org.w3c.unicorn.input.InputFactory;
 import org.w3c.unicorn.request.Request;
 import org.w3c.unicorn.request.RequestList;
@@ -129,6 +130,10 @@
 		// find mimetype of the document
 		MimeType aMimeType = this.getMimeType();
 
+		if (!aTask.getSupportedMimeTypes().contains(aMimeType.toString())) {
+			throw new UnsupportedMimeTypeException("Mime-type: " + aMimeType + " is not supported by this task.");
+		}
+		
 		// Create input method
 		final InputFactory aInputFactory = new InputFactory(aMimeType,
 				this.aEnumInputMethod, this.oInputParameterValue);

Received on Friday, 4 September 2009 15:35:27 UTC