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

2006/unicorn/src/org/w3c/unicorn UnicornCall.java,1.1.2.9,1.1.2.10

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 27 Aug 2009 11:16:25 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Mgcxt-000250-HN@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn
In directory hutz:/tmp/cvs-serv7976/src/org/w3c/unicorn

Modified Files:
      Tag: dev2
	UnicornCall.java 
Log Message:
escapes xml entities before populating context

Index: UnicornCall.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/Attic/UnicornCall.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -d -r1.1.2.9 -r1.1.2.10
--- UnicornCall.java	26 Aug 2009 18:16:38 -0000	1.1.2.9
+++ UnicornCall.java	27 Aug 2009 11:16:23 -0000	1.1.2.10
@@ -29,6 +29,7 @@
 import org.apache.log4j.Logger;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.event.EventCartridge;
 import org.w3c.dom.Document;
 import org.w3c.unicorn.contract.CallParameter;
 import org.w3c.unicorn.contract.EnumInputMethod;
@@ -38,6 +39,7 @@
 import org.w3c.unicorn.exceptions.NoDocumentException;
 import org.w3c.unicorn.exceptions.NoMimeTypeException;
 import org.w3c.unicorn.input.InputFactory;
+import org.w3c.unicorn.output.EscapeXMLEntities;
 import org.w3c.unicorn.request.Request;
 import org.w3c.unicorn.request.RequestList;
 import org.w3c.unicorn.response.Response;
@@ -874,8 +876,13 @@
 				String lang = unicornCall.getLang();
 
 				VelocityContext context = new VelocityContext(Framework.getLanguageContexts().get(lang));
+				
+				final EventCartridge aEventCartridge = new EventCartridge();
+				aEventCartridge.addEventHandler(new EscapeXMLEntities());
+				aEventCartridge.attachToContext(context);
+				
 				if (e.getMessage() != null)	
-					context.put("exception", StringEscapeUtils.escapeXml(e.getMessage()));
+					context.put("exception", e.getMessage());
 				else
 					context.put("exception", "");
 
Received on Thursday, 27 August 2009 11:16:35 UTC

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