- From: Jean-Guilhem Rouel via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 11 Aug 2009 13:43:03 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/output In directory hutz:/tmp/cvs-serv6157/org/w3c/unicorn/output Modified Files: SimpleOutputModule.java OutputFactory.java SimpleOutputFormater.java XHTMLize.java XMLOutputFormater.java Log Message: Code cleanup Index: OutputFactory.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/OutputFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- OutputFactory.java 29 Jul 2009 13:23:34 -0000 1.6 +++ OutputFactory.java 11 Aug 2009 13:43:01 -0000 1.7 @@ -5,7 +5,6 @@ package org.w3c.unicorn.output; import java.io.IOException; -import java.net.URL; import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; @@ -36,9 +35,9 @@ static { try { - OutputFactory.aPropertiesSpecialFormaters.load( - Property.getPropertyFileURL("specialFormaters.properties").openStream() - ); + OutputFactory.aPropertiesSpecialFormaters.load(Property + .getPropertyFileURL("specialFormaters.properties") + .openStream()); } catch (final IOException e) { OutputFactory.logger.error("IOException : " + e.getMessage(), e); e.printStackTrace(); Index: SimpleOutputModule.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/SimpleOutputModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SimpleOutputModule.java 17 Jun 2008 13:41:11 -0000 1.2 +++ SimpleOutputModule.java 11 Aug 2009 13:43:01 -0000 1.3 @@ -23,7 +23,7 @@ final Map<String, String[]> mapOfParameter, final Writer aWriter) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception { - SimpleOutputModule.logger.trace("Constructor"); + OutputModule.logger.trace("Constructor"); aOutputFormater.produceOutput(mapOfStringObject, aWriter); } @@ -32,7 +32,7 @@ final Map<String, String[]> mapOfParameter, final Writer aWriter) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception { - SimpleOutputModule.logger.trace("produceError"); + OutputModule.logger.trace("produceError"); aOutputFormater.produceError(aException, aWriter); } Index: XHTMLize.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/XHTMLize.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- XHTMLize.java 19 Sep 2008 18:57:12 -0000 1.7 +++ XHTMLize.java 11 Aug 2009 13:43:01 -0000 1.8 @@ -27,9 +27,9 @@ * Escape the XML entities for all inserted references. */ public Object referenceInsert(final String sUnused, final Object oValue) { - if(oValue == null) { - return null; - } + if (oValue == null) { + return null; + } if (oValue instanceof A) { A link = (A) oValue; return insertA(link); Index: SimpleOutputFormater.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/SimpleOutputFormater.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- SimpleOutputFormater.java 29 Jul 2009 09:18:24 -0000 1.6 +++ SimpleOutputFormater.java 11 Aug 2009 13:43:01 -0000 1.7 @@ -27,16 +27,19 @@ private Template aTemplateOutput = null; private Template aTemplateError = null; - + private static VelocityContext aVelocityContext = new VelocityContext(); public SimpleOutputFormater(final String sOutputFormat, final String sLang) throws ResourceNotFoundException, ParseErrorException, Exception { SimpleOutputFormater.logger.trace("Constructor"); - SimpleOutputFormater.logger.debug("Output format : " + sOutputFormat + "."); + SimpleOutputFormater.logger.debug("Output format : " + sOutputFormat + + "."); SimpleOutputFormater.logger.debug("Output language : " + sLang + "."); - this.aTemplateOutput = TemplateHelper.getInternationalizedTemplate(sOutputFormat, sLang, aVelocityContext); - this.aTemplateError = TemplateHelper.getInternationalizedTemplate(sOutputFormat + ".error", sLang, aVelocityContext); + this.aTemplateOutput = TemplateHelper.getInternationalizedTemplate( + sOutputFormat, sLang, aVelocityContext); + this.aTemplateError = TemplateHelper.getInternationalizedTemplate( + sOutputFormat + ".error", sLang, aVelocityContext); } /* @@ -49,10 +52,13 @@ final Writer aWriter) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception { SimpleOutputFormater.logger.trace("produceOutput"); - SimpleOutputFormater.logger.debug("Map of String -> Object : " + mapOfStringObject + "."); + SimpleOutputFormater.logger.debug("Map of String -> Object : " + + mapOfStringObject + "."); SimpleOutputFormater.logger.debug("Writer : " + aWriter + "."); - for (final String sObjectName : mapOfStringObject.keySet()) - aVelocityContext.put(sObjectName, mapOfStringObject.get(sObjectName)); + for (final String sObjectName : mapOfStringObject.keySet()) { + aVelocityContext.put(sObjectName, mapOfStringObject + .get(sObjectName)); + } this.aTemplateOutput.merge(aVelocityContext, aWriter); } @@ -66,7 +72,8 @@ throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception { SimpleOutputFormater.logger.trace("produceError"); - SimpleOutputFormater.logger.debug("Error : " + aException.getMessage() + "."); + SimpleOutputFormater.logger.debug("Error : " + aException.getMessage() + + "."); SimpleOutputFormater.logger.debug("Writer : " + aWriter + "."); aVelocityContext.put("error", aException); this.aTemplateError.merge(aVelocityContext, aWriter); Index: XMLOutputFormater.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/XMLOutputFormater.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- XMLOutputFormater.java 29 Jul 2009 13:23:33 -0000 1.8 +++ XMLOutputFormater.java 11 Aug 2009 13:43:01 -0000 1.9 @@ -45,20 +45,29 @@ /** * Write the result of the XML in a file - * @param sOutputFormat format of the output - * @param sLang Language of the output - * @throws ResourceNotFoundException exception when resources not found using the path - * @throws ParseErrorException error in the parser - * @throws Exception odd error occur + * + * @param sOutputFormat + * format of the output + * @param sLang + * Language of the output + * @throws ResourceNotFoundException + * exception when resources not found using the path + * @throws ParseErrorException + * error in the parser + * @throws Exception + * odd error occur */ public XMLOutputFormater(final String sOutputFormat, final String sLang) throws ResourceNotFoundException, ParseErrorException, Exception { XMLOutputFormater.logger.trace("Constructor"); - XMLOutputFormater.logger.debug("Output format : " + sOutputFormat + "."); + XMLOutputFormater.logger + .debug("Output format : " + sOutputFormat + "."); XMLOutputFormater.logger.debug("Output language : " + sLang + "."); - - aTemplateOutput = TemplateHelper.getInternationalizedTemplate(sOutputFormat, sLang, aVelocityContext); - aTemplateError = TemplateHelper.getInternationalizedTemplate(sOutputFormat + ".error", sLang, aVelocityContext); + + aTemplateOutput = TemplateHelper.getInternationalizedTemplate( + sOutputFormat, sLang, aVelocityContext); + aTemplateError = TemplateHelper.getInternationalizedTemplate( + sOutputFormat + ".error", sLang, aVelocityContext); } /* @@ -71,14 +80,17 @@ final Writer aWriter) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception { XMLOutputFormater.logger.trace("produceOutput"); - XMLOutputFormater.logger.debug("Map of String -> Object : " + mapOfStringObject + "."); + XMLOutputFormater.logger.debug("Map of String -> Object : " + + mapOfStringObject + "."); XMLOutputFormater.logger.debug("Writer : " + aWriter + "."); final EventCartridge aEventCartridge = new EventCartridge(); aEventCartridge.addEventHandler(new XHTMLize()); // aEventCartridge.addEventHandler(new EscapeXMLEntities()); aEventCartridge.attachToContext(aVelocityContext); - for (final String sObjectName : mapOfStringObject.keySet()) - aVelocityContext.put(sObjectName, mapOfStringObject.get(sObjectName)); + for (final String sObjectName : mapOfStringObject.keySet()) { + aVelocityContext.put(sObjectName, mapOfStringObject + .get(sObjectName)); + } this.aTemplateOutput.merge(aVelocityContext, aWriter); }
Received on Tuesday, 11 August 2009 13:43:45 UTC