2006/unicorn/src/org/w3c/unicorn/output XMLOutputFormater.java,1.1.2.5,1.1.2.6

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

Modified Files:
      Tag: dev2
	XMLOutputFormater.java 
Log Message:
initializes velocity context at each request

Index: XMLOutputFormater.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/output/Attic/XMLOutputFormater.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.5 -r1.1.2.6
--- XMLOutputFormater.java	27 Aug 2009 12:17:55 -0000	1.1.2.5
+++ XMLOutputFormater.java	27 Aug 2009 12:42:45 -0000	1.1.2.6
@@ -38,6 +38,8 @@
 	private static VelocityContext aVelocityContext;
 	
 	private String sOutputFormat;
+	
+	private String sLang;
 
 	/**
 	 * Write the result of the XML in a file
@@ -60,13 +62,8 @@
 		XMLOutputFormater.logger.debug("Output language : " + sLang + ".");
 
 		this.sOutputFormat = sOutputFormat;
+		this.sLang = sLang;
 		
-		if (Framework.getLanguageContexts().get(sLang) != null) {
-			aVelocityContext = new VelocityContext(Framework.getLanguageContexts().get(sLang));
-		} else {
-			logger.debug("Context for " + sLang + " doesn't exist.");
-			aVelocityContext = new VelocityContext(Framework.getLanguageContexts().get(Property.get("DEFAULT_LANGUAGE")));
-		}
 	}
 
 	/*
@@ -78,6 +75,14 @@
 	public void produceOutput(final Map<String, Object> mapOfStringObject,
 			final Writer aWriter) throws ResourceNotFoundException,
 			ParseErrorException, MethodInvocationException, Exception {
+		
+		if (Framework.getLanguageContexts().get(sLang) != null) {
+			aVelocityContext = new VelocityContext(Framework.getLanguageContexts().get(sLang));
+		} else {
+			logger.debug("Context for " + sLang + " doesn't exist.");
+			aVelocityContext = new VelocityContext(Framework.getLanguageContexts().get(Property.get("DEFAULT_LANGUAGE")));
+		}
+		
 		XMLOutputFormater.logger.trace("produceOutput");
 		XMLOutputFormater.logger.debug("Map of String -> Object : "
 				+ mapOfStringObject + ".");
@@ -104,6 +109,14 @@
 	public void produceError(final Exception aException, final Writer aWriter)
 			throws ResourceNotFoundException, ParseErrorException,
 			MethodInvocationException, Exception {
+		
+		if (Framework.getLanguageContexts().get(sLang) != null) {
+			aVelocityContext = new VelocityContext(Framework.getLanguageContexts().get(sLang));
+		} else {
+			logger.debug("Context for " + sLang + " doesn't exist.");
+			aVelocityContext = new VelocityContext(Framework.getLanguageContexts().get(Property.get("DEFAULT_LANGUAGE")));
+		}
+		
 		XMLOutputFormater.logger.trace("produceError");
 		XMLOutputFormater.logger.debug("Error : " + aException + ".");
 		XMLOutputFormater.logger.debug("Writer : " + aWriter + ".");

Received on Thursday, 27 August 2009 12:42:56 UTC