Index: src/org/w3c/unicorn/output/OutputFactory.java
===================================================================
--- src/org/w3c/unicorn/output/OutputFactory.java	(revision 244:bddae840edf7)
+++ src/org/w3c/unicorn/output/OutputFactory.java	(revision 295:922738f06e80)
@@ -1,3 +1,3 @@
-// $Id: OutputFactory.java,v 1.4 2009-09-01 16:00:24 jean-gui Exp $
+// $Id: OutputFactory.java,v 1.5 2009-09-07 16:32:20 tgambet Exp $
 // Author: Damien LEROY.
 // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006.
@@ -31,7 +31,5 @@
 	public static OutputModule createOutputModule(String module) {
 		OutputFactory.logger.trace("createOutputModule");
-		if (OutputFactory.logger.isDebugEnabled()) {
-			OutputFactory.logger.debug("Output module : " + module);
-		}
+		OutputFactory.logger.debug("Output module : " + module);
 		
 		/* Commented out for now as this is unnecessary and that doesn't seem quite safe */		
@@ -59,32 +57,27 @@
 	 *            The format who the output formatter must produce.
 	 * @return The new output formatter.
-	 * @throws ResourceNotFoundException
-	 * @throws ParseErrorException
-	 * @throws Exception
 	 */
-	public static OutputFormater createOutputFormater(
-			final String sOutputFormat, final String sLang,
-			final String sMimeType) throws ResourceNotFoundException,
-			ParseErrorException, Exception {
-		OutputFactory.logger.trace("createOutputformater");
-		if (OutputFactory.logger.isDebugEnabled()) {
-			OutputFactory.logger
-					.debug("Output format : " + sOutputFormat + ".");
-			OutputFactory.logger.debug("Language : " + sLang + ".");
-			OutputFactory.logger.debug("Mime type : " + sMimeType + ".");
-		}
+	public static OutputFormater createOutputFormater(final String sOutputFormat,
+			final String sLang, final String sMimeType)  {
+		
+		logger.trace("createOutputformater");
+		logger.debug("Output format : " + sOutputFormat + ".");
+		logger.debug("Language : " + sLang + ".");
+		logger.debug("Mime type : " + sMimeType + ".");
 
-		final OutputFormater aOutputFormater;
+		OutputFormater aOutputFormater;
 		
-		final String sFormaterName = Property.getProps("specialFormaters.properties")
-											 .getProperty(sMimeType);
+		String sFormaterName = Property.getProps("specialFormaters.properties").getProperty(sMimeType);
+		
 		if (null != sFormaterName) {
-			final Class<?> aFormaterClass = Class
-					.forName("org.w3c.unicorn.output." + sFormaterName);
-			final Class<?>[] tClassParamType = { String.class, String.class };
-			final Object[] tObjectParamValue = { sOutputFormat, sLang };
-
-			aOutputFormater = (OutputFormater) aFormaterClass.getConstructor(
-					tClassParamType).newInstance(tObjectParamValue);
+			try {
+				final Class<?> aFormaterClass = Class.forName("org.w3c.unicorn.output." + sFormaterName);
+				final Class<?>[] tClassParamType = { String.class, String.class };
+				final Object[] tObjectParamValue = { sOutputFormat, sLang };
+				aOutputFormater = (OutputFormater) aFormaterClass.getConstructor(tClassParamType).newInstance(tObjectParamValue);
+			} catch (Exception e) {
+				logger.error("Error instanciating outputFormater: " + sFormaterName + ". Using SimpleOutputFormater instead.", e);
+				aOutputFormater = new SimpleOutputFormater(sOutputFormat, sLang);
+			} 
 		}
 		else {
Index: src/org/w3c/unicorn/output/OutputFormater.java
===================================================================
--- src/org/w3c/unicorn/output/OutputFormater.java	(revision 244:bddae840edf7)
+++ src/org/w3c/unicorn/output/OutputFormater.java	(revision 295:922738f06e80)
@@ -1,3 +1,3 @@
-// $Id: OutputFormater.java,v 1.3 2009-09-01 16:00:24 jean-gui Exp $
+// $Id: OutputFormater.java,v 1.4 2009-09-07 16:32:20 tgambet Exp $
 // Author: Jean-Guilhem Rouel
 // (c) COPYRIGHT MIT, ERCIM and Keio, 2006.
@@ -13,4 +13,5 @@
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
+import org.w3c.unicorn.util.Message;
 
 /**
@@ -27,25 +28,12 @@
 	 * @param mapOfStringObject
 	 * @param output
-	 * @throws ResourceNotFoundException
-	 * @throws ParseErrorException
-	 * @throws MethodInvocationException
-	 * @throws Exception
 	 */
-	public abstract void produceOutput(
-			final Map<String, Object> mapOfStringObject, final Writer output)
-			throws ResourceNotFoundException, ParseErrorException,
-			MethodInvocationException, Exception;
+	public abstract void produceOutput(Map<String, Object> mapOfStringObject, Writer output);
 
 	/**
-	 * @param aException
+	 * @param errorMessage 
 	 * @param aWriter
-	 * @throws Exception
-	 * @throws MethodInvocationException
-	 * @throws ParseErrorException
-	 * @throws ResourceNotFoundException
 	 */
-	public abstract void produceError(final Exception aException,
-			final Writer output) throws ResourceNotFoundException,
-			ParseErrorException, MethodInvocationException, Exception;
+	public abstract void produceError(Message errorMessage, Writer output);
 
 }
Index: src/org/w3c/unicorn/output/OutputModule.java
===================================================================
--- src/org/w3c/unicorn/output/OutputModule.java	(revision 214:ff8b1c2d5ef9)
+++ src/org/w3c/unicorn/output/OutputModule.java	(revision 295:922738f06e80)
@@ -1,3 +1,3 @@
-// $Id: OutputModule.java,v 1.2 2009-08-28 12:40:06 jean-gui Exp $
+// $Id: OutputModule.java,v 1.3 2009-09-07 16:32:20 tgambet Exp $
 // Author: Damien LEROY.
 // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006.
@@ -14,4 +14,5 @@
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
+import org.w3c.unicorn.util.Message;
 
 /**
@@ -27,30 +28,14 @@
 	 * Generate the output of all response.
 	 * 
-	 * @throws IOException
-	 * @throws Exception
-	 * @throws MethodInvocationException
-	 * @throws ParseErrorException
-	 * @throws ResourceNotFoundException
 	 */
-	public abstract void produceOutput(final OutputFormater aOutputFormater,
-			final Map<String, Object> mapOfStringObject,
-			final Map<String, String[]> mapOfParameter, final Writer aWriter)
-			throws IOException, ResourceNotFoundException, ParseErrorException,
-			MethodInvocationException, Exception;
+	public abstract void produceOutput(final OutputFormater aOutputFormater, Map<String, Object> mapOfStringObject,
+			final Map<String, String[]> mapOfParameter, final Writer aWriter);
 
 	/**
 	 * Generates an error output
 	 * 
-	 * @throws IOException
-	 * @throws Exception
-	 * @throws MethodInvocationException
-	 * @throws ParseErrorException
-	 * @throws ResourceNotFoundException
 	 */
-	public abstract void produceError(final OutputFormater aOutputFormater,
-			final Exception error, final Map<String, String[]> mapOfParameter,
-			final Writer aWriter) throws IOException,
-			ResourceNotFoundException, ParseErrorException,
-			MethodInvocationException, Exception;
+	public abstract void produceError(final OutputFormater aOutputFormater, Message errorMessage,
+			final Map<String, String[]> mapOfParameter, final Writer aWriter);
 
 }
Index: src/org/w3c/unicorn/output/SimpleOutputFormater.java
===================================================================
--- src/org/w3c/unicorn/output/SimpleOutputFormater.java	(revision 244:bddae840edf7)
+++ src/org/w3c/unicorn/output/SimpleOutputFormater.java	(revision 295:922738f06e80)
@@ -1,3 +1,3 @@
-// $Id: SimpleOutputFormater.java,v 1.3 2009-09-01 16:00:24 jean-gui Exp $
+// $Id: SimpleOutputFormater.java,v 1.4 2009-09-07 16:32:20 tgambet Exp $
 // Author: Damien LEROY.
 // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006.
@@ -5,12 +5,11 @@
 package org.w3c.unicorn.output;
 
+import java.io.IOException;
 import java.io.Writer;
 import java.util.Map;
 
 import org.apache.velocity.VelocityContext;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
 import org.w3c.unicorn.Framework;
+import org.w3c.unicorn.util.Message;
 import org.w3c.unicorn.util.Property;
 import org.w3c.unicorn.util.Templates;
@@ -64,47 +63,36 @@
 	}
 	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.w3c.unicorn.output.OutputFormater#produceOutput(java.util.Map,
-	 *      java.io.Writer)
-	 */
-	public void produceOutput(final Map<String, Object> mapOfStringObject,
-			final Writer output) throws ResourceNotFoundException,
-			ParseErrorException, MethodInvocationException, Exception {
+	public void produceOutput(final Map<String, Object> mapOfStringObject, final Writer output) {
 
 		OutputFormater.logger.trace("produceOutput");
-		OutputFormater.logger.debug("Map of String -> Object : "
-				+ mapOfStringObject + ".");
+		OutputFormater.logger.debug("Map of String -> Object : " + mapOfStringObject + ".");
 		OutputFormater.logger.debug("Writer : " + output + ".");
 		
-		for (final String sObjectName : mapOfStringObject.keySet()) {
-			aVelocityContext.put(sObjectName, mapOfStringObject
-					.get(sObjectName));
-		}
+		for (final String sObjectName : mapOfStringObject.keySet())
+			aVelocityContext.put(sObjectName, mapOfStringObject.get(sObjectName));
 		
 		Templates.write(format + ".vm", aVelocityContext, output);
-		output.close();
+		try {
+			output.close();
+		} catch (IOException e) {
+			logger.error("Error closing output writer: " + e.getMessage(), e);
+		}
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.w3c.unicorn.output.OutputFormater#produceError(java.lang.Exception,
-	 *      java.io.Writer)
-	 */
-	public void produceError(final Exception aException, final Writer output)
-			throws ResourceNotFoundException, ParseErrorException,
-			MethodInvocationException, Exception {
+	public void produceError(Message errorMessage, final Writer output) {
 		
-		OutputFormater.logger.trace("produceError");
-		OutputFormater.logger.debug("Error : " + aException.getMessage()
-				+ ".");
-		OutputFormater.logger.debug("Writer : " + output + ".");
-		if (aException != null)
-			aVelocityContext.put("error", aException);
+		logger.trace("produceError");
+		logger.debug("ErrorMessage : " + errorMessage.getMessage() + ".");
+		logger.debug("Writer : " + output + ".");
+		
+		Message[] messages = {errorMessage};
+		aVelocityContext.put("messages", messages);
 		
 		Templates.write(format + ".error.vm", aVelocityContext, output);
-		output.close();
+		try {
+			output.close();
+		} catch (IOException e) {
+			logger.error("Error closing output writer: " + e.getMessage(), e);
+		}
 	}
 
Index: src/org/w3c/unicorn/output/SimpleOutputModule.java
===================================================================
--- src/org/w3c/unicorn/output/SimpleOutputModule.java	(revision 214:ff8b1c2d5ef9)
+++ src/org/w3c/unicorn/output/SimpleOutputModule.java	(revision 295:922738f06e80)
@@ -1,3 +1,3 @@
-// $Id: SimpleOutputModule.java,v 1.2 2009-08-28 12:40:06 jean-gui Exp $
+// $Id: SimpleOutputModule.java,v 1.3 2009-09-07 16:32:20 tgambet Exp $
 // Author: Damien LEROY.
 // (c) COPYRIGHT MIT, ERCIM ant Keio, 2006.
@@ -8,7 +8,5 @@
 import java.util.Map;
 
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
+import org.w3c.unicorn.util.Message;
 
 /**
@@ -19,20 +17,12 @@
 public class SimpleOutputModule implements OutputModule {
 
-	public void produceOutput(final OutputFormater aOutputFormater,
-			final Map<String, Object> mapOfStringObject,
-			final Map<String, String[]> mapOfParameter, final Writer aWriter)
-			throws ResourceNotFoundException, ParseErrorException,
-			MethodInvocationException, Exception {
-		OutputModule.logger.trace("Constructor");
+	public void produceOutput(final OutputFormater aOutputFormater, Map<String, Object> mapOfStringObject,
+			final Map<String, String[]> mapOfParameter, final Writer aWriter) {
 		aOutputFormater.produceOutput(mapOfStringObject, aWriter);
 	}
 
-	public void produceError(final OutputFormater aOutputFormater,
-			final Exception aException,
-			final Map<String, String[]> mapOfParameter, final Writer aWriter)
-			throws ResourceNotFoundException, ParseErrorException,
-			MethodInvocationException, Exception {
-		OutputModule.logger.trace("produceError");
-		aOutputFormater.produceError(aException, aWriter);
+	public void produceError(final OutputFormater aOutputFormater, Message errorMessage,
+			final Map<String, String[]> mapOfParameter, final Writer aWriter) {
+		aOutputFormater.produceError(errorMessage, aWriter);
 	}
 
