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

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

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 27 Aug 2009 12:42:47 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MgeJT-0003LC-Gg@lionel-hutz.w3.org>
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

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