svn commit: r473363 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/runtime/directive/Foreach.java java/org/apache/velocity/runtime/directive/VMProxyArg.java test/org/apache/velocity
Author: wglass Date: Fri Nov 10 07:19:09 2006 New Revision: 473363 URL: http://svn.apache.org/viewvc?view=revrev=473363 Log: throw methodinvcationexception from velocimacros. VELOCITY-284. Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodInvocationExceptionTestCase.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java?view=diffrev=473363r1=473362r2=473363 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java Fri Nov 10 07:19:09 2006 @@ -76,8 +76,9 @@ /** * Get an object from the context, or null if the key is equal to the loop variable * @see org.apache.velocity.context.InternalContextAdapter#get(java.lang.String) + * @exception MethodInvocationException passes on potential exception from reference method call */ -public Object get( String key ) +public Object get( String key ) throws MethodInvocationException { return ( active loopVariableKey.equals(key) ) ? null @@ -98,8 +99,14 @@ } /** + * Allows callers to explicitly put objects in the local context. + * Objects added to the context through this method always end up + * in the top-level context of possible wrapped contexts. + * + * @param key name of item to set. + * @param value object to set to key. * @see InternalWrapperContext#localPut(String, Object) - */ + */ public Object localPut(final String key, final Object value) { return put(key, value); Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java?view=diffrev=473363r1=473362r2=473363 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java Fri Nov 10 07:19:09 2006 @@ -242,9 +242,9 @@ * * @param context Context to use for getting current value * @return Object value - * + * @exception MethodInvocationException passes on potential exception from reference method call */ -public Object getObject( InternalContextAdapter context ) +public Object getObject( InternalContextAdapter context ) throws MethodInvocationException { try { @@ -358,8 +358,7 @@ */ log.error(VMProxyArg.getObject() : method invocation error getting value, mie); - -return null; +throw mie; } } Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodInvocationExceptionTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodInvocationExceptionTestCase.java?view=diffrev=473363r1=473362r2=473363 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodInvocationExceptionTestCase.java (original) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodInvocationExceptionTestCase.java Fri Nov 10 07:19:09 2006 @@ -39,6 +39,7 @@ { /** * Default constructor. + * @param name */ public MethodInvocationExceptionTestCase(String name) { @@ -65,6 +66,7 @@ * uses the Velocity class to eval a string * which accesses a method that throws an * exception. + * @throws Exception */ public void testNormalMethodInvocationException () throws Exception @@ -203,6 +205,7 @@ * test that no exception is thrown when in parameter to macro. * This is the way we expect the system to work, but it would be better * to throw an exception. + * @throws Exception */ public void testMacroInvocationException () throws Exception @@ -217,10 +220,25 @@ try { Velocity. evaluate( vc, w, test, template ); +fail(No exception thrown, macro invocation test.); } catch( MethodInvocationException
svn commit: r471381 - in /jakarta/velocity/engine/trunk/src/java/org/apache/velocity: ./ app/ exception/ runtime/directive/ runtime/exception/ runtime/parser/node/
Author: wglass Date: Sun Nov 5 00:56:58 2006 New Revision: 471381 URL: http://svn.apache.org/viewvc?view=revrev=471381 Log: Removed generic Exception from throws for Template class and most Node classes. In response to VELOCITY-436. There's a danger of a change to an API call since this involves method signatures, but the only interface that seems relevant is Node.init (used when defining custom directives). Since we are removing Exception and adding TemplateInitException this seems to work. Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/TemplateInitException.java (with props) Removed: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/DirectiveInitException.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/exception/ReferenceException.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/Template.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/Velocity.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Directive.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Include.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Literal.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Macro.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTComment.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTFloatingPointLiteral.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/Node.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/SimpleNode.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/Template.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/Template.java?view=diffrev=471381r1=471380r2=471381 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/Template.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/Template.java Sun Nov 5 00:56:58 2006 @@ -20,6 +20,7 @@ */ import java.io.BufferedReader; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; @@ -30,6 +31,8 @@ import org.apache.velocity.exception.MethodInvocationException; import org.apache.velocity.exception.ParseErrorException; import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.exception.TemplateInitException; +import org.apache.velocity.exception.VelocityException; import org.apache.velocity.runtime.parser.ParseException; import org.apache.velocity.runtime.parser.node.SimpleNode; import org.apache.velocity.runtime.resource.Resource; @@ -58,7 +61,7 @@ */ public class Template extends Resource { -private Exception errorCondition = null; +private VelocityException errorCondition = null; /** Default constructor */ public Template() @@ -73,11 +76,10 @@ * from any available source. * @throws ParseErrorException if template cannot be parsed due * to syntax (or other) error. - * @throws Exception some other problem, should only be from - * initialization of the template AST. + * @throws IOException problem reading input stream */ public boolean process() -throws ResourceNotFoundException, ParseErrorException
svn commit: r471372 - in /jakarta/velocity/engine/trunk: src/java/org/apache/velocity/app/ src/java/org/apache/velocity/runtime/ src/java/org/apache/velocity/runtime/defaults/ src/java/org/apache/velo
Author: wglass Date: Sat Nov 4 22:02:20 2006 New Revision: 471372 URL: http://svn.apache.org/viewvc?view=revrev=471372 Log: Patch for VELOCITY-435. When new property velocimacro.arguments.strict is set to true, will throw a ParseErrorException after encountering macro call with invalid number of arguments. Arguably, this should always be the case but we default the property to false for backwards compatibility. Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/DirectiveInitException.java (with props) Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParseExceptionTestCase.java jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java?view=diffrev=471372r1=471371r2=471372 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java Sat Nov 4 22:02:20 2006 @@ -38,6 +38,7 @@ import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.runtime.RuntimeInstance; +import org.apache.velocity.runtime.directive.DirectiveInitException; import org.apache.velocity.runtime.log.Log; import org.apache.velocity.runtime.parser.ParseException; import org.apache.velocity.runtime.parser.node.SimpleNode; @@ -333,6 +334,10 @@ catch( RuntimeException e ) { throw e; +} +catch (DirectiveInitException pex) +{ +throw new ParseErrorException( pex ); } catch(Exception e) { Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java?view=diffrev=471372r1=471371r2=471372 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java Sat Nov 4 22:02:20 2006 @@ -246,6 +246,9 @@ /** switch for local context in VM : default false. */ String VM_CONTEXT_LOCALSCOPE = velocimacro.context.localscope; +/** if true, throw an exception for wrong number of arguments **/ +String VM_ARGUMENTS_STRICT = velocimacro.arguments.strict; + /* * -- * G E N E R A L R U N T I M E C O N F I G U R A T I O N Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties?view=diffrev=471372r1=471371r2=471372 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties Sat Nov 4 22:02:20 2006 @@ -114,6 +114,17 @@ velocimacro.context.localscope = false # +# VELOCIMACRO STRICT MODE +# +# if true, will throw an exception for incorrect number +# of arguments. false by default (for backwards compatibility) +# but this option will eventually be removed and will always +# act as if true +# +velocimacro.arguments.strict = false + + +# # INTERPOLATION # # turn off and on interpolation of references and directives in string Added: jakarta/velocity/engine/trunk/src
svn commit: r471374 - /jakarta/velocity/engine/trunk/xdocs/changes.xml
Author: wglass Date: Sat Nov 4 22:24:39 2006 New Revision: 471374 URL: http://svn.apache.org/viewvc?view=revrev=471374 Log: update changelist with several recent changes. Modified: jakarta/velocity/engine/trunk/xdocs/changes.xml Modified: jakarta/velocity/engine/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/xdocs/changes.xml?view=diffrev=471374r1=471373r2=471374 == --- jakarta/velocity/engine/trunk/xdocs/changes.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/changes.xml Sat Nov 4 22:24:39 2006 @@ -27,6 +27,28 @@ body release version=1.5-dev date=in Subversion + action type=add dev=wglass issue=VELOCITY-435 + When macros have incorrect number of arguments, if property + velocimacro.arguments.strict is set to true a ParseErrorException + will be thrown. + /action + + action type=add dev=henning issue=VELOCITY-414 due-to=Matthijs Lambooy + MethodInvocationException now contains line, column, template name + allow application to produce more useful error messages. + /action + + action type=fix dev=henning issue=VELOCITY-24 + Fixed race condition in template retrieval that caused macros + fail under simultaneous load. + /action + + action type=add dev=wglass issue=VELOCITY-423 + New event handler InvalidReferenceHandler allows application + to catch invalid references. Sample implementation collects + them in list and optionally throws exception. + /action + action type=add dev=wglass issue=VELOCITY-179 New, optional SecureIntrospector prohibits methods that involve manipulation of classes, classloaders or reflection objects. Use this introspector to secure Velocity against a risk of @@ -34,11 +56,11 @@ /action action type=fix dev=henning issue=VELOCITY-458 - Removed Serializable from InternalContextBase, because one of the members is not serializable anyway so this never worked (Found by Findbugs). + Removed Serializable from InternalContextBase, because one of the members is not serializable anyway so this never worked (Found by Findbugs). /action action type=fix dev=henning issue=VELOCITY-449 due-to=Alexey Panchenko - Add an additional pair of Executors that are smart about Map. + Add an additional pair of Executors that are smart about Map. /action action type=fix dev=wglass issue=VELOCITY-453 due-to=Alexey Panchenko - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r470254 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java
Author: wglass Date: Wed Nov 1 23:14:00 2006 New Revision: 470254 URL: http://svn.apache.org/viewvc?view=revrev=470254 Log: fixed javadocs for random file Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java?view=diffrev=470254r1=470253r2=470254 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java Wed Nov 1 23:14:00 2006 @@ -222,6 +222,11 @@ /** * Wrap the result in the object of the bigger type. + * + * @param value result of operation (as a long) - used to check size + * @param op1 first operand of binary operation + * @param op2 second operand of binary operation + * @return Number object of appropriate size to fit the value and operators */ private static Number wrapPrimitive (long value, Number op1, Number op2) { @@ -234,6 +239,10 @@ /** * Find the common Number-type to be used in calculations. + * + * @param op1 first operand of binary operation + * @param op2 second operand of binary operation + * @return constant indicating type of Number to use in calculations */ private static int findCalculationBase (Number op1, Number op2) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r470256 - in /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event: ./ implement/
Author: wglass Date: Wed Nov 1 23:20:36 2006 New Revision: 470256 URL: http://svn.apache.org/viewvc?view=revrev=470256 Log: VELOCITY-423. Cleaned up Javadocs. Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/InvalidReferenceEventHandler.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/MethodExceptionEventHandler.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/NullSetEventHandler.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/ReferenceInsertionEventHandler.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeHtmlReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeJavaScriptReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeSqlReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeXmlReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeRelativePath.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/InvalidReferenceInfo.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java?view=diffrev=470256r1=470255r2=470256 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java Wed Nov 1 23:20:36 2006 @@ -203,6 +203,7 @@ /** * Iterate through all the stored ReferenceInsertionEventHandler objects + * * @return iterator of handler objects */ public Iterator getReferenceInsertionEventHandlers() @@ -212,6 +213,7 @@ /** * Iterate through all the stored NullSetEventHandler objects + * * @return iterator of handler objects */ public Iterator getNullSetEventHandlers() @@ -221,6 +223,7 @@ /** * Iterate through all the stored MethodExceptionEventHandler objects + * * @return iterator of handler objects */ public Iterator getMethodExceptionEventHandlers() @@ -230,6 +233,7 @@ /** * Iterate through all the stored IncludeEventHandlers objects + * * @return iterator of handler objects */ public Iterator getIncludeEventHandlers() @@ -239,6 +243,7 @@ /** * Iterate through all the stored InvalidReferenceEventHandlers objects + * * @return iterator of handler objects */ public Iterator getInvalidReferenceEventHandlers() @@ -281,6 +286,7 @@ * Initialize the handlers. For global handlers this is called when Velocity * is initialized. For local handlers this is called when the first handler * is executed. Handlers will not be initialized more than once. + * * @param rs * @throws Exception */ Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java?view=diffrev=470256r1=470255r2=470256 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java Wed Nov 1 23:20:36 2006 @@ -36,18 +36,21 @@ * If appropriate, the returned Object will be the return value. * * @param handler call the appropriate method on this handler + * @exception Exception generic exception potentially thrown by event handlers */ public void execute(EventHandler handler) throws Exception; /** * Called after execute() to see if iterating should stop. Should * always
svn commit: r470261 - in /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection: ClassMap.java MethodMap.java SecureIntrospectorControl.java SecureIntrospectorImpl.java SecureU
Author: wglass Date: Wed Nov 1 23:32:37 2006 New Revision: 470261 URL: http://svn.apache.org/viewvc?view=revrev=470261 Log: Apply javadoc fixes. VELOCITY-475. Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/ClassMap.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorControl.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureUberspector.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/ClassMap.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/ClassMap.java?view=diffrev=470261r1=470260r2=470261 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/ClassMap.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/ClassMap.java Wed Nov 1 23:32:37 2006 @@ -189,6 +189,9 @@ * Make a methodKey for the given method using * the concatenation of the name and the * types of the method parameters. + * + * @param method to be stored as key + * @return key for ClassMap */ private String makeMethodKey(Method method) { @@ -256,6 +259,9 @@ * public, retrieves methods with same signature as its public methods * from public superclasses and interfaces (if they exist). Basically * upcasts every method to the nearest acccessible method. + * + * @param clazz class to check methods + * @return array of all public methods */ private static Method[] getAccessibleMethods(Class clazz) { @@ -436,6 +442,7 @@ * @param clazz the class whose method is sought * @param name the name of the method * @param paramTypes the classes of method parameters + * @return applicable method */ private static Method getPublicMethod(Class clazz, String name, Class[] paramTypes) { Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java?view=diffrev=470261r1=470260r2=470261 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java Wed Nov 1 23:32:37 2006 @@ -309,6 +309,10 @@ /** * Returns true if the supplied method is applicable to actual * argument types. + * + * @param method method that will be called + * @param classes arguments to method + * @return true if method is applicable to arguments */ private static boolean isApplicable(Method method, Class[] classes) { Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorControl.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorControl.java?view=diffrev=470261r1=470260r2=470261 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorControl.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorControl.java Wed Nov 1 23:32:37 2006 @@ -31,7 +31,7 @@ /** * Determine which methods and classes to prevent from executing. * - * @param o object for which method is being called + * @param clazz Class for which method is being called * @param method method being called. This may be null in the case of a call to iterator, get, or set method * * @return true if method may be called on object Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java?view=diffrev=470261r1=470260r2=470261 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java Wed Nov 1 23:32:37 2006 @@ -47,20 +47,30
svn commit: r470263 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java
Author: wglass Date: Wed Nov 1 23:37:15 2006 New Revision: 470263 URL: http://svn.apache.org/viewvc?view=revrev=470263 Log: fix Javadocs Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java?view=diffrev=470263r1=470262r2=470263 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java Wed Nov 1 23:37:15 2006 @@ -199,20 +199,21 @@ /** * returns the ASTReference that is the LHS of the set statememt + * + * @return left hand side of #set statement */ private ASTReference getLeftHandSide() { return (ASTReference) jjtGetChild(0); - - // return (ASTReference) jjtGetChild(0).jjtGetChild(0).jjtGetChild(0); } /** * returns the RHS Node of the set statement + * + * @return right hand side of #set statement */ private Node getRightHandSide() { return jjtGetChild(1); -//return jjtGetChild(0).jjtGetChild(0).jjtGetChild(1).jjtGetChild(0); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r470265 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java
Author: wglass Date: Wed Nov 1 23:45:02 2006 New Revision: 470265 URL: http://svn.apache.org/viewvc?view=revrev=470265 Log: fix formatting typo in class javadoc Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java?view=diffrev=470265r1=470264r2=470265 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java Wed Nov 1 23:45:02 2006 @@ -39,7 +39,7 @@ * Note that InvalidReferenceHandler can be used * in two modes. If the Velocity properties file contains the following: * pre - * CODEeventhandler.invalidreference.exception = true + * eventhandler.invalidreference.exception = true * /pre * then the event handler will throw a ParseErrorRuntimeException upon * hitting the first invalid reference. This stops processing and is - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r463147 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/app/event/ test/org/apache/velocity/test/
Author: wglass Date: Thu Oct 12 00:48:47 2006 New Revision: 463147 URL: http://svn.apache.org/viewvc?view=revrev=463147 Log: Restructuring of event handler initialization calls prepatory to adding another event handler interface. Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java (with props) Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/IncludeEventHandler.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/MethodExceptionEventHandler.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/NullSetEventHandler.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/ReferenceInsertionEventHandler.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java?view=diffrev=463147r1=463146r2=463147 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java Thu Oct 12 00:48:47 2006 @@ -54,6 +54,7 @@ private List nullSetHandlers = new ArrayList(); private List methodExceptionHandlers = new ArrayList(); private List includeHandlers = new ArrayList(); +private List invalidReferenceHandlers = new ArrayList(); /** * Ensure that handlers are not initialized more than once. @@ -94,12 +95,19 @@ addMethodExceptionHandler( (MethodExceptionEventHandler) ev ); found = true; } + if ( ev instanceof IncludeEventHandler ) { addIncludeEventHandler( (IncludeEventHandler) ev ); found = true; } +if ( ev instanceof InvalidReferenceEventHandler ) +{ +addInvalidReferenceEventHandler( (InvalidReferenceEventHandler) ev ); +found = true; +} + return found; } @@ -143,6 +151,16 @@ includeHandlers.add( ev ); } +/** + * Add an invalid reference event handler to the Cartridge. + * + * @param ev InvalidReferenceEventHandler + */ +public void addInvalidReferenceEventHandler( InvalidReferenceEventHandler ev ) +{ +invalidReferenceHandlers.add( ev ); +} + /** * Removes an event handler(s) from the Cartridge. This method will find all @@ -174,6 +192,9 @@ if ( ev instanceof IncludeEventHandler ) return includeHandlers.remove( ev ); +if ( ev instanceof InvalidReferenceEventHandler ) +return invalidReferenceHandlers.remove( ev ); + return found; } @@ -214,6 +235,15 @@ } /** + * Iterate through all the stored InvalidReferenceEventHandlers objects + * @return iterator of handler objects + */ +public Iterator getInvalidReferenceEventHandlers() +{ +return invalidReferenceHandlers.iterator(); +} + +/** * Attached the EventCartridge to the context * * Final because not something one should mess with lightly :) @@ -288,6 +318,17 @@ } for ( Iterator i = includeHandlers.iterator(); i.hasNext(); ) +{ +EventHandler eh = ( EventHandler ) i.next(); +if ( (eh instanceof RuntimeServicesAware) +!initializedHandlers.contains(eh) ) +{ +((RuntimeServicesAware) eh).setRuntimeServices ( rs ); +initializedHandlers.add( eh ); +} +} + +for ( Iterator i = invalidReferenceHandlers.iterator(); i.hasNext(); ) { EventHandler eh = ( EventHandler ) i.next(); if ( (eh instanceof RuntimeServicesAware) Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java?view=autorev=463147 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java (added) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerMethodExecutor.java Thu Oct 12 00:48:47 2006 @@ -0,0 +1,51 @@ +package org.apache.velocity.app.event; + +/* + * Copyright 2001-2004 The Apache Software
svn commit: r463213 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/app/event/ java/org/apache/velocity/app/event/implement/ java/org/apache/velocity/exception/ java/org/apache/veloc
Author: wglass Date: Thu Oct 12 04:52:06 2006 New Revision: 463213 URL: http://svn.apache.org/viewvc?view=revrev=463213 Log: New event handler: InvalidReferenceEventHandler. Allows the developer to trap invalid references, property assignments, method calls. Sample implementation can be used to record all invalid references for later retrieval. With a configuration option, it can also throw an exception upon the first invalid reference. Related to VELOCITY-423. Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/InvalidReferenceEventHandler.java (with props) jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/InvalidReferenceInfo.java (with props) jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/ReportInvalidReferences.java (with props) jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/InvalidEventHandlerTestCase.java (with props) Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/BuiltInEventHandlerTestCase.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java?view=diffrev=463213r1=463212r2=463213 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java Thu Oct 12 04:52:06 2006 @@ -21,6 +21,7 @@ import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.util.ExceptionUtils; +import org.apache.velocity.util.introspection.Info; /** @@ -228,7 +229,121 @@ throw ExceptionUtils.createRuntimeException(Exception in event handler.,e); } } + + +/** + * Called when an invalid get method is encountered. + * + * @param rsvc The RuntimeServices Object. + * @param context the context when the reference was found invalid + * @param reference complete invalid reference + * @param object object from reference, or null if not available + * @param property name of property, or null if not relevant + * @param info contains info on template, line, col + * @return + */ +public static Object invalidGetMethod(RuntimeServices rsvc, +InternalContextAdapter context, String reference, +Object object, String property, Info info) +{ +return +invalidReferenceHandlerCall ( +new InvalidReferenceEventHandler.InvalidGetMethodExecutor +(context, reference, object, property, info), +rsvc, +context); +} + + + /** + * Called when an invalid get method is encountered. + * + * @param rsvc The RuntimeServices Object. + * @param context the context when the reference was found invalid + * @param reference complete invalid reference + * @param object object from reference, or null if not available + * @param property name of property, or null if not relevant + * @param info contains info on template, line, col + */ +public static void invalidSetMethod(RuntimeServices rsvc, +InternalContextAdapter context, String leftreference, +String rightreference, Info info) +{ +/** + * ignore return value + */ +invalidReferenceHandlerCall ( +new InvalidReferenceEventHandler.InvalidSetMethodExecutor +(context, leftreference, rightreference, info), +rsvc, +context); +} +/** + * Called when an invalid method is encountered. + * + * @param rsvc The RuntimeServices Object. + * @param context the context when the reference was found invalid + * @param reference complete invalid reference + * @param object object from reference, or null if not available + * @param method name of method, or null if not relevant
svn commit: r463320 - in /jakarta/velocity/engine/trunk: README.txt TODO.txt
Author: wglass Date: Thu Oct 12 09:59:01 2006 New Revision: 463320 URL: http://svn.apache.org/viewvc?view=revrev=463320 Log: removed archaic todo, tweaked text of readme Removed: jakarta/velocity/engine/trunk/TODO.txt Modified: jakarta/velocity/engine/trunk/README.txt Modified: jakarta/velocity/engine/trunk/README.txt URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/README.txt?view=diffrev=463320r1=463319r2=463320 == --- jakarta/velocity/engine/trunk/README.txt (original) +++ jakarta/velocity/engine/trunk/README.txt Thu Oct 12 09:59:01 2006 @@ -28,10 +28,9 @@ REQUIREMENTS -The Java 2 SDK is required to build Velocity. - -For users that wish to use Log4J as the logging -system, version 1.1 or newer of Log4J is required. +Velocity will run with any version of Java greater than 1.3. +Build Velocity requires Java version 1.4 (or greater) and +ant 1.6. INCLUDED PRE-BUILT JARS @@ -62,15 +61,15 @@ BUILDING VELOCITY - -In order to get started with Velocity, you may want to build it. +In order to use the latest version of Velocity, you may want to build it. Building Velocity is easy. All components necessary to build Velocity are -included, except for the Java 2 SDK and the fabulous Ant build tool -from the Jakarta project. +included, except for the Java 2 SDK and the fabulous Ant build tool. +You can find details on how to build Velocity online at: -http://jakarta.apache.org/ant/ +http://jakarta.apache.org/velocity/build.html -Note that you must use Ant version 1.4 or later. +Note that you must use Ant version 1.6 or later. To build Velocity's jar, change directory into the build/ directory and simply type : @@ -97,8 +96,7 @@ After building Velocity, you can also buld the examples that are included with the Velocity distribution. These examples show how to use Velocity in your Java applications and Servlets. There also are examples of -how to use Anakia, a XML transformation engine and an example of a servlet- -based forum application. +how to use Anakia, a XML transformation engine. For more information, please see the README.txt in the examples/ directory. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r463076 - in /jakarta/velocity/engine/trunk/src/java/org/apache/velocity: app/event/implement/ util/ util/introspection/
Author: wglass Date: Wed Oct 11 16:52:00 2006 New Revision: 463076 URL: http://svn.apache.org/viewvc?view=revrev=463076 Log: remove throws Exception from RuntimeServicesAware.setRuntimeServices Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/RuntimeServicesAware.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureUberspector.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java?view=diffrev=463076r1=463075r2=463076 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java Wed Oct 11 16:52:00 2006 @@ -113,7 +113,7 @@ * @param rs * @throws Exception */ -public void setRuntimeServices(RuntimeServices rs) throws Exception +public void setRuntimeServices(RuntimeServices rs) { this.rs = rs; Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java?view=diffrev=463076r1=463075r2=463076 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java Wed Oct 11 16:52:00 2006 @@ -89,7 +89,7 @@ /** * @see org.apache.velocity.util.RuntimeServicesAware#setRuntimeServices(org.apache.velocity.runtime.RuntimeServices) */ -public void setRuntimeServices(RuntimeServices rs) throws Exception +public void setRuntimeServices(RuntimeServices rs) { this.rs = rs; notfound = StringUtils.nullTrim(rs.getString(PROPERTY_NOT_FOUND, DEFAULT_NOT_FOUND)); Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java?view=diffrev=463076r1=463075r2=463076 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java Wed Oct 11 16:52:00 2006 @@ -35,7 +35,7 @@ * @author a href=mailto:[EMAIL PROTECTED]Will Glass-Husain/a * @version $Id$ */ -public class PrintExceptions implements MethodExceptionEventHandler,RuntimeServicesAware +public class PrintExceptions implements MethodExceptionEventHandler, RuntimeServicesAware { private static String SHOW_MESSAGE = eventhandler.methodexception.message; @@ -112,7 +112,7 @@ /** * @see org.apache.velocity.util.RuntimeServicesAware#setRuntimeServices(org.apache.velocity.runtime.RuntimeServices) */ -public void setRuntimeServices(RuntimeServices rs) throws Exception +public void setRuntimeServices(RuntimeServices rs) { this.rs = rs; } Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/RuntimeServicesAware.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/RuntimeServicesAware.java?view=diffrev=463076r1=463075r2=463076 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/RuntimeServicesAware.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/RuntimeServicesAware.java Wed Oct 11 16:52:00 2006 @@ -30,10 +30,9 @@ public interface RuntimeServicesAware { /** - * Store the RuntimeServices before the object is initialized.. - * @param rs - * @throws Exception + * Called automatically when event cartridge is initialized. + * @param rs RuntimeServices object assigned during initialization */ -public void setRuntimeServices( RuntimeServices rs ) throws Exception; +public void setRuntimeServices( RuntimeServices rs ); } Modified: jakarta/velocity/engine/trunk/src
svn commit: r462604 - in /jakarta/velocity/engine/trunk/src/java/org/apache/velocity: app/ exception/ runtime/directive/ runtime/exception/ runtime/parser/ runtime/parser/node/ util/introspection/
Author: wglass Date: Tue Oct 10 15:17:37 2006 New Revision: 462604 URL: http://svn.apache.org/viewvc?view=revrev=462604 Log: Bold commit moving application-level exceptions to be based on RuntimeException. Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/Velocity.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/VelocityException.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/exception/ReferenceException.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParseException.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/Velocity.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/Velocity.java?view=diffrev=462604r1=462603r2=462604 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/Velocity.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/Velocity.java Tue Oct 10 15:17:37 2006 @@ -372,35 +372,33 @@ try { -boolean retval = evaluate( context, writer, +return evaluate( context, writer, logTag, construct.toString() ); - -return retval; -} -/** - * pass through application level runtime exceptions - */ -catch(RuntimeException re) -{ -throw re; } + catch(ParseErrorException pee) { -getLog().error(Velocity.invokeVelocimacro() failed, pee); +throw pee; } catch(MethodInvocationException mie) { -getLog().error(Velocity.invokeVelocimacro() failed, mie); +throw mie; } catch(ResourceNotFoundException rnfe) { -getLog().error(Velocity.invokeVelocimacro() failed, rnfe); +throw rnfe; } catch(IOException ioe) { getLog().error(Velocity.invokeVelocimacro() failed, ioe); } - +/** + * pass through application level runtime exceptions + */ +catch(RuntimeException re) +{ +throw re; +} return false; } Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/VelocityException.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/VelocityException.java?view=diffrev=462604r1=462603r2=462604 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/VelocityException.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/VelocityException.java Tue Oct 10 15:17:37 2006 @@ -17,13 +17,13 @@ */ /** - * Base class for Velocity exceptions thrown to the - * application layer. +* Base class for Velocity runtime exceptions thrown to the + * application layer. * * @author a href=mailto:[EMAIL PROTECTED]Kyle F. Downey/a * @version $Id$ */ -public class VelocityException extends Exception +public class VelocityException extends RuntimeException { /** * Version Id for serializable Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java?view=diffrev=462604r1=462603r2=462604 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java Tue Oct 10 15:17:37 2006 @@ -221,21 +221,24 @@ ((SimpleNode) t.getData()).render( context, writer ); } } -/** - * pass through application level runtime exceptions + +/* + * if it's a MIE, it came from the render throw it... */ -catch( RuntimeException e ) +catch( MethodInvocationException e ) { throw e; } - -/* - * if it's a MIE, it came from the render throw it... + +/** + * pass through application level runtime exceptions */ -catch
svn commit: r454504 - in /jakarta/velocity/engine/trunk: src/test/org/apache/velocity/test/ test/methodoverloading/ test/methodoverloading/compare/
Author: wglass Date: Mon Oct 9 13:57:32 2006 New Revision: 454504 URL: http://svn.apache.org/viewvc?view=revrev=454504 Log: test to be assured VELOCITY-132 is not a problem Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodOverloadingTestCase.java (with props) jakarta/velocity/engine/trunk/test/methodoverloading/ jakarta/velocity/engine/trunk/test/methodoverloading/compare/ jakarta/velocity/engine/trunk/test/methodoverloading/compare/main.cmp (with props) jakarta/velocity/engine/trunk/test/methodoverloading/compare/single.cmp (with props) jakarta/velocity/engine/trunk/test/methodoverloading/main.vm (with props) jakarta/velocity/engine/trunk/test/methodoverloading/single.vm (with props) jakarta/velocity/engine/trunk/test/methodoverloading/sub.vm (with props) Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodOverloadingTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodOverloadingTestCase.java?view=autorev=454504 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodOverloadingTestCase.java (added) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodOverloadingTestCase.java Mon Oct 9 13:57:32 2006 @@ -0,0 +1,228 @@ +package org.apache.velocity.test; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License) + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.BufferedWriter; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.context.Context; +import org.apache.velocity.runtime.RuntimeConstants; +import org.apache.velocity.runtime.RuntimeServices; +import org.apache.velocity.runtime.log.LogChute; + +/** + * Test a reported bug in which method overloading throws IllegalArgumentException + * after a null return value. + * (VELOCITY-132). + * + * @author a href=mailto:[EMAIL PROTECTED]Will Glass-Husain/a + * @version $Id$ + */ +public class MethodOverloadingTestCase extends BaseTestCase implements LogChute +{ +String logData; + +/** +* VTL file extension. +*/ + private static final String TMPL_FILE_EXT = vm; + + /** +* Comparison file extension. +*/ + private static final String CMP_FILE_EXT = cmp; + + /** +* Comparison file extension. +*/ + private static final String RESULT_FILE_EXT = res; + + /** +* Path for templates. This property will override the +* value in the default velocity properties file. +*/ + private final static String FILE_RESOURCE_LOADER_PATH = TEST_COMPARE_DIR + /methodoverloading; + + /** +* Results relative to the build directory. +*/ + private static final String RESULTS_DIR = TEST_RESULT_DIR + /methodoverloading; + + /** +* Results relative to the build directory. +*/ + private static final String COMPARE_DIR = TEST_COMPARE_DIR + /methodoverloading/compare; + +/** + * Default constructor. + */ +public MethodOverloadingTestCase(String name) +{ +super(name); +} + +public void setUp() +{ +assureResultsDirectoryExists(RESULTS_DIR); +} + +public static Test suite() +{ + return new TestSuite(MethodOverloadingTestCase.class); +} + +public void testMethodOverloading() +throws Exception +{ +/** + * test overloading in a single template + */ +testFile(single); + +assertTrue(logData.indexOf(IllegalArgumentException) == -1); +} + +public void testParsedMethodOverloading() +throws Exception +{ +/** + * test overloading in a file included with #parse + */ +testFile(main); + +assertTrue(logData.indexOf(IllegalArgumentException) == -1); + +} + +public void testFile(String basefilename) +throws Exception +{ + +VelocityEngine ve = new VelocityEngine(); +ve.addProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, FILE_RESOURCE_LOADER_PATH); +ve.setProperty
svn commit: r454562 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/app/event/ java/org/apache/velocity/app/event/implement/ java/org/apache/velocity/runtime/ java/org/apache/velocit
Author: wglass Date: Mon Oct 9 17:01:11 2006 New Revision: 454562 URL: http://svn.apache.org/viewvc?view=revrev=454562 Log: move ContextAware/RuntimeServicesAware to util package for more generic future use Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/ContextAware.java - copied, changed from r454530, jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/ContextAware.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/RuntimeServicesAware.java - copied, changed from r454530, jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/RuntimeServicesAware.java Removed: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/ContextAware.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/RuntimeServicesAware.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java?view=diffrev=454562r1=454561r2=454562 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventCartridge.java Mon Oct 9 17:01:11 2006 @@ -25,6 +25,7 @@ import org.apache.velocity.context.Context; import org.apache.velocity.context.InternalEventContext; import org.apache.velocity.runtime.RuntimeServices; +import org.apache.velocity.util.RuntimeServicesAware; /** * Stores the event handlers. Event handlers can be assigned on a per Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java?view=diffrev=454562r1=454561r2=454562 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/EventHandlerUtil.java Mon Oct 9 17:01:11 2006 @@ -20,6 +20,7 @@ import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.runtime.RuntimeServices; +import org.apache.velocity.util.ContextAware; /** Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java?view=diffrev=454562r1=454561r2=454562 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java Mon Oct 9 17:01:11 2006 @@ -19,8 +19,8 @@ import org.apache.oro.text.perl.MalformedPerl5PatternException; import org.apache.oro.text.perl.Perl5Util; import org.apache.velocity.app.event.ReferenceInsertionEventHandler; -import org.apache.velocity.app.event.RuntimeServicesAware; import org.apache.velocity.runtime.RuntimeServices; +import org.apache.velocity.util.RuntimeServicesAware; import org.apache.velocity.util.StringUtils; /** Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java?view=diffrev=454562r1=454561r2=454562 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java Mon Oct 9 17:01:11 2006 @@ -17,8 +17,8 @@ */ import org.apache.velocity.app.event.IncludeEventHandler; -import org.apache.velocity.app.event.RuntimeServicesAware
svn commit: r454563 - /jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java
Author: wglass Date: Mon Oct 9 17:02:25 2006 New Revision: 454563 URL: http://svn.apache.org/viewvc?view=revrev=454563 Log: move ContextAware/RuntimeServicesAware Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java?view=diffrev=454563r1=454562r2=454563 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java (original) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java Mon Oct 9 17:02:25 2006 @@ -25,17 +25,17 @@ import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.app.event.ContextAware; import org.apache.velocity.app.event.EventCartridge; import org.apache.velocity.app.event.MethodExceptionEventHandler; import org.apache.velocity.app.event.NullSetEventHandler; import org.apache.velocity.app.event.ReferenceInsertionEventHandler; -import org.apache.velocity.app.event.RuntimeServicesAware; import org.apache.velocity.context.Context; import org.apache.velocity.exception.MethodInvocationException; import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.log.LogChute; +import org.apache.velocity.util.ContextAware; +import org.apache.velocity.util.RuntimeServicesAware; /** * Tests event handling for all event handlers except IncludeEventHandler. This is tested - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r454595 - in /jakarta/velocity/engine/trunk: src/java/org/apache/velocity/runtime/ src/java/org/apache/velocity/runtime/defaults/ src/java/org/apache/velocity/util/ src/java/org/apache/vel
Author: wglass Date: Mon Oct 9 20:43:45 2006 New Revision: 454595 URL: http://svn.apache.org/viewvc?view=revrev=454595 Log: Offer optional SecureUberspector which prohibits method calls on 'dangerous' classes like Class and ClassLoader. Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorControl.java (with props) jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java (with props) jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureUberspector.java (with props) jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SecureIntrospectionTestCase.java (with props) Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/RuntimeServicesAware.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java jakarta/velocity/engine/trunk/xdocs/changes.xml Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java?view=diffrev=454595r1=454594r2=454595 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java Mon Oct 9 20:43:45 2006 @@ -336,12 +336,21 @@ */ public static final String ENCODING_DEFAULT = ISO-8859-1; - /** * key name for uberspector */ public static final String UBERSPECT_CLASSNAME = runtime.introspector.uberspect; +/** + * A comma separated list of packages to restrict access to in the SecureIntrospector + */ +public static final String INTROSPECTOR_RESTRICT_PACKAGES = introspector.restrict.packages; + +/** + * A comma separated list of classes to restrict access to in the SecureIntrospector + */ +public static final String INTROSPECTOR_RESTRICT_CLASSES = introspector.restrict.classes; + /** * The codeparser.pool.class/code property * specifies the name of the [EMAIL PROTECTED] Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java?view=diffrev=454595r1=454594r2=454595 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Mon Oct 9 20:43:45 2006 @@ -304,6 +304,11 @@ ((UberspectLoggable) uberSpect).setLog(getLog()); } +if (uberSpect instanceof RuntimeServicesAware) +{ +((RuntimeServicesAware) uberSpect).setRuntimeServices(this); +} + uberSpect.init(); } else Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties?view=diffrev=454595r1=454594r2=454595 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties Mon Oct 9 20:43:45 2006 @@ -160,9 +160,38 @@ # # PLUGGABLE INTROSPECTOR # -# Allows alternative introspection and all that can of worms brings +# Allows alternative introspection and all that can of worms brings. # runtime.introspector.uberspect = org.apache.velocity.util.introspection.UberspectImpl + + +# +# SECURE INTROSPECTOR +# +# If selected, prohibits methods in certain classes
svn commit: r454603 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java test/org/apache/velocity/test/SecureIntrospectionTestCase.java
Author: wglass Date: Mon Oct 9 21:03:14 2006 New Revision: 454603 URL: http://svn.apache.org/viewvc?view=revrev=454603 Log: always allow Class.getName() per Nathan's suggestion. Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SecureIntrospectionTestCase.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java?view=diffrev=454603r1=454602r2=454603 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java Mon Oct 9 21:03:14 2006 @@ -72,10 +72,15 @@ */ public boolean checkObjectExecutePermission(Class clazz, String method) { +if (method == null) +{ +return false; +} + /** * check for wait and notify */ -if ( (method != null) (method.equals(wait) || method.equals(notify)) ) +if ( method.equals(wait) || method.equals(notify) ) { return false; } @@ -94,6 +99,14 @@ } else if (java.lang.String.class.isAssignableFrom(clazz)) +{ +return true; +} + +/** + * Always allow Class.getName() + */ +else if (java.lang.Class.class.isAssignableFrom(clazz) method.equals(getName)) { return true; } Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SecureIntrospectionTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SecureIntrospectionTestCase.java?view=diffrev=454603r1=454602r2=454603 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SecureIntrospectionTestCase.java (original) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SecureIntrospectionTestCase.java Mon Oct 9 21:03:14 2006 @@ -57,7 +57,6 @@ private String [] badTemplateStrings = { -$test.Class.Name, $test.Class.Methods, $test.Class.ClassLoader, $test.Class.ClassLoader.loadClass('java.util.HashMap').newInstance().size() @@ -65,6 +64,7 @@ private String [] goodTemplateStrings = { +$test.Class.Name, #set($test.Property = 'abc')$test.Property, $test.aTestMethod() }; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r451296 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/runtime/parser/node/ASTMethod.java test/org/apache/velocity/test/MethodCacheKeyTestCase.java
Author: wglass Date: Fri Sep 29 06:59:28 2006 New Revision: 451296 URL: http://svn.apache.org/viewvc?view=revrev=451296 Log: changed MethodCacheKey to static class per Alexey's suggestion. Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?view=diffrev=451296r1=451295r2=451296 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java Fri Sep 29 06:59:28 2006 @@ -320,7 +320,7 @@ * public access (and complete constructor) for unit test * purposes. */ -public class MethodCacheKey +public static class MethodCacheKey { private final String methodName; private final Class[] params; Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java?view=diffrev=451296r1=451295r2=451296 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java (original) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java Fri Sep 29 06:59:28 2006 @@ -33,53 +33,44 @@ public void testMethodKeyCacheEquals() { Class [] elements1 = new Class [] { Object.class }; -ASTMethod m1 = new ASTMethod(23); -ASTMethod.MethodCacheKey mck1 = m1.new MethodCacheKey(test,elements1); +ASTMethod.MethodCacheKey mck1 = new ASTMethod.MethodCacheKey(test,elements1); selfEqualsAssertions(mck1); Class [] elements2 = new Class [] { Object.class }; -ASTMethod m2 = new ASTMethod(23); -ASTMethod.MethodCacheKey mck2 = m2.new MethodCacheKey(test,elements2); +ASTMethod.MethodCacheKey mck2 = new ASTMethod.MethodCacheKey(test,elements2); assertTrue(mck1.equals(mck2)); Class [] elements3 = new Class [] { String.class }; -ASTMethod m3 = new ASTMethod(23); -ASTMethod.MethodCacheKey mck3 = m3.new MethodCacheKey(test,elements3); +ASTMethod.MethodCacheKey mck3 = new ASTMethod.MethodCacheKey(test,elements3); assertFalse(mck1.equals(mck3)); Class [] elements4 = new Class [] { Object.class }; -ASTMethod m4 = new ASTMethod(23); -ASTMethod.MethodCacheKey mck4 = m4.new MethodCacheKey(boo,elements4); +ASTMethod.MethodCacheKey mck4 = new ASTMethod.MethodCacheKey(boo,elements4); assertFalse(mck1.equals(mck4)); /** check for potential NPE's **/ Class [] elements5 = ArrayUtils.EMPTY_CLASS_ARRAY; -ASTMethod m5 = new ASTMethod(23); -ASTMethod.MethodCacheKey mck5 = m5.new MethodCacheKey(boo,elements5); +ASTMethod.MethodCacheKey mck5 = new ASTMethod.MethodCacheKey(boo,elements5); selfEqualsAssertions(mck5); Class [] elements6 = null; -ASTMethod m6 = new ASTMethod(23); -ASTMethod.MethodCacheKey mck6 = m6.new MethodCacheKey(boo,elements6); +ASTMethod.MethodCacheKey mck6 = new ASTMethod.MethodCacheKey(boo,elements6); selfEqualsAssertions(mck6); Class [] elements7 = new Class [] {}; -ASTMethod m7 = new ASTMethod(23); -ASTMethod.MethodCacheKey mck7 = m7.new MethodCacheKey(boo,elements7); +ASTMethod.MethodCacheKey mck7 = new ASTMethod.MethodCacheKey(boo,elements7); selfEqualsAssertions(mck7); Class [] elements8 = new Class [] {null}; -ASTMethod m8 = new ASTMethod(23); -ASTMethod.MethodCacheKey mck8 = m8.new MethodCacheKey(boo,elements8); +ASTMethod.MethodCacheKey mck8 = new ASTMethod.MethodCacheKey(boo,elements8); selfEqualsAssertions(mck8); Class [] elements9 = new Class [] { Object.class }; -ASTMethod m9 = new ASTMethod(23); -ASTMethod.MethodCacheKey mck9 = m9.new MethodCacheKey(boo,elements9); +ASTMethod.MethodCacheKey mck9 = new ASTMethod.MethodCacheKey(boo,elements9); selfEqualsAssertions(mck9); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL
svn commit: r451013 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/runtime/parser/node/ASTMethod.java test/org/apache/velocity/test/IntrospectionCacheDataTestCase.java test/org/apac
Author: wglass Date: Thu Sep 28 13:19:29 2006 New Revision: 451013 URL: http://svn.apache.org/viewvc?view=revrev=451013 Log: Modified recent method cache patch to improve style and robustness. Revised equals hashcode, added equals unit test. Related to VELOCITY-453. Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MethodCacheKeyTestCase.java (with props) Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectionCacheDataTestCase.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?view=diffrev=451013r1=451012r2=451013 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java Thu Sep 28 13:19:29 2006 @@ -1,7 +1,7 @@ package org.apache.velocity.runtime.parser.node; /* - * Copyright 2000-2004 The Apache Software Foundation. + * Copyright 2000-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the License) * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ */ public class ASTMethod extends SimpleNode { -protected String methodName = ; +private String methodName = ; private int paramCount = 0; /** @@ -143,7 +143,7 @@ * check the cache */ -MethodCacheKey mck = new MethodCacheKey(paramClasses); +MethodCacheKey mck = new MethodCacheKey(methodName, paramClasses); IntrospectionCacheData icd = context.icacheGet( mck ); /* @@ -315,35 +315,55 @@ /** * Internal class used as key for method cache. Combines - * ASTMethod fields with array of parameter classes. + * ASTMethod fields with array of parameter classes. Has + * public access (and complete constructor) for unit test + * purposes. */ -class MethodCacheKey +public class MethodCacheKey { -Class[] params; +private final String methodName; +private final Class[] params; -MethodCacheKey(Class[] params) +public MethodCacheKey(String methodName, Class[] params) { +this.methodName = methodName; this.params = params; } -private final ASTMethod getASTMethod() -{ -return ASTMethod.this; -} - /** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object o) { +/** + * null check is not strictly needed (due to sole + * initialization above) but it seems more safe + * to include it. + */ if (o instanceof MethodCacheKey) { -final MethodCacheKey other = (MethodCacheKey) o; -if (params.length == other.params.length methodName.equals(other.getASTMethod().methodName)) +final MethodCacheKey other = (MethodCacheKey) o; +if ((params == null) || (other.params == null)) +{ +return params == other.params; +} + +/** + * similarly, do null check on each array subscript. + */ +else if (params.length == other.params.length +methodName.equals(other.methodName)) { for (int i = 0; i params.length; ++i) { -if (params[i] != other.params[i]) +if (params[i] == null) +{ +if (params[i] != other.params[i]) +{ +return false; +} +} +else if (!params[i].equals(other.params[i])) { return false; } @@ -358,19 +378,36 @@ /** * @see java.lang.Object#hashCode() */ -public int hashCode() +public int hashCode() { -int result = 0; -for (int i = 0; i params.length; ++i) +int result = 17; + +/** + * null check is not strictly needed (due to sole + * initialization above) but it seems more safe to + * include
svn commit: r451120 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
Author: wglass Date: Thu Sep 28 21:59:53 2006 New Revision: 451120 URL: http://svn.apache.org/viewvc?view=revrev=451120 Log: tweaked inner class of method cache. Related to VELOCITY-453. Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?view=diffrev=451120r1=451119r2=451120 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java Thu Sep 28 21:59:53 2006 @@ -19,6 +19,7 @@ import java.lang.reflect.InvocationTargetException; import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; import org.apache.velocity.app.event.EventHandlerUtil; import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.exception.MethodInvocationException; @@ -326,8 +327,12 @@ public MethodCacheKey(String methodName, Class[] params) { -this.methodName = methodName; -this.params = params; +/** + * Should never be initialized with nulls, but to be safe we refuse + * to accept them. + */ +this.methodName = (methodName != null) ? methodName : StringUtils.EMPTY; +this.params = (params != null) ? params : ArrayUtils.EMPTY_CLASS_ARRAY; } /** @@ -336,22 +341,13 @@ public boolean equals(Object o) { /** - * null check is not strictly needed (due to sole - * initialization above) but it seems more safe - * to include it. - */ + * note we skip the null test for methodName and params + * due to the earlier test in the constructor + */ if (o instanceof MethodCacheKey) { -final MethodCacheKey other = (MethodCacheKey) o; -if ((params == null) || (other.params == null)) -{ -return params == other.params; -} - -/** - * similarly, do null check on each array subscript. - */ -else if (params.length == other.params.length +final MethodCacheKey other = (MethodCacheKey) o; +if (params.length == other.params.length methodName.equals(other.methodName)) { for (int i = 0; i params.length; ++i) @@ -383,15 +379,9 @@ int result = 17; /** - * null check is not strictly needed (due to sole - * initialization above) but it seems more safe to - * include it. - */ -if (params == null) -{ -return result; -} - + * note we skip the null test for methodName and params + * due to the earlier test in the constructor + */ for (int i = 0; i params.length; ++i) { final Class param = params[i]; @@ -401,11 +391,8 @@ } } -if (methodName != null) -{ -result = result * 37 + methodName.hashCode(); -} - +result = result * 37 + methodName.hashCode(); + return result; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r450163 - in /jakarta/velocity/engine/trunk: src/java/org/apache/velocity/app/event/implement/ src/test/org/apache/velocity/test/ test/includeevent/ test/includeevent/compare/ test/include
Author: wglass Date: Tue Sep 26 12:34:52 2006 New Revision: 450163 URL: http://svn.apache.org/viewvc?view=revrev=450163 Log: applied patch VELOCITY-460 - IncludeRelativePath handler should treat paths beginning with a slash as absolute paths Added: jakarta/velocity/engine/trunk/test/includeevent/include-c.vm (with props) jakarta/velocity/engine/trunk/test/includeevent/parse-c.vm (with props) jakarta/velocity/engine/trunk/test/includeevent/subdir/include-c.vm (with props) jakarta/velocity/engine/trunk/test/includeevent/subdir/parse-c.vm (with props) Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeRelativePath.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java jakarta/velocity/engine/trunk/test/includeevent/compare/test2.cmp jakarta/velocity/engine/trunk/test/includeevent/subdir/test2.vm Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeRelativePath.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeRelativePath.java?view=diffrev=450163r1=450162r2=450163 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeRelativePath.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeRelativePath.java Tue Sep 26 12:34:52 2006 @@ -19,7 +19,7 @@ import org.apache.velocity.app.event.IncludeEventHandler; /** - * Event handler that looks for included files relative to the path of the + * pEvent handler that looks for included files relative to the path of the * current template. The handler assumes that paths are separated by a forward * slash / or backwards slash \. * @@ -41,33 +41,22 @@ String currentResourcePath, String directiveName) { +// if the resource name starts with a slash, it's not a relative path +if (includeResourcePath.startsWith(/) || includeResourcePath.startsWith(\\) ) { +return includeResourcePath; +} -// strip the starting slash from includeResourcePath, if it exists -if (includeResourcePath.startsWith(/) || includeResourcePath.startsWith(\\) ) -includeResourcePath = includeResourcePath.substring(1); - -int slashpos1 = currentResourcePath.lastIndexOf(/); -int slashpos2 = currentResourcePath.lastIndexOf(\\); -int lastslashpos = -1; -if ( (slashpos1 != -1) (slashpos2 != -1) (slashpos1 = slashpos2) ) -lastslashpos = slashpos2; - -else if ( (slashpos1 != -1) (slashpos2 != -1) (slashpos1 slashpos2) ) -lastslashpos = slashpos1; - -else if ( (slashpos1 != -1) (slashpos2 == -1) ) -lastslashpos = slashpos1; - -else if ( (slashpos1 == -1) (slashpos2 != -1) ) -lastslashpos = slashpos2; +int lastslashpos = Math.max( +currentResourcePath.lastIndexOf(/), +currentResourcePath.lastIndexOf(\\) +); // root of resource tree -if ( (lastslashpos == -1) || (lastslashpos == 0) ) +if (lastslashpos == -1) { return includeResourcePath; +} // prepend path to the include path -else -return currentResourcePath.substring(0,lastslashpos) + / + includeResourcePath; - +return currentResourcePath.substring(0,lastslashpos) + / + includeResourcePath; } } Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java?view=diffrev=450163r1=450162r2=450163 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java (original) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java Tue Sep 26 12:34:52 2006 @@ -206,28 +206,18 @@ // treat as relative path else if (EventHandlerBehavior == RELATIVE_PATH) { - -// strip the starting slash from includeResourcePath, if it exists -if (includeResourcePath.startsWith(/) || includeResourcePath.startsWith(\\) ) -includeResourcePath = includeResourcePath.substring(1); - -int slashpos1 = currentResourcePath.lastIndexOf(/); -int slashpos2 = currentResourcePath.lastIndexOf(\\); -int lastslashpos = -1; -if ( (slashpos1 != -1) (slashpos2 != -1) (slashpos1 = slashpos2) ) -lastslashpos = slashpos2; - -else if ( (slashpos1 != -1
svn commit: r449333 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/context/VMContext.java test/org/apache/velocity/test/context/ test/org/apache/velocity/test/context/VMContextLocal
Author: wglass Date: Sat Sep 23 16:43:43 2006 New Revision: 449333 URL: http://svn.apache.org/viewvc?view=revrev=449333 Log: allow macros to get outside references, even with localscope setting. Thanks to Stephen Habermann. VELOCITY-459 Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/context/VMContext.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/context/VMContext.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/context/VMContext.java?view=diffrev=449333r1=449332r2=449333 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/context/VMContext.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/context/VMContext.java Sat Sep 23 16:43:43 2006 @@ -34,7 +34,7 @@ * in the put() and get() methods. * * Further, this context also supports the 'VM local context' mode, where - * any get() or put() of references that aren't args to the VM are considered + * any put() of references that aren't args to the VM are considered * local to the vm, protecting the global context. * * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a @@ -190,31 +190,19 @@ } else { -if(localcontextscope) -{ -/* - * if we have localcontextscope mode, then just - * put in the local context - */ +/* +* always try the local context then innerContext--even if localcontextscope +*/ -o = localcontext.get( key ); -} -else +o = localcontext.get( key ); + +if ( o == null) { /* - * try the local context - */ - -o = localcontext.get( key ); +* last chance +*/ -if ( o == null) -{ -/* - * last chance - */ - -o = innerContext.get( key ); -} +o = innerContext.get( key ); } } Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.java?view=autorev=449333 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.java (added) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.java Sat Sep 23 16:43:43 2006 @@ -0,0 +1,64 @@ +package org.apache.velocity.test.context; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License) + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Tests scope of velocimacros with localscope setting. + * + * @author a href=mailto:[EMAIL PROTECTED]Stephen Habermann/a + * @version $Id: Handler2.java 447976 2006-09-19 21:29:45Z henning $ + */ +import junit.framework.TestCase; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.context.InternalContextAdapterImpl; +import org.apache.velocity.context.VMContext; +import org.apache.velocity.runtime.RuntimeConstants; +import org.apache.velocity.runtime.RuntimeInstance; + +public class VMContextLocalscopeTestCase extends TestCase { + +private RuntimeInstance instance; + +public void setUp() throws Exception +{ +this.instance = new RuntimeInstance(); +this.instance.setProperty(RuntimeConstants.VM_CONTEXT_LOCALSCOPE, Boolean.TRUE); +this.instance.init(); +} + +public void testLocalscopePutDoesntLeakButGetDoes() +{ +VelocityContext base = new VelocityContext(); +base.put(outsideVar, value1); + +VMContext vm = new VMContext(new InternalContextAdapterImpl(base), this.instance); +vm.put(newLocalVar, value2
svn commit: r449334 - in /jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test: VMContextLocalscopeTestCase.java context/VMContextLocalscopeTestCase.java
Author: wglass Date: Sat Sep 23 16:50:41 2006 New Revision: 449334 URL: http://svn.apache.org/viewvc?view=revrev=449334 Log: moved new test case to location consistent with other tests Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java - copied, changed from r449333, jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.java Removed: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.java Copied: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java (from r449333, jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.java) URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java?view=diffrev=449334p1=jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.javar1=449333p2=jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.javar2=449334 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/context/VMContextLocalscopeTestCase.java (original) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java Sat Sep 23 16:50:41 2006 @@ -1,4 +1,4 @@ -package org.apache.velocity.test.context; +package org.apache.velocity.test; /* * Copyright 2001-2006 The Apache Software Foundation. @@ -16,12 +16,6 @@ * limitations under the License. */ -/** - * Tests scope of velocimacros with localscope setting. - * - * @author a href=mailto:[EMAIL PROTECTED]Stephen Habermann/a - * @version $Id: Handler2.java 447976 2006-09-19 21:29:45Z henning $ - */ import junit.framework.TestCase; import org.apache.velocity.VelocityContext; import org.apache.velocity.context.InternalContextAdapterImpl; @@ -29,6 +23,12 @@ import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.runtime.RuntimeInstance; +/** + * Tests scope of velocimacros with localscope setting. + * + * @author a href=mailto:[EMAIL PROTECTED]Stephen Habermann/a + * @version $Id: Handler2.java 447976 2006-09-19 21:29:45Z henning $ + */ public class VMContextLocalscopeTestCase extends TestCase { private RuntimeInstance instance; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r449337 - /jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java
Author: wglass Date: Sat Sep 23 17:03:52 2006 New Revision: 449337 URL: http://svn.apache.org/viewvc?view=revrev=449337 Log: fix eol-style Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java (contents, props changed) Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java?view=diffrev=449337r1=449336r2=449337 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java (original) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java Sat Sep 23 17:03:52 2006 @@ -27,7 +27,7 @@ * Tests scope of velocimacros with localscope setting. * * @author a href=mailto:[EMAIL PROTECTED]Stephen Habermann/a - * @version $Id: Handler2.java 447976 2006-09-19 21:29:45Z henning $ + * @version $Id$ */ public class VMContextLocalscopeTestCase extends TestCase { Propchange: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java -- --- eol-style (added) +++ eol-style Sat Sep 23 17:03:52 2006 @@ -0,0 +1 @@ +native Propchange: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java -- svn:keywords = Id Author Date Revision - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r449346 - /jakarta/velocity/engine/trunk/xdocs/changes.xml
Author: wglass Date: Sat Sep 23 20:47:16 2006 New Revision: 449346 URL: http://svn.apache.org/viewvc?view=revrev=449346 Log: update change log for VELOCITY-459 Modified: jakarta/velocity/engine/trunk/xdocs/changes.xml Modified: jakarta/velocity/engine/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/xdocs/changes.xml?view=diffrev=449346r1=449345r2=449346 == --- jakarta/velocity/engine/trunk/xdocs/changes.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/changes.xml Sat Sep 23 20:47:16 2006 @@ -24,6 +24,11 @@ body release version=1.5-dev date=in Subversion + action type=fix dev=wglass issue=VELOCITY-459 due-to=Stephen Haberman + Change the meaning of localscope for macros to allow access to references from + calling context. + /action + action type=add dev=henning Add a test for the DataSourceResource Loader. /action - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r449347 - in /jakarta/velocity/engine/trunk: src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java src/test/org/apache/velocity/test/IntrospectionCacheDataTestCase.java xdocs/cha
Author: wglass Date: Sat Sep 23 20:55:33 2006 New Revision: 449347 URL: http://svn.apache.org/viewvc?view=revrev=449347 Log: Fix to introspection method caching. Thanks to Alexey Panchenko for the catch, fix, and test. VELOCITY-453. Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectionCacheDataTestCase.java (with props) Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java jakarta/velocity/engine/trunk/xdocs/changes.xml Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?view=diffrev=449347r1=449346r2=449347 == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java Sat Sep 23 20:55:33 2006 @@ -18,6 +18,7 @@ import java.lang.reflect.InvocationTargetException; +import org.apache.commons.lang.ArrayUtils; import org.apache.velocity.app.event.EventHandlerUtil; import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.exception.MethodInvocationException; @@ -45,7 +46,7 @@ */ public class ASTMethod extends SimpleNode { -private String methodName = ; +protected String methodName = ; private int paramCount = 0; /** @@ -126,7 +127,7 @@ * change from visit to visit */ -Class[] paramClasses = new Class[paramCount]; +final Class[] paramClasses = paramCount 0 ? new Class[paramCount] : ArrayUtils.EMPTY_CLASS_ARRAY; for (int j = 0; j paramCount; j++) { @@ -325,23 +326,51 @@ this.params = params; } +private final ASTMethod getASTMethod() +{ +return ASTMethod.this; +} + /** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object o) { -return (o != null) -(o instanceof MethodCacheKey) -(this.hashCode() == o.hashCode()); +if (o instanceof MethodCacheKey) +{ +final MethodCacheKey other = (MethodCacheKey) o; +if (params.length == other.params.length methodName.equals(other.getASTMethod().methodName)) +{ +for (int i = 0; i params.length; ++i) +{ +if (params[i] != other.params[i]) +{ +return false; +} +} +return true; +} +} +return false; } + /** * @see java.lang.Object#hashCode() */ -public int hashCode() +public int hashCode() { -return params.hashCode() * 37 + ASTMethod.this.hashCode(); +int result = 0; +for (int i = 0; i params.length; ++i) +{ +final Class param = params[i]; +if (param != null) +{ +result ^= param.hashCode(); +} +} +return result * 37 + methodName.hashCode(); } } - + } Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectionCacheDataTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectionCacheDataTestCase.java?view=autorev=449347 == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectionCacheDataTestCase.java (added) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectionCacheDataTestCase.java Sat Sep 23 20:55:33 2006 @@ -0,0 +1,71 @@ +package org.apache.velocity.test; + +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License) + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.IOException; +import java.io.StringWriter; + +import
svn commit: r434124 - in /jakarta/velocity/engine/trunk: src/java/org/apache/velocity/runtime/parser/node/ASTReference.java src/test/org/apache/velocity/test/ParserTestCase.java xdocs/changes.xml
Author: wglass Date: Wed Aug 23 11:53:40 2006 New Revision: 434124 URL: http://svn.apache.org/viewvc?rev=434124view=rev Log: Stop calling object.toString() twice when evaluating references. Thanks to Stephen Haberman for the patch. Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParserTestCase.java jakarta/velocity/engine/trunk/xdocs/changes.xml Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java?rev=434124r1=434123r2=434124view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java Wed Aug 23 11:53:40 2006 @@ -265,11 +265,18 @@ value = EventHandlerUtil.referenceInsert(rsvc, context, literal(), value); +String toString = null; +if (value != null) +{ +toString = value.toString(); +} + + /* * if value is null... */ -if ( value == null || (value.toString() == null) ) +if ( value == null || toString == null) { /* * write prefix twice, because it's schmoo, so the \ don't escape each other... @@ -302,7 +309,7 @@ { writer.write(escPrefix); writer.write(morePrefix); -writer.write(value.toString()); +writer.write(toString); } return true; Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParserTestCase.java URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParserTestCase.java?rev=434124r1=434123r2=434124view=diff == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParserTestCase.java (original) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParserTestCase.java Wed Aug 23 11:53:40 2006 @@ -16,6 +16,8 @@ */ import java.io.StringWriter; +import java.util.Map; +import java.util.HashMap; import junit.framework.Test; import junit.framework.TestCase; @@ -155,6 +157,35 @@ catch(ParseErrorException pe) { // Do nothing +} +} + +/** + * Test to see if we toString is called multiple times on references. + */ +public void testASTReferenceToStringOnlyCalledOnce() +throws Exception +{ +VelocityEngine ve = new VelocityEngine(); + +ve.init(); + +String template = $counter; + +ToStringCounter counter = new ToStringCounter(); +Map m = new HashMap(); +m.put(counter, counter); + +ve.evaluate(new VelocityContext(m), new StringWriter(), foo, template); + +assertEquals(1, counter.timesCalled); +} + +public static class ToStringCounter { +public int timesCalled = 0; +public String toString() { +this.timesCalled++; +return foo; } } Modified: jakarta/velocity/engine/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/xdocs/changes.xml?rev=434124r1=434123r2=434124view=diff == --- jakarta/velocity/engine/trunk/xdocs/changes.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/changes.xml Wed Aug 23 11:53:40 2006 @@ -24,6 +24,10 @@ body release version=1.5-dev date=in Subversion + action type=fix dev=wglass issue=VELOCITY-438 due-to=Stephen Haberman + Stop references from calling object.toString() twice. + /action + action type=update dev=wglass issue=VELOCITY-429 due-to= Pass through all runtime exceptions. Among other benefits, this allows plugins to throw a runtime exception to signify an application - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r387313 - /jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml
Author: wglass Date: Mon Mar 20 13:17:21 2006 New Revision: 387313 URL: http://svn.apache.org/viewcvs?rev=387313view=rev Log: document new parser pool configuration option Modified: jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml Modified: jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml?rev=387313r1=387312r2=387313view=diff == --- jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml Mon Mar 20 13:17:21 2006 @@ -1713,12 +1713,19 @@ /p p -strongRuntime Configuration/strong +strongParser Configuration/strong +/p +p +codeparser.pool.class = org.apache.velocity.runtime.ParserPoolImpl/codebr/ +This property selects the implementation for the parser pool. This class +must implement ParserPool. Generally there is no reason to change this though +if you are building a high volume web application you might consider including +an alternate implementation that automatically adjusts the size of the pool. /p - p codeparser.pool.size = 20/codebr/ -This property sets the number of parser instances that Velocity will +This property is used by the default pooling implementation to +set the number of parser instances that Velocity will create at startup and keep in a pool. The default of 20 parsers should be more than enough for most uses. In the event that Velocity does run out of parsers, it will indicate so in the log, and - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r387314 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties
Author: wglass Date: Mon Mar 20 13:18:04 2006 New Revision: 387314 URL: http://svn.apache.org/viewcvs?rev=387314view=rev Log: add new heading to property defaults Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties?rev=387314r1=387313r2=387314view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties Mon Mar 20 13:18:04 2006 @@ -120,8 +120,17 @@ # resource.manager.class = org.apache.velocity.runtime.resource.ResourceManagerImpl resource.manager.cache.class = org.apache.velocity.runtime.resource.ResourceCacheImpl -parser.pool.class = org.apache.velocity.runtime.ParserPoolImpl +# +# PARSER POOL +# +# Selects a custom factory class for the parser pool. Must implement +# ParserPool. parser.pool.size is used by the default implementation +# ParserPoolImpl +# + +parser.pool.class = org.apache.velocity.runtime.ParserPoolImpl +parser.pool.size = 20 # # EVENT HANDLER - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385939 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
Author: wglass Date: Tue Mar 14 16:21:53 2006 New Revision: 385939 URL: http://svn.apache.org/viewcvs?rev=385939view=rev Log: Prevent string out of bounds exception. Thanks Klemen Zagar! VELOCITY-432. Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java?rev=385939r1=385938r2=385939view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java Tue Mar 14 16:21:53 2006 @@ -186,7 +186,7 @@ * if appropriate, remove the space from the end * (dreaded MORE kludge part deux) */ -if (!containsLineComment) +if (!containsLineComment ret.length() 0) { return ret.substring(0, ret.length() - 1); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385942 - in /jakarta/velocity/engine/trunk: src/java/org/apache/velocity/runtime/directive/Parse.java test/templates/compare/stop3.cmp test/templates/stop3-include.vm test/templates/stop3
Author: wglass Date: Tue Mar 14 16:43:10 2006 New Revision: 385942 URL: http://svn.apache.org/viewcvs?rev=385942view=rev Log: #stop now works when in a template loaded with #parse. VELOCITY-432. Thanks Klemen Zagar Added: jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp jakarta/velocity/engine/trunk/test/templates/stop3-include.vm jakarta/velocity/engine/trunk/test/templates/stop3.vm Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java jakarta/velocity/engine/trunk/test/templates/templates.properties Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java?rev=385942r1=385941r2=385942view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java Tue Mar 14 16:43:10 2006 @@ -80,6 +80,15 @@ throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException { + /* +* if rendering is no longer allowed (after a stop), we can safely +* skip execution of all the parse directives. +*/ + if(!context.getAllowRendering()) +{ + return true; + } + /* * did we get an argument? */ Added: jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp?rev=385942view=auto == --- jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp (added) +++ jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp Tue Mar 14 16:43:10 2006 @@ -0,0 +1,4 @@ +This test checks the stop directive when included from a parse directive. + +Foo is: stop3-include.vm +A line from stop3-include.vm Added: jakarta/velocity/engine/trunk/test/templates/stop3-include.vm URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/test/templates/stop3-include.vm?rev=385942view=auto == --- jakarta/velocity/engine/trunk/test/templates/stop3-include.vm (added) +++ jakarta/velocity/engine/trunk/test/templates/stop3-include.vm Tue Mar 14 16:43:10 2006 @@ -0,0 +1,3 @@ +A line from stop3-include.vm +#stop +This line should not be seen. Added: jakarta/velocity/engine/trunk/test/templates/stop3.vm URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/test/templates/stop3.vm?rev=385942view=auto == --- jakarta/velocity/engine/trunk/test/templates/stop3.vm (added) +++ jakarta/velocity/engine/trunk/test/templates/stop3.vm Tue Mar 14 16:43:10 2006 @@ -0,0 +1,8 @@ +This test checks the stop directive when included from a parse directive. + +#set($foo = stop3-include.vm) +Foo is: $foo +#parse($foo) +Since the template issued a stop, this line should not be visible. +#parse($foo) + Modified: jakarta/velocity/engine/trunk/test/templates/templates.properties URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/test/templates/templates.properties?rev=385942r1=385941r2=385942view=diff == --- jakarta/velocity/engine/trunk/test/templates/templates.properties (original) +++ jakarta/velocity/engine/trunk/test/templates/templates.properties Tue Mar 14 16:43:10 2006 @@ -48,3 +48,4 @@ test.template.46 = curly-directive test.template.47 = comment-eof test.template.48 = commas +test.template.49 = stop3 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385967 - in /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime: ParserPool.java ParserPoolImpl.java RuntimeConstants.java RuntimeInstance.java RuntimeServices.java defaul
Author: wglass Date: Tue Mar 14 20:11:43 2006 New Revision: 385967 URL: http://svn.apache.org/viewcvs?rev=385967view=rev Log: Change the Parser Pool to be an interface with a default implementation. Thanks to Serge Knystautas for the idea and patch. VELOCITY-433. Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPool.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPoolImpl.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeServices.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPool.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPool.java?rev=385967view=auto == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPool.java (added) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPool.java Tue Mar 14 20:11:43 2006 @@ -0,0 +1,45 @@ +package org.apache.velocity.runtime; + +import org.apache.velocity.runtime.parser.Parser; + +/* + * Copyright 2000-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License) + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Provides instances of parsers as needed. get() will return a new parser if + * available. If a parser is acquired from the pool, put() should be called + * with that parser to make it available again for reuse. + * + * @author a href=mailto:[EMAIL PROTECTED]Serge Knystautas/a + * @version $Id: RuntimeInstance.java 384374 2006-03-08 23:19:30Z nbubna $ + */ +public interface ParserPool +{ +/** + * Initialize the pool so that it can begin serving parser instances. + */ +void initialize(RuntimeServices svc); + +/** + * Retrieve an instance of a parser pool. + */ +Parser get(); + +/** + * Return the parser to the pool so that it may be reused. + */ +void put(Parser parser); +} Added: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPoolImpl.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPoolImpl.java?rev=385967view=auto == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPoolImpl.java (added) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/ParserPoolImpl.java Tue Mar 14 20:11:43 2006 @@ -0,0 +1,79 @@ +package org.apache.velocity.runtime; + +import org.apache.velocity.runtime.parser.Parser; +import org.apache.velocity.util.SimplePool; + +/* + * Copyright 2000-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License) + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This wraps the original parser SimplePool class. It also handles + * instantiating ad-hoc parsers if none are available. + * + * @author a href=mailto:[EMAIL PROTECTED]Serge Knystautas/a + * @version $Id: RuntimeInstance.java 384374 2006-03-08 23:19:30Z nbubna $ + */ +public class ParserPoolImpl implements ParserPool { + +RuntimeServices rsvc = null; +SimplePool pool = null; +int max = RuntimeConstants.NUMBER_OF_PARSERS; + +/** + * Create the underlying pool. + */ +public void initialize(RuntimeServices rsvc) +{ +this.rsvc = rsvc; +max = rsvc.getInt(RuntimeConstants.PARSER_POOL_SIZE, RuntimeConstants.NUMBER_OF_PARSERS); +pool = new SimplePool(max); + +for (int i = 0; i max; i++) +{ +pool.put(rsvc.createNewParser
svn commit: r384891 - in /jakarta/velocity/engine/trunk/xdocs: build.xml docs/developer-guide.xml getting-started.xml index.xml stylesheets/project-website.xml stylesheets/project.xml
Author: wglass Date: Fri Mar 10 10:53:23 2006 New Revision: 384891 URL: http://svn.apache.org/viewcvs?rev=384891view=rev Log: updated link to snapshots now that cvs is dead Modified: jakarta/velocity/engine/trunk/xdocs/build.xml jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml jakarta/velocity/engine/trunk/xdocs/getting-started.xml jakarta/velocity/engine/trunk/xdocs/index.xml jakarta/velocity/engine/trunk/xdocs/stylesheets/project-website.xml jakarta/velocity/engine/trunk/xdocs/stylesheets/project.xml Modified: jakarta/velocity/engine/trunk/xdocs/build.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/build.xml?rev=384891r1=384890r2=384891view=diff == --- jakarta/velocity/engine/trunk/xdocs/build.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/build.xml Fri Mar 10 10:53:23 2006 @@ -22,7 +22,7 @@ can be obtained from a href=http://www.apache.org/dev/version-control.html;Subversion/a or from the a -href=http://cvs.apache.org/snapshots/velocity/;nightly +href=http://svn.apache.org/snapshots/jakarta-velocity/;nightly builds/a. However, you will need to install Ant, an excellent Java-based build tool. Ant is also a Jakarta project, and can be found a href=http://jakarta.apache.org/ant/;here/a. Modified: jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml?rev=384891r1=384890r2=384891view=diff == --- jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml Fri Mar 10 10:53:23 2006 @@ -152,7 +152,7 @@ p If you want to download the latest source, you can do so via the Subversion (svn) source control system, or download a complete -a href=http://cvs.apache.org/snapshots/velocity/;nightly snapshot./a +a href=http://svn.apache.org/snapshots/jakarta-velocity/;nightly snapshot./a /p p Modified: jakarta/velocity/engine/trunk/xdocs/getting-started.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/getting-started.xml?rev=384891r1=384890r2=384891view=diff == --- jakarta/velocity/engine/trunk/xdocs/getting-started.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/getting-started.xml Fri Mar 10 10:53:23 2006 @@ -55,7 +55,7 @@ p If you want to download the latest source, you can do so via the Subversion (svn) source control system, or download a complete -a href=http://cvs.apache.org/snapshots/velocity/;nightly snapshot./a +a href=http://svn.apache.org/snapshots/jakarta-velocity/;nightly snapshot./a /p p Modified: jakarta/velocity/engine/trunk/xdocs/index.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/index.xml?rev=384891r1=384890r2=384891view=diff == --- jakarta/velocity/engine/trunk/xdocs/index.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/index.xml Fri Mar 10 10:53:23 2006 @@ -60,7 +60,7 @@ href=WheredoIgetnightlysnapshots? p Nightly snapshots of the Velocity subversion source code tree can be found -a href=http://cvs.apache.org/snapshots/jakarta-velocity/; here/a. /p +a href=http://svn.apache.org/snapshots/jakarta-velocity/; here/a. /p p These are meant to provide easy access to the actual project source control tree. As this is our live development workspace, there are no guarantees as to what you will Modified: jakarta/velocity/engine/trunk/xdocs/stylesheets/project-website.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/stylesheets/project-website.xml?rev=384891r1=384890r2=384891view=diff == --- jakarta/velocity/engine/trunk/xdocs/stylesheets/project-website.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/stylesheets/project-website.xml Fri Mar 10 10:53:23 2006 @@ -47,7 +47,7 @@ menu name=Developers item name=Source Code Repository href=http://www.apache.org/dev/version-control.html/ item name=Building from Source href=/build.html/ -item name=Nightly Snapshots href=http://cvs.apache.org/snapshots/velocity// +item name=Nightly Snapshots href=http://svn.apache.org/snapshots/jakarta-velocity// item name=Road Map href=http://wiki.apache.org/jakarta-velocity/RoadMap/ item name=Coding Standards href=http://wiki.apache.org/jakarta-velocity/CodeStandards/ item name=Documentation Guidelines href=http://wiki.apache.org
svn commit: r384892 - in /jakarta/velocity/engine/trunk/xdocs: build.xml changes14.xml docs/developer-guide.xml docs/user-guide.xml overview.xml
Author: wglass Date: Fri Mar 10 10:57:26 2006 New Revision: 384892 URL: http://svn.apache.org/viewcvs?rev=384892view=rev Log: changed it's to its when appropriate. VELOCITY-431. Thanks to Carl Manaster for pointing this out. Modified: jakarta/velocity/engine/trunk/xdocs/build.xml jakarta/velocity/engine/trunk/xdocs/changes14.xml jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml jakarta/velocity/engine/trunk/xdocs/docs/user-guide.xml jakarta/velocity/engine/trunk/xdocs/overview.xml Modified: jakarta/velocity/engine/trunk/xdocs/build.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/build.xml?rev=384892r1=384891r2=384892view=diff == --- jakarta/velocity/engine/trunk/xdocs/build.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/build.xml Fri Mar 10 10:57:26 2006 @@ -178,7 +178,7 @@ codedocs/api/code directory /li li -bcodetest/code/b (after jar) will test Velocity against it's testbed +bcodetest/code/b (after jar) will test Velocity against its testbed suite of test routines /li li Modified: jakarta/velocity/engine/trunk/xdocs/changes14.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/changes14.xml?rev=384892r1=384891r2=384892view=diff == --- jakarta/velocity/engine/trunk/xdocs/changes14.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/changes14.xml Fri Mar 10 10:57:26 2006 @@ -119,7 +119,7 @@ subsection name=1.3.1-rc2 href=1.3.1-rc2 p This section desscribes changes to the VEL_1_3_BRANCH after -the 1.3.1-rc2 release. It was released as 1.3.1 on it's own branch, +the 1.3.1-rc2 release. It was released as 1.3.1 on its own branch, VEL_1_3_1_BRANCH on March 31, 2003. /p /subsection Modified: jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml?rev=384892r1=384891r2=384892view=diff == --- jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml Fri Mar 10 10:57:26 2006 @@ -380,7 +380,7 @@ This is very convenient as it allows localized configuration and sharing of resources. For example, this is a very appropriate model for use in a Servlet 2.2+ compliant web application - as each web application can have it's own instance of Velocity, allowing + as each web application can have its own instance of Velocity, allowing that web application's servlet to share resources like templates, a logger, etc. The singleton is accessable via the codeorg.apache.velocity.app.Velocity/code class, and and example of use : @@ -1400,9 +1400,9 @@ p There is a set of default values contained in Velocity's jar, found in /src/java/org/apache/velocity/runtime/defaults/velocity.defaults, that -Velocity uses as it's configuration baseline. +Velocity uses as its configuration baseline. This ensures that Velocity will always have a 'correct' value -for it's configuration keys at startup, although it may not be what you want. +for its configuration keys at startup, although it may not be what you want. /p p @@ -1422,7 +1422,7 @@ p Below are listed the configuration keys that control Velocity's behavior. -Organized by category, each key is listed with it's current default value +Organized by category, each key is listed with its current default value to the right of the '=' sign. /p @@ -1791,7 +1791,7 @@ li bExisting Log4j Logger/Category/bbr/ -Starting with version 1.3, Velocity will log it's output to an existing +Starting with version 1.3, Velocity will log its output to an existing Log4j Category setup elsewhere in the application. With version 1.5, we have switched to using the Logger class, as the Category class is now deprecated in Log4j. To use this feature you must @@ -2032,7 +2032,7 @@ ul li - bFileResourceLoader :/b This loader gets resources from the filesystem. It's + bFileResourceLoader :/b This loader gets resources from the filesystem. Its configuration properties include : ul li Modified: jakarta/velocity/engine/trunk/xdocs/docs/user-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/docs/user-guide.xml?rev=384892r1=384891r2=384892view=diff == --- jakarta/velocity/engine/trunk/xdocs/docs/user-guide.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/docs/user-guide.xml Fri Mar 10 10:57:26 2006 @@ -1829,7 +1829,7 @@ p In fact, because all script elements - are escaped, em$jazz/em is never evaluated for it's boolean value. + are escaped, em$jazz/em is never evaluated for its boolean value
svn commit: r384896 - /jakarta/velocity/engine/trunk/xdocs/build.xml
Author: wglass Date: Fri Mar 10 11:07:48 2006 New Revision: 384896 URL: http://svn.apache.org/viewcvs?rev=384896view=rev Log: trivial wording change Modified: jakarta/velocity/engine/trunk/xdocs/build.xml Modified: jakarta/velocity/engine/trunk/xdocs/build.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/build.xml?rev=384896r1=384895r2=384896view=diff == --- jakarta/velocity/engine/trunk/xdocs/build.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/build.xml Fri Mar 10 11:07:48 2006 @@ -23,7 +23,7 @@ href=http://www.apache.org/dev/version-control.html;Subversion/a or from the a href=http://svn.apache.org/snapshots/jakarta-velocity/;nightly -builds/a. However, you will need to install Ant, an excellent +snapshots/a. However, you will need to install Ant, an excellent Java-based build tool. Ant is also a Jakarta project, and can be found a href=http://jakarta.apache.org/ant/;here/a. /p - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r373415 - in /jakarta/velocity/engine/trunk/src/java/org/apache/velocity: runtime/parser/node/ASTIdentifier.java runtime/parser/node/ASTMethod.java util/introspection/UberspectImpl.java
Author: wglass Date: Sun Jan 29 18:34:47 2006 New Revision: 373415 URL: http://svn.apache.org/viewcvs?rev=373415view=rev Log: prevent potential NPE when evaluating references Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java?rev=373415r1=373414r2=373415view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java Sun Jan 29 18:34:47 2006 @@ -96,8 +96,6 @@ try { -Class c = o.getClass(); - /* * first, see if we have this information cached. */ @@ -111,7 +109,7 @@ * that is fixed in the template :) */ -if (icd != null icd.contextData == c) +if ( icd != null (o != null) (icd.contextData == o.getClass()) ) { vg = (VelPropertyGet) icd.thingy; } @@ -124,10 +122,10 @@ vg = rsvc.getUberspect().getPropertyGet(o,identifier, uberInfo); -if (vg != null vg.isCacheable()) +if (vg != null vg.isCacheable() (o != null)) { icd = new IntrospectionCacheData(); -icd.contextData = c; +icd.contextData = o.getClass(); icd.thingy = vg; context.icachePut(this,icd); } Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?rev=373415r1=373414r2=373415view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java Sun Jan 29 18:34:47 2006 @@ -155,7 +155,7 @@ method = rsvc.getUberspect().getMethod(o, methodName, params, new Info(context.getCurrentTemplateName(), getLine(), getColumn())); -if (method != null) +if ((method != null) (o != null)) { icd = new IntrospectionCacheData(); icd.contextData = o.getClass(); Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java?rev=373415r1=373414r2=373415view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java Sun Jan 29 18:34:47 2006 @@ -150,6 +150,9 @@ public VelPropertyGet getPropertyGet(Object obj, String identifier, Info i) throws Exception { +if (obj == null) +return null; + AbstractExecutor executor; Class claz = obj.getClass(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r373422 - /jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java
Author: wglass Date: Sun Jan 29 19:46:13 2006 New Revision: 373422 URL: http://svn.apache.org/viewcvs?rev=373422view=rev Log: fix author tag Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java?rev=373422r1=373421r2=373422view=diff == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java (original) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java Sun Jan 29 19:46:13 2006 @@ -38,7 +38,7 @@ * Tests event handling for all event handlers when multiple event handlers are * assigned for each type. * - * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a + * @author a href=mailto:[EMAIL PROTECTED]Will Glass-Husain/a * @version $Id$ */ public class FilteredEventHandlingTestCase extends BaseTestCase implements LogChute - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r373430 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/ParseDirectiveException.java
Author: wglass Date: Sun Jan 29 20:36:14 2006 New Revision: 373430 URL: http://svn.apache.org/viewcvs?rev=373430view=rev Log: removed unused file Removed: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/ParseDirectiveException.java - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r373432 - in /jakarta/velocity/engine/trunk: src/test/org/apache/velocity/test/ test/includeerror/
Author: wglass Date: Sun Jan 29 20:44:01 2006 New Revision: 373432 URL: http://svn.apache.org/viewcvs?rev=373432view=rev Log: test case for VELOCITY-95, VELOCITY-96 Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java (with props) jakarta/velocity/engine/trunk/test/includeerror/ jakarta/velocity/engine/trunk/test/includeerror/haserror.txt (with props) jakarta/velocity/engine/trunk/test/includeerror/haserror2.txt (with props) jakarta/velocity/engine/trunk/test/includeerror/missinginclude.vm (with props) jakarta/velocity/engine/trunk/test/includeerror/missingparse.vm (with props) jakarta/velocity/engine/trunk/test/includeerror/parsemain.vm (with props) jakarta/velocity/engine/trunk/test/includeerror/parsemain2.vm (with props) Added: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java?rev=373432view=auto == --- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java (added) +++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java Sun Jan 29 20:44:01 2006 @@ -0,0 +1,120 @@ +package org.apache.velocity.test; + +import java.io.StringWriter; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.context.Context; +import org.apache.velocity.exception.ParseErrorException; +import org.apache.velocity.exception.ResourceNotFoundException; + + +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License) + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/** + * Test that #parse and #include pass errors to calling code. + * Specifically checking against VELOCITY-95 and VELOCITY-96. + * + * @author a href=mailto:[EMAIL PROTECTED]Will Glass-Husain/a + * @version $Id$ + */ +public class IncludeErrorTestCase extends BaseTestCase implements TemplateTestBase +{ +VelocityEngine ve; + +/** + * Default constructor. + */ +public IncludeErrorTestCase(String name) +{ +super(name); +} + +public static Test suite () +{ +return new TestSuite(IncludeErrorTestCase.class); +} + +public void setUp() throws Exception +{ +ve = new VelocityEngine(); +ve.setProperty( +Velocity.FILE_RESOURCE_LOADER_PATH, test/includeerror); + +ve.init(); +} + + + +public void testMissingParseError() throws Exception +{ +checkException(missingparse.vm,ResourceNotFoundException.class); +} + +public void testMissingIncludeError() throws Exception +{ +checkException(missinginclude.vm,ResourceNotFoundException.class); +} + +public void testParseError() throws Exception +{ +checkException(parsemain.vm,ParseErrorException.class); +} + +public void testParseError2() throws Exception +{ +checkException(parsemain2.vm,ParseErrorException.class); +} + + +/** + * Check that an exception is thrown for the given template + * @param templateName + * @param exceptionClass + * @throws Exception + */ +private void checkException(String templateName,Class exceptionClass) +throws Exception +{ +Context context = new VelocityContext(); +StringWriter writer = new StringWriter(); +Template template = ve.getTemplate(templateName, UTF-8); + +try +{ +template.merge(context, writer); +writer.flush(); +fail(File should have thrown an exception); +} +catch (Exception E) +{ +assertTrue(exceptionClass.isAssignableFrom(E.getClass())); +} +finally +{ +writer.close(); +} + +} + +} Propchange: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java -- svn:eol-style = native Propchange: jakarta/velocity/engine/trunk/src/test/org/apache
svn commit: r373441 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/app/event/implement/ java/org/apache/velocity/runtime/ java/org/apache/velocity/runtime/log/ java/org/apache/veloc
Author: wglass Date: Sun Jan 29 21:17:35 2006 New Revision: 373441 URL: http://svn.apache.org/viewcvs?rev=373441view=rev Log: trim spaces from all properties. VELOCITY-274 Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/AvalonLogChute.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/texen/ant/TexenTask.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/util/StringUtils.java jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MiscTestCase.java Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java?rev=373441r1=373440r2=373441view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java Sun Jan 29 21:17:35 2006 @@ -21,6 +21,7 @@ import org.apache.velocity.app.event.ReferenceInsertionEventHandler; import org.apache.velocity.app.event.RuntimeServicesAware; import org.apache.velocity.runtime.RuntimeServices; +import org.apache.velocity.util.StringUtils; /** * Base class for escaping references. To use it, override the following methods: @@ -114,8 +115,8 @@ /** * Get the regular expression pattern. */ -matchRegExp = rs.getConfiguration().getString(getMatchAttribute()); -if ((matchRegExp != null) (matchRegExp.trim().length() == 0)) +matchRegExp = StringUtils.nullTrim(rs.getConfiguration().getString(getMatchAttribute())); +if ((matchRegExp != null) (matchRegExp.length() == 0)) { matchRegExp = null; } Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java?rev=373441r1=373440r2=373441view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/app/event/implement/IncludeNotFound.java Sun Jan 29 21:17:35 2006 @@ -16,9 +16,10 @@ * limitations under the License. */ -import org.apache.velocity.app.event.RuntimeServicesAware; import org.apache.velocity.app.event.IncludeEventHandler; +import org.apache.velocity.app.event.RuntimeServicesAware; import org.apache.velocity.runtime.RuntimeServices; +import org.apache.velocity.util.StringUtils; /** * Simple event handler that checks to see if an included page is available. @@ -82,7 +83,7 @@ public void setRuntimeServices(RuntimeServices rs) throws Exception { this.rs = rs; - notfound = rs.getString(PROPERTY_NOT_FOUND, DEFAULT_NOT_FOUND).trim(); + notfound = StringUtils.nullTrim(rs.getString(PROPERTY_NOT_FOUND, DEFAULT_NOT_FOUND)); } } Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=373441r1=373440r2=373441view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Sun Jan 29 21:17:35 2006 @@ -30,16 +30,16 @@ import org.apache.velocity.Template; import org.apache.velocity.app.event.EventCartridge; import org.apache.velocity.app.event.EventHandler; -import org.apache.velocity.app.event.RuntimeServicesAware; import org.apache.velocity.app.event.IncludeEventHandler
svn commit: r373443 - /jakarta/velocity/engine/trunk/src/parser/Parser.jjt
Author: wglass Date: Sun Jan 29 21:34:46 2006 New Revision: 373443 URL: http://svn.apache.org/viewcvs?rev=373443view=rev Log: remove comment obsoleted in rev#75636 Modified: jakarta/velocity/engine/trunk/src/parser/Parser.jjt Modified: jakarta/velocity/engine/trunk/src/parser/Parser.jjt URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/parser/Parser.jjt?rev=373443r1=373442r2=373443view=diff == --- jakarta/velocity/engine/trunk/src/parser/Parser.jjt (original) +++ jakarta/velocity/engine/trunk/src/parser/Parser.jjt Sun Jan 29 21:34:46 2006 @@ -1215,9 +1215,6 @@ /** * Supports the arguments for the Pluggable Directives - * We add whitespace in here as a token so the VMs can - * easily reconstruct a macro body from the token stream - * See Directive() */ int DirectiveArg() #void : {} { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r373465 - in /jakarta/velocity/engine/trunk: src/java/org/apache/velocity/runtime/parser/ src/parser/ test/templates/ test/templates/compare/
Author: wglass Date: Sun Jan 29 23:14:12 2006 New Revision: 373465 URL: http://svn.apache.org/viewcvs?rev=373465view=rev Log: Allow either commas or spaces to separate macro arguments. VELOCITY-430. Added: jakarta/velocity/engine/trunk/test/templates/commas.vm (with props) jakarta/velocity/engine/trunk/test/templates/compare/commas.cmp (with props) Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java jakarta/velocity/engine/trunk/src/parser/Parser.jjt jakarta/velocity/engine/trunk/test/templates/templates.properties Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java?rev=373465r1=373464r2=373465view=diff == --- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java (original) +++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java Sun Jan 29 23:14:12 2006 @@ -1,54 +1,15 @@ /* Generated By:JJTreeJavaCC: Do not edit this line. Parser.java */ package org.apache.velocity.runtime.parser; -import java.io.ByteArrayInputStream; -import java.io.Reader; -import java.util.Hashtable; +import java.io.*; +import java.util.*; + import org.apache.velocity.runtime.RuntimeServices; +import org.apache.velocity.runtime.parser.node.*; import org.apache.velocity.runtime.directive.Directive; import org.apache.velocity.runtime.directive.Macro; import org.apache.velocity.runtime.directive.MacroParseException; -import org.apache.velocity.runtime.parser.node.ASTAddNode; -import org.apache.velocity.runtime.parser.node.ASTAndNode; -import org.apache.velocity.runtime.parser.node.ASTAssignment; -import org.apache.velocity.runtime.parser.node.ASTBlock; -import org.apache.velocity.runtime.parser.node.ASTComment; -import org.apache.velocity.runtime.parser.node.ASTDirective; -import org.apache.velocity.runtime.parser.node.ASTDivNode; -import org.apache.velocity.runtime.parser.node.ASTEQNode; -import org.apache.velocity.runtime.parser.node.ASTElseIfStatement; -import org.apache.velocity.runtime.parser.node.ASTElseStatement; -import org.apache.velocity.runtime.parser.node.ASTEscape; -import org.apache.velocity.runtime.parser.node.ASTEscapedDirective; -import org.apache.velocity.runtime.parser.node.ASTExpression; -import org.apache.velocity.runtime.parser.node.ASTFalse; -import org.apache.velocity.runtime.parser.node.ASTFloatingPointLiteral; -import org.apache.velocity.runtime.parser.node.ASTGENode; -import org.apache.velocity.runtime.parser.node.ASTGTNode; -import org.apache.velocity.runtime.parser.node.ASTIdentifier; -import org.apache.velocity.runtime.parser.node.ASTIfStatement; -import org.apache.velocity.runtime.parser.node.ASTIntegerLiteral; -import org.apache.velocity.runtime.parser.node.ASTIntegerRange; -import org.apache.velocity.runtime.parser.node.ASTLENode; -import org.apache.velocity.runtime.parser.node.ASTLTNode; -import org.apache.velocity.runtime.parser.node.ASTMap; -import org.apache.velocity.runtime.parser.node.ASTMethod; -import org.apache.velocity.runtime.parser.node.ASTModNode; -import org.apache.velocity.runtime.parser.node.ASTMulNode; -import org.apache.velocity.runtime.parser.node.ASTNENode; -import org.apache.velocity.runtime.parser.node.ASTNotNode; -import org.apache.velocity.runtime.parser.node.ASTObjectArray; -import org.apache.velocity.runtime.parser.node.ASTOrNode; -import org.apache.velocity.runtime.parser.node.ASTReference; -import org.apache.velocity.runtime.parser.node.ASTSetDirective; -import org.apache.velocity.runtime.parser.node.ASTStop; -import org.apache.velocity.runtime.parser.node.ASTStringLiteral; -import org.apache.velocity.runtime.parser.node.ASTSubtractNode; -import org.apache.velocity.runtime.parser.node.ASTText; -import org.apache.velocity.runtime.parser.node.ASTTrue; -import org.apache.velocity.runtime.parser.node.ASTWord; -import org.apache.velocity.runtime.parser.node.ASTprocess; -import org.apache.velocity.runtime.parser.node.SimpleNode; +import org.apache.velocity.util.StringUtils; /** * This class is responsible for parsing a Velocity @@ -587,9 +548,6 @@ /** * Supports the arguments for the Pluggable Directives - * We add whitespace in here as a token so the VMs can - * easily reconstruct a macro body from the token stream - * See Directive() */ final public int DirectiveArg() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -764,6 +722,22 @@ jj_la1[9
svn commit: r369529 - /jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml
Author: wglass Date: Mon Jan 16 09:29:55 2006 New Revision: 369529 URL: http://svn.apache.org/viewcvs?rev=369529view=rev Log: Fixed typo in jdom example. Thanks to Adrian Smith for the catch. Modified: jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml Modified: jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml?rev=369529r1=369528r2=369529view=diff == --- jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml (original) +++ jakarta/velocity/engine/trunk/xdocs/docs/developer-guide.xml Mon Jan 16 09:29:55 2006 @@ -2392,7 +2392,8 @@ {} VelocityContext vc = new VelocityContext(); -vc.put(root, root ); +vc.put(root, root.getRootElement()); + ... ]]/source - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365675 - in /jakarta/velocity/core/trunk/xdocs/docs: developer-guide.xml user-guide.xml
Author: wglass Date: Tue Jan 3 08:23:55 2006 New Revision: 365675 URL: http://svn.apache.org/viewcvs?rev=365675view=rev Log: Fixed typo for property directive.parse.max.depth. Thanks to Oliver Kohll for the catch. Modified: jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml Modified: jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml?rev=365675r1=365674r2=365675view=diff == --- jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml (original) +++ jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml Tue Jan 3 08:23:55 2006 @@ -1537,7 +1537,7 @@ (next) tag are defined. /p p -codedirective.parse.maxdepth = 10/codebr/ +codedirective.parse.max.depth = 10/codebr/ Defines the allowable parse depth for a template. A template may #parse() another template which itself may have a #parse() directive. This value prevents runaway #parse() recursion. Modified: jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml?rev=365675r1=365674r2=365675view=diff == --- jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml (original) +++ jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml Tue Jan 3 08:23:55 2006 @@ -920,11 +920,11 @@ p If the RHS is a property or method reference that evaluates to emnull/em, it will bnot/b be assigned to the LHS. - Depending on how Velocity is configured, it is usually not +Depending on how Velocity is configured, it is usually not possible to remove an existing reference from the context via this mechanism. - (Note that this can be permitted by changing one of the Velocity configuration properties). - This can be confusing for +(Note that this can be permitted by changing one of the Velocity configuration properties). +This can be confusing for newcomers to Velocity. For example: /p @@ -1166,8 +1166,8 @@ pNote that the semantics of em==/em are slightly different than Java where em==/em can only be used to test object equality. In Velocity the equivalent operator can be used to directly compare numbers, strings, or objects. When the objects - are of different classes, the string representations are obtained by calling - codetoString()/code for each object and then compared. +are of different classes, the string representations are obtained by calling +codetoString()/code for each object and then compared. /p p @@ -1420,10 +1420,10 @@ p VTL templates can have em#parse/em statements referring to templates that in turn have em#parse/em statements. By default -set to 10, the emparse_directive.maxdepth/em line of the +set to 10, the emdirective.parse.max.depth/em line of the codevelocity.properties/code allows users to customize maximum number of em#parse/em referrals that can occur from a single -template. (Note: If the emparse_directive.maxdepth/em property +template. (Note: If the emdirective.parse.max.depth/em property is absent from the codevelocity.properties/code file, Velocity will set this default to 10.) Recursion is permitted, for example, if the template codedofoo.vm/code contains the following lines: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365829 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
Author: wglass Date: Tue Jan 3 21:30:46 2006 New Revision: 365829 URL: http://svn.apache.org/viewcvs?rev=365829view=rev Log: Correct fix to VELOCITY-98. If page writer alternates #parse and #include for the same file, the file needs to be reloaded (can't reuse the cache). Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=365829r1=365828r2=365829view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java Tue Jan 3 21:30:46 2006 @@ -22,6 +22,7 @@ import java.io.InputStream; import java.io.IOException; +import org.apache.velocity.Template; import org.apache.velocity.runtime.log.Log; import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.RuntimeConstants; @@ -294,6 +295,23 @@ Resource resource = globalCache.get(resourceName); +/** + * Check to see if the type has changed and reload the file if so. + * For example, if a file has been loaded with #include and then #parse + * If so, reload the resource. + * + * Note that if a page repeatedly alternates #include and #parse + * on the same file the cache is essentially negated. + */ +if ( resource != null ) +{ +if ( ((resourceType == RESOURCE_CONTENT) !(resource instanceof ContentResource)) || + ((resourceType == RESOURCE_TEMPLATE) !(resource instanceof Template)) ) +{ +resource = null; +} +} + if( resource != null) { /* - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365831 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
Author: wglass Date: Tue Jan 3 21:40:24 2006 New Revision: 365831 URL: http://svn.apache.org/viewcvs?rev=365831view=rev Log: Here's a better fix to Velocity-98 which caches #include static text separately from templates. Patch as suggested by original contributor Michal Chmielewski. Thanks! Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=365831r1=365830r2=365831view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java Tue Jan 3 21:40:24 2006 @@ -16,27 +16,21 @@ * limitations under the License. */ +import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.Vector; -import java.io.InputStream; -import java.io.IOException; - -import org.apache.velocity.Template; -import org.apache.velocity.runtime.log.Log; -import org.apache.velocity.runtime.RuntimeServices; +import org.apache.commons.collections.ExtendedProperties; +import org.apache.velocity.exception.ParseErrorException; +import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.velocity.runtime.RuntimeConstants; - -import org.apache.velocity.runtime.resource.ResourceFactory; +import org.apache.velocity.runtime.RuntimeServices; +import org.apache.velocity.runtime.log.Log; import org.apache.velocity.runtime.resource.loader.ResourceLoader; import org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory; import org.apache.velocity.util.ClassUtils; -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.exception.ParseErrorException; - -import org.apache.commons.collections.ExtendedProperties; - /** * Class to manage the text resource for the Velocity * Runtime. @@ -291,27 +285,14 @@ * If it was placed in the cache then we will use * the cached version of the resource. If not we * will load it. - */ - -Resource resource = globalCache.get(resourceName); - -/** - * Check to see if the type has changed and reload the file if so. - * For example, if a file has been loaded with #include and then #parse - * If so, reload the resource. * - * Note that if a page repeatedly alternates #include and #parse - * on the same file the cache is essentially negated. + * Note: the type is included in the key to differentiate ContentResource + * (static content from #include) with a Template. */ -if ( resource != null ) -{ -if ( ((resourceType == RESOURCE_CONTENT) !(resource instanceof ContentResource)) || - ((resourceType == RESOURCE_TEMPLATE) !(resource instanceof Template)) ) -{ -resource = null; -} -} +String resourceKey = resourceType + resourceName; +Resource resource = globalCache.get(resourceKey); + if( resource != null) { /* @@ -330,7 +311,7 @@ * so clear the cache and try again */ - globalCache.remove( resourceName ); + globalCache.remove( resourceKey ); return getResource( resourceName, resourceType, encoding ); } @@ -357,7 +338,7 @@ if (resource.getResourceLoader().isCachingOn()) { -globalCache.put(resourceName, resource); +globalCache.put(resourceKey, resource); } } catch( ResourceNotFoundException rnfe2 ) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365832 - in /jakarta/velocity/core/trunk: src/java/org/apache/velocity/ src/java/org/apache/velocity/app/ src/java/org/apache/velocity/runtime/directive/ src/java/org/apache/velocity/runt
Author: wglass Date: Tue Jan 3 21:45:40 2006 New Revision: 365832 URL: http://svn.apache.org/viewcvs?rev=365832view=rev Log: Pass through RuntimeExceptions from plugins and event handlers. (except for MethodExceptionEventHandler). VELOCITY-429. Added: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ExceptionTestCase.java (with props) jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingDirective.java (with props) jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingEventHandler.java (with props) jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java (with props) Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/directive/Include.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/BooleanPropertyExecutor.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/UberspectTestImpl.java jakarta/velocity/core/trunk/xdocs/changes.xml Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java?rev=365832r1=365831r2=365832view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java Tue Jan 3 21:45:40 2006 @@ -16,23 +16,20 @@ * limitations under the License. */ -import java.io.InputStream; -import java.io.Writer; import java.io.BufferedReader; +import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; +import java.io.Writer; -import org.apache.velocity.runtime.resource.Resource; -import org.apache.velocity.runtime.parser.ParseException; -import org.apache.velocity.runtime.parser.node.SimpleNode; - -import org.apache.velocity.VelocityContext; import org.apache.velocity.context.Context; import org.apache.velocity.context.InternalContextAdapterImpl; - -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.exception.ParseErrorException; import org.apache.velocity.exception.MethodInvocationException; +import org.apache.velocity.exception.ParseErrorException; +import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.runtime.parser.ParseException; +import org.apache.velocity.runtime.parser.node.SimpleNode; +import org.apache.velocity.runtime.resource.Resource; /** * This class is used for controlling all template @@ -134,6 +131,13 @@ */ errorCondition = new ParseErrorException( pex ); throw errorCondition; +} +/** + * pass through runtime exceptions + */ +catch( RuntimeException e ) +{ +throw e; } catch( Exception e ) { Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java?rev=365832r1=365831r2=365832view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java Tue Jan 3 21:45:40 2006 @@ -16,31 +16,28 @@ * limitations under the License. */ -import java.io.Writer; -import java.util.Properties
svn commit: r365836 - /jakarta/velocity/core/trunk/build/build.xml
Author: wglass Date: Tue Jan 3 22:14:17 2006 New Revision: 365836 URL: http://svn.apache.org/viewcvs?rev=365836view=rev Log: Added Implementation-Vendor-Id as recommended in http://java.sun.com/j2se/1.5.0/docs/guide/extensions/versioning.html Modified: jakarta/velocity/core/trunk/build/build.xml Modified: jakarta/velocity/core/trunk/build/build.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/build/build.xml?rev=365836r1=365835r2=365836view=diff == --- jakarta/velocity/core/trunk/build/build.xml (original) +++ jakarta/velocity/core/trunk/build/build.xml Tue Jan 3 22:14:17 2006 @@ -409,6 +409,7 @@ attribute name=Specification-Title value=Velocity is a Java-based template engine / attribute name=Specification-Vendor value=Apache Software Foundation/ attribute name=Implementation-Title value=org.apache.velocity/ +attribute name=Implementation-Vendor-Id value=org.apache/ attribute name=Implementation-Vendor value=Apache Software Foundation/ attribute name=Implementation-Version value=${version}/ /manifest @@ -430,6 +431,7 @@ attribute name=Specification-Vendor value=Apache Software Foundation/ attribute name=Implementation-Title value=org.apache.velocity/ attribute name=Implementation-Vendor value=Apache Software Foundation/ +attribute name=Implementation-Vendor-Id value=org.apache/ attribute name=Implementation-Version value=${version}/ /manifest /jar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365843 - /jakarta/velocity/core/trunk/xdocs/index.xml
Author: wglass Date: Tue Jan 3 22:26:13 2006 New Revision: 365843 URL: http://svn.apache.org/viewcvs?rev=365843view=rev Log: fixed link to svn repository Modified: jakarta/velocity/core/trunk/xdocs/index.xml Modified: jakarta/velocity/core/trunk/xdocs/index.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/index.xml?rev=365843r1=365842r2=365843view=diff == --- jakarta/velocity/core/trunk/xdocs/index.xml (original) +++ jakarta/velocity/core/trunk/xdocs/index.xml Tue Jan 3 22:26:13 2006 @@ -96,7 +96,7 @@ contribute to the FAQ! /li li Read-only access to the Subversion strongjakarta-velocity/strong repository is available both - a href=http://svn.apache.org/repos/asf/jakarta/velocity/trunk/; + a href=http://svn.apache.org/repos/asf/jakarta/velocity/core/trunk/; online/a and with a a href=http://www.apache.org/dev/version-control.html; Subversion client/a. /li - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365328 - /jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/MultipleFileResourcePathTestCase.java
Author: wglass Date: Mon Jan 2 02:43:03 2006 New Revision: 365328 URL: http://svn.apache.org/viewcvs?rev=365328view=rev Log: remove redundant constants Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/MultipleFileResourcePathTestCase.java Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/MultipleFileResourcePathTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/MultipleFileResourcePathTestCase.java?rev=365328r1=365327r2=365328view=diff == --- jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/MultipleFileResourcePathTestCase.java (original) +++ jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/MultipleFileResourcePathTestCase.java Mon Jan 2 02:43:03 2006 @@ -37,20 +37,6 @@ */ public class MultipleFileResourcePathTestCase extends BaseTestCase { - /** - * VTL file extension. - */ -private static final String TMPL_FILE_EXT = vm; - -/** - * Comparison file extension. - */ -private static final String CMP_FILE_EXT = cmp; - -/** - * Comparison file extension. - */ -private static final String RESULT_FILE_EXT = res; /** * Path for templates. This property will override the - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365339 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroFactory.java
Author: wglass Date: Mon Jan 2 04:42:18 2006 New Revision: 365339 URL: http://svn.apache.org/viewcvs?rev=365339view=rev Log: prevent NPE when velocimacro.library.autoreload=true and there is no global velocimacro library Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroFactory.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroFactory.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroFactory.java?rev=365339r1=365338r2=365339view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroFactory.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroFactory.java Mon Jan 2 04:42:18 2006 @@ -390,7 +390,7 @@ * template is one of the library templates */ -if ( getAutoload() ) +if ( getAutoload() (macroLibVec != null) ) { /* * see if this is a library template - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365508 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java
Author: wglass Date: Mon Jan 2 17:18:13 2006 New Revision: 365508 URL: http://svn.apache.org/viewcvs?rev=365508view=rev Log: Fix typo in comments Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java?rev=365508r1=365507r2=365508view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java Mon Jan 2 17:18:13 2006 @@ -234,7 +234,7 @@ /** * The codeeventhandler.methodexception.class/code property * specifies a list of the [EMAIL PROTECTED] - * org.apache.velocity.app.event.MethoExceptionEventHandler} + * org.apache.velocity.app.event.MethodExceptionEventHandler} * implementations to use. */ public static final String EVENTHANDLER_METHODEXCEPTION = eventhandler.methodexception.class; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365509 - in /jakarta/velocity/core/trunk/xdocs: changes.xml changes14.xml docs/changes.xml
Author: wglass Date: Mon Jan 2 17:22:48 2006 New Revision: 365509 URL: http://svn.apache.org/viewcvs?rev=365509view=rev Log: Updated change.xml file in maven format with all changes to date for 1.5. (in gradual preparation for 1.5 release). Moved changelog for 1.4 and earlier to separate file. Added: jakarta/velocity/core/trunk/xdocs/changes14.xml - copied, changed from r365327, jakarta/velocity/core/trunk/xdocs/docs/changes.xml Removed: jakarta/velocity/core/trunk/xdocs/docs/changes.xml Modified: jakarta/velocity/core/trunk/xdocs/changes.xml Modified: jakarta/velocity/core/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/changes.xml?rev=365509r1=365508r2=365509view=diff == --- jakarta/velocity/core/trunk/xdocs/changes.xml (original) +++ jakarta/velocity/core/trunk/xdocs/changes.xml Mon Jan 2 17:22:48 2006 @@ -23,14 +23,322 @@ body release version=1.5-dev date=in Subversion - action type=fix dev=henning issue=VELOCITY-424 due-to=Malcom Edgar + + action type=add dev=wglass issue=VELOCITY-425 due-to=Llewellyn Falco +Wrapped exceptions now have Cause property set on JDK 1.4. (note that Velocity +continues to run under JDK 1.3). + /action + + action type=fix dev=wglass issue=VELOCITY-418 due-to=Jason Weinstein +When Velocity is initialized, default.properties stream was not being closed. This + made it difficult to undeploy webapps on Windows with Velocity unpacked. + /action + + action type=fix dev=wglass issue=VELOCITY-151 due-to=Kirk Wolf +Upgraded to latest commons collection, fixing problem with non-recognition +of configuration file encoding in rare circumstances. + /action + + action type=fix dev=wglass issue=VELOCITY-370 due-to=Reggie Riser +The Introspector could throw a NPE when a parameter to an overloaded method was null. + /action + + action type=fix dev=wglass issue=VELOCITY-381 due-to=Llwellyn Falco and Dan Powell +If toString() returned null in a silent reference then null was displayed. + /action + + action type=fix dev=wglass issue=VELOCITY-359 due-to= +Fixed bug in which empty body for #if (e.g. code#if(some expression)#end/code +caused ParseException. + /action + + action type=add dev=wglass issue=VELOCITY-222 due-to= +Added javacc task to build.xml simplifying modification process +for editing syntax files. + /action + + action type=fix dev=wglass issue=VELOCITY-374 due-to= +Velocity Engine was throwing NPE when used without a call to +init(). Now gives a more meaningful exception message. + /action + + action type=update dev=wglass issue=VELOCITY-404 due-to=Llewellyn Falco +Fixed problem with Uberspect Info class being created incorrectly. +Added template name to Info allowing better error reporting. + /action + + action type=update dev=wglass issue= due-to= +Numerous improvements to the documentation. Reorganized table of +contents, moved community content to the Wiki, added article on using +Velocity in web applications. + /action + + action type=update dev=wglass issue=VELOCITY-350 due-to= +When testing objects in VTL for equality, if both objects are a number, use +number equality. If both objects are the same class, use the equals method. +New behavior: If objects are different classes, compare the String +representation of both objects rather than logging an error. + /action + + action type=fix dev=wglass issue=VELOCITY-272 due-to= +Velocity would give error when last line of file was a ## comment. + /action + + action type=update dev=wglass issue=VELOCITY-412 due-to=Malcolm Edgar +Added method to retrieve application attributes. + /action + + action type=update dev=wglass issue=VELOCITY-196 due-to= +Velocity now searches in the current thread's context classloader +before the system classloader for all templates loaded with the +ClasspathResourceLoader and for all user-defined ResourceLoaders, +introspectors, event handlers, etc. +A typical use for this is to have Velocity in the application +container classpath while keeping templates and plugins in the +webapp classpath. + /action + + action type=update dev=wglass issue= due-to=Thomas Veith +#set now sets references to null when required. For backwards +compatibility this must be enabled by setting the configuration key +codedirective.set.null.allowed/code to true. + /action + + action type=add dev=wglass issue= due-to= +New optional event handler that escapes all references. +Regular
svn commit: r356432 - /jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java
Author: wglass Date: Mon Dec 12 16:32:29 2005 New Revision: 356432 URL: http://svn.apache.org/viewcvs?rev=356432view=rev Log: clean up imports Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java?rev=356432r1=356431r2=356432view=diff == --- jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java (original) +++ jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java Mon Dec 12 16:32:29 2005 @@ -1,6 +1,5 @@ package org.apache.velocity.test; -import java.io.IOException; import java.io.StringWriter; import junit.framework.Test; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r356433 - /jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java
Author: wglass Date: Mon Dec 12 16:34:46 2005 New Revision: 356433 URL: http://svn.apache.org/viewcvs?rev=356433view=rev Log: fixed javadoc typo Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java?rev=356433r1=356432r2=356433view=diff == --- jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java (original) +++ jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java Mon Dec 12 16:34:46 2005 @@ -29,7 +29,7 @@ /** - * Test that thrown exceptions include (under JDK 1.4+ a proper cause. + * Test thrown exceptions include a proper cause (under JDK 1.4+). * * @author a href=mailto:[EMAIL PROTECTED]Will Glass-Husain/a * @version $Id$ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r350188 - in /jakarta/velocity/core/trunk/src: java/org/apache/velocity/exception/ java/org/apache/velocity/runtime/log/ java/org/apache/velocity/runtime/resource/loader/ java/org/apache/v
Author: wglass Date: Wed Nov 30 22:36:49 2005 New Revision: 350188 URL: http://svn.apache.org/viewcvs?rev=350188view=rev Log: Set the cause for thrown exceptions when run under JDK 1.4+. VELOCITY-425. Added: jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/ExceptionUtils.java (with props) jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java (with props) Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/provider/TestProvider.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java?rev=350188r1=350187r2=350188view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java Wed Nov 30 22:36:49 2005 @@ -1,5 +1,7 @@ package org.apache.velocity.exception; +import org.apache.velocity.util.ExceptionUtils; + /* * Copyright 2001-2004 The Apache Software Foundation. * @@ -50,6 +52,7 @@ { super(message); this.wrapped = e; +ExceptionUtils.setCause(this, e); this.methodName = methodName; } Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java?rev=350188r1=350187r2=350188view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java Wed Nov 30 22:36:49 2005 @@ -18,12 +18,13 @@ import java.io.IOException; import java.lang.reflect.Field; +import org.apache.log4j.Level; import org.apache.log4j.Logger; -import org.apache.log4j.RollingFileAppender; import org.apache.log4j.PatternLayout; -import org.apache.log4j.Level; +import org.apache.log4j.RollingFileAppender; import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.runtime.RuntimeServices; +import org.apache.velocity.util.ExceptionUtils; /** * Implementation of a simple log4j system that will either latch onto @@ -118,7 +119,7 @@ catch (IOException ioe) { rsvc.getLog().warn(Could not create file appender '+file+'\'', ioe); -throw new Exception(Error configuring Log4JLogChute : + ioe); +throw ExceptionUtils.createRuntimeException(Error configuring Log4JLogChute : , ioe); } } Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java?rev=350188r1=350187r2=350188view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java Wed Nov 30 22:36:49 2005 @@ -20,6 +20,7 @@ import org.apache.velocity.runtime.resource.Resource; import org.apache.velocity.util.ClassUtils; +import org.apache.velocity.util.ExceptionUtils; import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.commons.collections.ExtendedProperties; @@ -113,11 +114,7 @@ } catch( Exception fnfe ) { -/* - * log and convert to a general Velocity ResourceNotFoundException - */ - -throw new ResourceNotFoundException( fnfe.getMessage() ); +throw (ResourceNotFoundException) ExceptionUtils.createWithCause(ResourceNotFoundException.class, problem with template: + name, fnfe ); } if (result == null) Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime
svn commit: r345566 - in /jakarta/velocity/core/trunk/test/templates: compare/interpolation.cmp interpolation.vm
Author: wglass Date: Fri Nov 18 13:05:31 2005 New Revision: 345566 URL: http://svn.apache.org/viewcvs?rev=345566view=rev Log: check string interpolation with comments Modified: jakarta/velocity/core/trunk/test/templates/compare/interpolation.cmp jakarta/velocity/core/trunk/test/templates/interpolation.vm Modified: jakarta/velocity/core/trunk/test/templates/compare/interpolation.cmp URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/templates/compare/interpolation.cmp?rev=345566r1=345565r2=345566view=diff == --- jakarta/velocity/core/trunk/test/templates/compare/interpolation.cmp (original) +++ jakarta/velocity/core/trunk/test/templates/compare/interpolation.cmp Fri Nov 18 13:05:31 2005 @@ -16,7 +16,7 @@ How about a directive? Sure : - a b c + a b c For our next trick, lets interpolate a VelociMacro! @@ -36,5 +36,16 @@ False $code $!$\!code + +Now, check comments within strings. double quotes they should be removed. +Single quotes, they should be kept literal. + + +test +test + +testtest +test##test +test#* hello *#test -- end -- Modified: jakarta/velocity/core/trunk/test/templates/interpolation.vm URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/templates/interpolation.vm?rev=345566r1=345565r2=345566view=diff == --- jakarta/velocity/core/trunk/test/templates/interpolation.vm (original) +++ jakarta/velocity/core/trunk/test/templates/interpolation.vm Fri Nov 18 13:05:31 2005 @@ -4,7 +4,7 @@ This template is used for Velocity regression testing. If you alter this template make sure you change the -corresponding comparison file so that the regression +corresponding comparison file so that the regression test doesn't fail incorrectly. *# @@ -34,7 +34,7 @@ #set($arr = [a,b,c]) #set($foo = #foreach($a in $arr) $a #end) -$foo +$foo For our next trick, lets interpolate a VelociMacro! @@ -61,5 +61,22 @@ $a $b $c + +Now, check comments within strings. double quotes they should be removed. +Single quotes, they should be kept literal. + +#set($c1 = test##test) +#set($c2 = test ##test) +#set($c3 = ##test) +#set($c4 = test#* hello *#test) +#set($c5 = 'test##test') +#set($c6 = 'test#* hello *#test') + +$c1 +$c2 +$c3 +$c4 +$c5 +$c6 -- end -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r345571 - in /jakarta/velocity/core/trunk/src/test/org/apache/velocity/test: InfoTestCase.java misc/UberspectTestException.java
Author: wglass Date: Fri Nov 18 13:10:24 2005 New Revision: 345571 URL: http://svn.apache.org/viewcvs?rev=345571view=rev Log: minor tweaks-- fail on (unexpected) exception, add better message Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java?rev=345571r1=345570r2=345571view=diff == --- jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java (original) +++ jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/InfoTestCase.java Fri Nov 18 13:10:24 2005 @@ -104,13 +104,7 @@ } finally { -try -{ -writer.close(); -} -catch (IOException E) -{ -} +writer.close(); } assertInfoEqual(info, templateName, expectedLine, expectedCol); Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java?rev=345571r1=345570r2=345571view=diff == --- jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java (original) +++ jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java Fri Nov 18 13:10:24 2005 @@ -38,9 +38,9 @@ Info info; -public UberspectTestException(String string, Info i) +public UberspectTestException(String message, Info i) { -super(string); +super(message); info = i; } @@ -49,5 +49,9 @@ return info; } +public String getMessage() +{ + return super.getMessage() + \n failed at + info; +} } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r345574 - in /jakarta/velocity/core/trunk/src/java/org/apache/velocity: app/event/implement/ context/ exception/ runtime/ runtime/directive/ runtime/log/ runtime/parser/
Author: wglass Date: Fri Nov 18 13:11:38 2005 New Revision: 345574 URL: http://svn.apache.org/viewcvs?rev=345574view=rev Log: fix imports Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/context/AbstractContext.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/SimpleLog4JLogSystem.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/JJTParserState.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java?rev=345574r1=345573r2=345574view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/PrintExceptions.java Fri Nov 18 13:11:38 2005 @@ -16,12 +16,10 @@ * limitations under the License. */ -import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; - -import org.apache.velocity.app.event.RuntimeServicesAware; import org.apache.velocity.app.event.MethodExceptionEventHandler; +import org.apache.velocity.app.event.RuntimeServicesAware; import org.apache.velocity.runtime.RuntimeServices; /** Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/context/AbstractContext.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/context/AbstractContext.java?rev=345574r1=345573r2=345574view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/context/AbstractContext.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/context/AbstractContext.java Fri Nov 18 13:11:38 2005 @@ -16,7 +16,6 @@ * limitations under the License. */ -import java.io.Serializable; /** * This class is the abstract base class for all conventional Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java?rev=345574r1=345573r2=345574view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java Fri Nov 18 13:11:38 2005 @@ -17,7 +17,6 @@ */ import org.apache.velocity.runtime.parser.ParseException; -import org.apache.velocity.runtime.parser.TemplateParseException; /** * Application-level exception thrown when a resource of any type Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java?rev=345574r1=345573r2=345574view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java Fri Nov 18 13:11:38 2005 @@ -16,16 +16,12 @@ * limitations under the License. */ -import java.util.Hashtable; - -import java.io.StringReader; import java.io.BufferedReader; - +import java.io.StringReader; +import java.util.Hashtable; +import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.runtime.directive.VelocimacroProxy; import org.apache.velocity.runtime.parser.node.SimpleNode; -import org.apache.velocity.util.StringUtils; - -import org.apache.velocity.context.InternalContextAdapter; /** * Manages VMs in namespaces. Currently, two namespace modes are Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java URL: http
svn commit: r345296 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
Author: wglass Date: Thu Nov 17 10:16:37 2005 New Revision: 345296 URL: http://svn.apache.org/viewcvs?rev=345296view=rev Log: Fixed NPE when subelement of reference is null. Thanks to Alexey Panchenko for the patch. Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java?rev=345296r1=345295r2=345296view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java Thu Nov 17 10:16:37 2005 @@ -172,6 +172,10 @@ for (int i = 0; i numChildren; i++) { result = getChild(i).execute(result,context); +if (result == null) +{ +break; +} } return result; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r345315 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
Author: wglass Date: Thu Nov 17 12:02:19 2005 New Revision: 345315 URL: http://svn.apache.org/viewcvs?rev=345315view=rev Log: Fixed problem with line comments in string literals. A extra character was being chopped off and/or StringIndexOutOfBoundsException. VELOCITY-126 Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java?rev=345315r1=345314r2=345315view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java Thu Nov 17 12:02:19 2005 @@ -16,15 +16,14 @@ * limitations under the License. */ -import org.apache.velocity.context.InternalContextAdapter; -import org.apache.velocity.runtime.parser.Parser; -import org.apache.velocity.runtime.parser.ParserVisitor; - -import java.io.StringWriter; import java.io.BufferedReader; import java.io.StringReader; +import java.io.StringWriter; +import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.runtime.RuntimeConstants; +import org.apache.velocity.runtime.parser.Parser; +import org.apache.velocity.runtime.parser.ParserVisitor; /** * ASTStringLiteral support. Will interpolate! @@ -41,6 +40,9 @@ private String image = ; private String interpolateimage = ; +/** true if the string contains a line comment (##) */ +private boolean containsLineComment; + public ASTStringLiteral(int id) { super(id); @@ -87,12 +89,37 @@ image = getFirstToken().image.substring(1, getFirstToken().image.length() - 1); +/** + * note. A kludge on a kludge. The first part, Geir calls + * this the dreaded MORE kludge. Basically, the use of the + * MORE token eats the last character of an interpolated + * string. EXCEPT when a line comment (##) is in + * the string this isn't an issue. + * + * So, to solve this we look for a line comment. If it isn't found + * we add a space here and remove it later. + */ + +/** + * Note - this should really use a regexp to look for [^\]## + * but apparently escaping of line comments isn't working right + * now anyway. + */ +containsLineComment = (image.indexOf(##) != -1); + /* - * tack a space on the end (dreaded MORE kludge) + * if appropriate, tack a space on the end (dreaded MORE kludge) */ -interpolateimage = image + ; - +if (!containsLineComment) +{ +interpolateimage = image + ; +} +else +{ +interpolateimage = image; +} + if (interpolate) { /* @@ -152,10 +179,17 @@ String ret = writer.toString(); /* - * remove the space from the end (dreaded MORE kludge) + * if appropriate, remove the space from the end + * (dreaded MORE kludge part deux) */ - -return ret.substring(0, ret.length() - 1); +if (!containsLineComment) +{ +return ret.substring(0, ret.length() - 1); +} +else +{ +return ret; +} } catch(Exception e) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332946 - in /jakarta/velocity/core/trunk: src/java/org/apache/velocity/runtime/ src/java/org/apache/velocity/runtime/defaults/ src/java/org/apache/velocity/runtime/parser/node/ src/test/o
Author: wglass Date: Sun Nov 13 00:10:26 2005 New Revision: 332946 URL: http://svn.apache.org/viewcvs?rev=332946view=rev Log: Allow #set to accept nulls as the right hand side argument. For backwards compatibility, this feature is turned off by default. Set the property directive.set.null.allowed to true to permit this. Thanks to the various contributors of issue VELOCITY-186, including Thomas Veith who provided the patch and numerous others who contributed thoughts and comments. Added: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/SetTestCase.java (with props) jakarta/velocity/core/trunk/test/set/ (with props) jakarta/velocity/core/trunk/test/set/compare/ jakarta/velocity/core/trunk/test/set/compare/set1.cmp jakarta/velocity/core/trunk/test/set/compare/set2.cmp jakarta/velocity/core/trunk/test/set/set1.vm jakarta/velocity/core/trunk/test/set/set2.vm Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java?rev=332946r1=332945r2=332946view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java Sun Nov 13 00:10:26 2005 @@ -123,6 +123,11 @@ public static final String MAX_NUMBER_LOOPS = directive.foreach.maxloops; /** + * if set to true then allows #set to accept null values in the right hand side. + */ +public static final String SET_NULL_ALLOWED = directive.set.null.allowed; + +/** * Starting tag for error messages triggered by passing * a parameter not allowed in the #include directive. Only * string literals, and references are allowed. Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties?rev=332946r1=332945r2=332946view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/defaults/velocity.properties Sun Nov 13 00:10:26 2005 @@ -48,6 +48,16 @@ directive.foreach.maxloops = -1 # +# S E T P R O P E R T I E S +# +# These properties control the behavior of #set. +# For compatibility, the default behavior is to disallow setting a reference +# to null. This default may be changed in a future version. +# + +directive.set.null.allowed = false + +# # I N C L U D E P R O P E R T I E S # # These are the properties that governed the way #include'd content Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java?rev=332946r1=332945r2=332946view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java Sun Nov 13 00:10:26 2005 @@ -88,51 +88,65 @@ throws IOException, MethodInvocationException { /* - * get the RHS node, and it's value + * get the RHS node, and its value */ Object value = right.value(context); /* - * it's an error if we don't have a value of some sort + * it's an error if we don't have a value of some sort AND + * it is not allowed by configuration */ -if ( value == null) +if( !rsvc.getBoolean(RuntimeConstants.SET_NULL_ALLOWED,false
svn commit: r332948 - in /jakarta/velocity/core/trunk/test/set: compare/set1.cmp compare/set2.cmp set1.vm set2.vm
Author: wglass Date: Sun Nov 13 00:17:51 2005 New Revision: 332948 URL: http://svn.apache.org/viewcvs?rev=332948view=rev Log: set eol-style property Modified: jakarta/velocity/core/trunk/test/set/compare/set1.cmp (contents, props changed) jakarta/velocity/core/trunk/test/set/compare/set2.cmp (contents, props changed) jakarta/velocity/core/trunk/test/set/set1.vm (contents, props changed) jakarta/velocity/core/trunk/test/set/set2.vm (contents, props changed) Modified: jakarta/velocity/core/trunk/test/set/compare/set1.cmp URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/set/compare/set1.cmp?rev=332948r1=332947r2=332948view=diff == --- jakarta/velocity/core/trunk/test/set/compare/set1.cmp (original) +++ jakarta/velocity/core/trunk/test/set/compare/set1.cmp Sun Nov 13 00:17:51 2005 @@ -1,4 +1,4 @@ -set1 - -123 +set1 + +123 123 Propchange: jakarta/velocity/core/trunk/test/set/compare/set1.cmp -- svn:eol-style = native Propchange: jakarta/velocity/core/trunk/test/set/compare/set1.cmp -- svn:keywords = Id Author Date Revision Modified: jakarta/velocity/core/trunk/test/set/compare/set2.cmp URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/set/compare/set2.cmp?rev=332948r1=332947r2=332948view=diff == --- jakarta/velocity/core/trunk/test/set/compare/set2.cmp (original) +++ jakarta/velocity/core/trunk/test/set/compare/set2.cmp Sun Nov 13 00:17:51 2005 @@ -1,4 +1,4 @@ -set2 - -123 +set2 + +123 $abc Propchange: jakarta/velocity/core/trunk/test/set/compare/set2.cmp -- svn:eol-style = native Propchange: jakarta/velocity/core/trunk/test/set/compare/set2.cmp -- svn:keywords = Id Author Date Revision Modified: jakarta/velocity/core/trunk/test/set/set1.vm URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/set/set1.vm?rev=332948r1=332947r2=332948view=diff == --- jakarta/velocity/core/trunk/test/set/set1.vm (original) +++ jakarta/velocity/core/trunk/test/set/set1.vm Sun Nov 13 00:17:51 2005 @@ -1,8 +1,8 @@ -## This template is used for the case in which #set with a null -## is not accepted -set1 - -#set($abc = 123) -$abc -#set($abc = $boohoo) +## This template is used for the case in which #set with a null +## is not accepted +set1 + +#set($abc = 123) +$abc +#set($abc = $boohoo) $abc Propchange: jakarta/velocity/core/trunk/test/set/set1.vm -- svn:eol-style = native Propchange: jakarta/velocity/core/trunk/test/set/set1.vm -- svn:keywords = Id Author Date Revision Modified: jakarta/velocity/core/trunk/test/set/set2.vm URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/set/set2.vm?rev=332948r1=332947r2=332948view=diff == --- jakarta/velocity/core/trunk/test/set/set2.vm (original) +++ jakarta/velocity/core/trunk/test/set/set2.vm Sun Nov 13 00:17:51 2005 @@ -1,8 +1,8 @@ -## This template is used for the case in which #set with a null -## is not accepted -set2 - -#set($abc = 123) -$abc -#set($abc = $boohoo) +## This template is used for the case in which #set with a null +## is not accepted +set2 + +#set($abc = 123) +$abc +#set($abc = $boohoo) $abc Propchange: jakarta/velocity/core/trunk/test/set/set2.vm -- svn:eol-style = native Propchange: jakarta/velocity/core/trunk/test/set/set2.vm -- svn:keywords = Id Author Date Revision - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r343986 - /jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml
Author: wglass Date: Sun Nov 13 14:25:18 2005 New Revision: 343986 URL: http://svn.apache.org/viewcvs?rev=343986view=rev Log: trivial doc fox removing period Modified: jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml Modified: jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml?rev=343986r1=343985r2=343986view=diff == --- jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml (original) +++ jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml Sun Nov 13 14:25:18 2005 @@ -1441,7 +1441,7 @@ coderuntime.log.logsystem/codebr/ This property has no default value. It is used to give Velocity an instantiated instance of a logging class that supports the interface -codeorg.apache.velocity.runtime.log.LogChute./code, which allows +codeorg.apache.velocity.runtime.log.LogChute/code, which allows the combination of Velocity log messages with your other application log messages. Please see the section a href=#Configuring LoggingConfiguring Logging/a - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332918 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/texen/ant/TexenTask.java
Author: wglass Date: Sat Nov 12 23:03:43 2005 New Revision: 332918 URL: http://svn.apache.org/viewcvs?rev=332918view=rev Log: added property to set the path for the logfile. VELOCITY-417. Thanks to sebastian for the patch. Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/texen/ant/TexenTask.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/texen/ant/TexenTask.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/texen/ant/TexenTask.java?rev=332918r1=332917r2=332918view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/texen/ant/TexenTask.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/texen/ant/TexenTask.java Sat Nov 12 23:03:43 2005 @@ -135,6 +135,11 @@ protected boolean useClasspath; /** + * The LogFile (incl. path) to log to. + */ +protected String logFile; + +/** * Property which controls whether the resource * loader will be told to cache. Default false */ @@ -255,6 +260,22 @@ } /** + * Sets the log file. + */ +public void setLogFile(String log) +{ +this.logFile = log; +} + +/** + * Gets the log file. + */ +public String getLogFile() +{ +return this.logFile; +} + +/** * Set the context properties that will be * fed into the initial context be the * generating process starts. @@ -427,6 +448,11 @@ .modificationCheckInterval, resourceLoaderModificationCheckInterval); } +if (this.logFile != null) +{ +ve.setProperty(RuntimeConstants.RUNTIME_LOG, this.logFile); +} + ve.init(); // Create the text generator. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332924 - /jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml
Author: wglass Date: Sat Nov 12 23:09:40 2005 New Revision: 332924 URL: http://svn.apache.org/viewcvs?rev=332924view=rev Log: Fixed docs for #include (removed commas). Thanks Diago for pointing this out in VELOCITY-416. Modified: jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml Modified: jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml?rev=332924r1=332923r2=332924view=diff == --- jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml (original) +++ jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml Sat Nov 12 23:09:40 2005 @@ -359,7 +359,7 @@ /p p -strong#/strong [ strong{/strong ] stronginclude/strong [ strong}/strong ] strong( /strongarg[, arg2, ... argn]strong )/strong +strong#/strong [ strong{/strong ] stronginclude/strong [ strong}/strong ] strong( /strongarg[ arg2 ... argn]strong )/strong /p ul @@ -371,8 +371,8 @@ /p ul - liString: #include( disclaimer.txt, opinion.txt )/li - liVariable: #include( $foo, $bar )/li + liString: #include( disclaimer.txt opinion.txt )/li + liVariable: #include( $foo $bar )/li /ul /subsection - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332399 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java
Author: wglass Date: Thu Nov 10 15:59:03 2005 New Revision: 332399 URL: http://svn.apache.org/viewcvs?rev=332399view=rev Log: since ExtendedProperties.load doesn't close the stream, close it on the Velocity side. VELOCITY-418 Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=332399r1=332398r2=332399view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Thu Nov 10 15:59:03 2005 @@ -254,7 +254,7 @@ { return initialized; } - + /** * Gets the classname for the Uberspect introspection package and * instantiates an instance. @@ -323,19 +323,36 @@ */ private void setDefaultProperties() { +InputStream inputStream = null; try { -InputStream inputStream = getClass() +inputStream = getClass() .getResourceAsStream('/' + DEFAULT_RUNTIME_PROPERTIES); configuration.load( inputStream ); info (Default Properties File: + new File(DEFAULT_RUNTIME_PROPERTIES).getPath()); + + } catch (IOException ioe) { -System.err.println(Cannot get Velocity Runtime default properties!); +log.error(Cannot get Velocity Runtime default properties!); +} +finally +{ +try +{ +if (inputStream != null) +{ +inputStream.close(); +} +} +catch (IOException ioe) +{ +log.error(Cannot close Velocity Runtime default properties! + ioe); +} } } @@ -686,19 +703,43 @@ * that we should initialize. */ -InputStream inputStream = -getClass().getResourceAsStream('/' + DEFAULT_RUNTIME_DIRECTIVES); +InputStream inputStream = null; + +try +{ +inputStream = getClass().getResourceAsStream('/' + DEFAULT_RUNTIME_DIRECTIVES); + +if (inputStream == null) +{ +throw new Exception(Error loading directive.properties! + +Something is very wrong if these properties + +aren't being located. Either your Velocity + +distribution is incomplete or your Velocity + +jar file is corrupted!); +} + +directiveProperties.load(inputStream); -if (inputStream == null) +} +catch (IOException ioe) { -throw new Exception(Error loading directive.properties! + -Something is very wrong if these properties + -aren't being located. Either your Velocity + -distribution is incomplete or your Velocity + -jar file is corrupted!); +log.error(Error while loading directive properties!,ioe); +} +finally +{ +try +{ +if (inputStream != null) +{ +inputStream.close(); +} +} +catch (IOException ioe) +{ +log.error(Cannot close directive properties!, ioe); +} } -directiveProperties.load(inputStream); /* * Grab all the values of the properties. These - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r328649 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java
Author: wglass Date: Wed Oct 26 07:05:42 2005 New Revision: 328649 URL: http://svn.apache.org/viewcvs?rev=328649view=rev Log: avoid conflict with 1.5 vs 1.4 constructor Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java?rev=328649r1=328648r2=328649view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/MathUtils.java Wed Oct 26 07:05:42 2005 @@ -50,8 +50,7 @@ /** * A BigDecimal representing the number 0 */ -protected static final BigDecimal DECIMAL_ZERO= new BigDecimal ( 0 ); -protected static final BigInteger INT_ZERO= BigInteger.valueOf( 0 ); +protected static final BigDecimal DECIMAL_ZERO= new BigDecimal ( BigInteger.ZERO ); /** * The constants are used to determine in which context we have to calculate. @@ -92,15 +91,15 @@ /** * Convert the given Number to a BigDecimal */ -public static BigDecimal toBigDecimal (Number n) +public static BigDecimal toBigDecimal (Number n) { -if (n instanceof BigDecimal) +if (n instanceof BigDecimal) { return (BigDecimal)n; } -if (n instanceof BigInteger) +if (n instanceof BigInteger) { return new BigDecimal ( (BigInteger)n ); } @@ -112,10 +111,10 @@ /** * Convert the given Number to a BigInteger */ -public static BigInteger toBigInteger (Number n) +public static BigInteger toBigInteger (Number n) { -if (n instanceof BigInteger) +if (n instanceof BigInteger) { return (BigInteger)n; } @@ -127,21 +126,21 @@ /** * Compare the given Number to 0. */ -public static boolean isZero (Number n) +public static boolean isZero (Number n) { -if (isInteger( n ) ) +if (isInteger( n ) ) { -if (n instanceof BigInteger) +if (n instanceof BigInteger) { -return ((BigInteger)n).compareTo (INT_ZERO) == 0; +return ((BigInteger)n).compareTo (BigInteger.ZERO) == 0; } return n.doubleValue() == 0; } -if (n instanceof Float) +if (n instanceof Float) { return n.floatValue() == 0f; } -if (n instanceof Double) +if (n instanceof Double) { return n.doubleValue() == 0d; } @@ -152,7 +151,7 @@ * Test, whether the given object is an integer value * (Byte, Short, Integer, Long, BigInteger) */ -public static boolean isInteger (Number n) +public static boolean isInteger (Number n) { return ints.containsKey (n.getClass()); } @@ -161,42 +160,42 @@ * Wrap the given primitive into the given class if the value is in the * range of the destination type. If not the next bigger type will be chosen. */ -public static Number wrapPrimitive (long value, Class type) +public static Number wrapPrimitive (long value, Class type) { -if (type == Byte.class) +if (type == Byte.class) { -if (value Byte.MAX_VALUE || value Byte.MIN_VALUE) +if (value Byte.MAX_VALUE || value Byte.MIN_VALUE) { type = Short.class; -} -else +} +else { return new Byte ((byte)value); } } -if (type == Short.class) +if (type == Short.class) { -if (value Short.MAX_VALUE || value Short.MIN_VALUE) +if (value Short.MAX_VALUE || value Short.MIN_VALUE) { type = Integer.class; -} -else +} +else { return new Short((short)value); } } -if (type == Integer.class) +if (type == Integer.class) { -if (value Integer.MAX_VALUE || value Integer.MIN_VALUE) +if (value Integer.MAX_VALUE || value Integer.MIN_VALUE) { type = Long.class; -} -else +} +else { return new Integer ((int)value); } } -if (type == Long.class) +if (type == Long.class) { return new Long (value); } @@ -206,9
svn commit: r326373 - in /jakarta/velocity/core/trunk/src/java/org/apache/velocity: app/VelocityEngine.java runtime/RuntimeServices.java
Author: wglass Date: Tue Oct 18 21:15:55 2005 New Revision: 326373 URL: http://svn.apache.org/viewcvs?rev=326373view=rev Log: Added get method to parallel setAttribute method. VELOCITY-412. Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeServices.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java?rev=326373r1=326372r2=326373view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java Tue Oct 18 21:15:55 2005 @@ -629,6 +629,32 @@ { ri.setApplicationAttribute(key, value); } + + /** + * p + * Return an ApplicationAttribue, which is an Object + * set by the application which is accessable from + * any component of the system that gets a RuntimeServices. + * This allows communication between the application + * environment and custom pluggable components of the + * Velocity engine, such as loaders and loggers. + * /p + * + * p + * Note that there is no enfocement or rules for the key + * used - it is up to the application developer. However, to + * help make the intermixing of components possible, using + * the target Class name (e.g. com.foo.bar ) as the key + * might help avoid collision. + * /p + * + * @param key object 'name' under which the object is stored + * return value object to store under this key + */ + public Object getApplicationAttribute( Object key ) + { +return ri.getApplicationAttribute(key); + } } Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeServices.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeServices.java?rev=326373r1=326372r2=326373view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeServices.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeServices.java Tue Oct 18 21:15:55 2005 @@ -332,6 +332,15 @@ public Object getApplicationAttribute( Object key ); /** + * Set the specified application attribute. + * + * @param key The name of the attribute to set. + * @param value The attribute value to set. + * @return the displaced attribute value + */ +public Object setApplicationAttribute( Object key, Object value ); + +/** * Returns the configured class introspection/reflection * implemenation. */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r321296 - in /jakarta/velocity/core/trunk: src/java/org/apache/velocity/ src/java/org/apache/velocity/app/ src/java/org/apache/velocity/exception/ src/java/org/apache/velocity/runtime/pars
Author: wglass Date: Fri Oct 14 23:17:50 2005 New Revision: 321296 URL: http://svn.apache.org/viewcvs?rev=321296view=rev Log: ParseErrorException now reports template name. Thanks Malcolm Edgar! VELOCITY-373. Added: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ParseExceptionTestCase.java (with props) jakarta/velocity/core/trunk/test/parseexception/ jakarta/velocity/core/trunk/test/parseexception/badtemplate.vm Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParseException.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java (props changed) Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java?rev=321296r1=321295r2=321296view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/Template.java Fri Oct 14 23:17:50 2005 @@ -132,9 +132,8 @@ /* * remember the error and convert */ - - errorCondition = new ParseErrorException( pex.getMessage() ); - throw errorCondition; +errorCondition = new ParseErrorException( pex ); +throw errorCondition; } catch( Exception e ) { Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java?rev=321296r1=321295r2=321296view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java Fri Oct 14 23:17:50 2005 @@ -258,7 +258,7 @@ } catch ( ParseException pex ) { -throw new ParseErrorException( pex.getMessage() ); +throw new ParseErrorException( pex ); } /* Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java?rev=321296r1=321295r2=321296view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java Fri Oct 14 23:17:50 2005 @@ -292,7 +292,7 @@ } catch (ParseException pex) { -throw new ParseErrorException( pex.getMessage() ); +throw new ParseErrorException( pex ); } /* Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java?rev=321296r1=321295r2=321296view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/exception/ParseErrorException.java Fri Oct 14 23:17:50 2005 @@ -16,6 +16,8 @@ * limitations under the License. */ +import org.apache.velocity.runtime.parser.ParseException; + /** * Application-level exception thrown when a resource of any type * has a syntax or other error which prevents it from being parsed. @@ -34,8 +36,74 @@ */ private static final long serialVersionUID = -6665197935086306474L; -public ParseErrorException(String exceptionMessage ) +/** + * The column number of the parsing error, or -1 if not defined. + */ +private int columnNumber = -1; + +/** + * The line number of the parsing error, or -1 if not defined. + */ +private int lineNumber; + +/** + * The name of the template containing the error, or null
svn commit: r321297 - in /jakarta/velocity/core/trunk/src/java/org/apache/velocity: app/Velocity.java app/VelocityEngine.java runtime/RuntimeInstance.java runtime/RuntimeServices.java runtime/RuntimeS
Author: wglass Date: Fri Oct 14 23:32:31 2005 New Revision: 321297 URL: http://svn.apache.org/viewcvs?rev=321297view=rev Log: Throw more user-friendly exception when init() has not been called (as opposed to arbitrary NPE's from deep in the code) Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeServices.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeSingleton.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java?rev=321297r1=321296r2=321297view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/Velocity.java Fri Oct 14 23:32:31 2005 @@ -207,6 +207,14 @@ throws ParseErrorException, MethodInvocationException, ResourceNotFoundException, IOException { +/** + * Check to see the engine was initialized. + */ +if (!RuntimeSingleton.isInitialized()) +{ +throw new IllegalStateException (Cannot evaluate string as Velocity has not been initialized.); +} + /* * first, parse - convert ParseException if thrown */ Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java?rev=321297r1=321296r2=321297view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/VelocityEngine.java Fri Oct 14 23:32:31 2005 @@ -241,6 +241,14 @@ throws ParseErrorException, MethodInvocationException, ResourceNotFoundException, IOException { +/** + * Check to see the engine was initialized. + */ +if (!ri.isInitialized()) +{ +throw new IllegalStateException (Cannot evaluate string as Velocity has not been initialized.); +} + /* * first, parse - convert ParseException if thrown */ @@ -284,6 +292,15 @@ throws ParseErrorException, MethodInvocationException, ResourceNotFoundException,IOException { + +/** + * Check to see the engine was initialized. + */ +if (!ri.isInitialized()) +{ +throw new IllegalStateException (Cannot evaluate string as Velocity has not been initialized.); +} + SimpleNode nodeTree = null; try @@ -448,6 +465,14 @@ Context context, Writer writer ) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception { +/** + * Check to see the engine was initialized. + */ +if (!ri.isInitialized()) +{ +throw new IllegalStateException (Cannot merge template as Velocity has not been initialized.); +} + Template template = ri.getTemplate(templateName, encoding); if ( template == null ) @@ -478,6 +503,14 @@ public Template getTemplate(String name) throws ResourceNotFoundException, ParseErrorException, Exception { +/** + * Check to see the engine was initialized. + */ +if (!ri.isInitialized()) +{ +throw new IllegalStateException (Cannot get template as Velocity has not been initialized.); +} + return ri.getTemplate( name ); } Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=321297r1=321296r2=321297view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Fri Oct 14 23:32:31 2005 @@ -246,7 +246,15 @@ } } - +/** + * Returns true if the RuntimeInstance has been successfully initialized. + * @return + */ +public boolean isInitialized() +{ +return initialized
svn commit: r321298 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java
Author: wglass Date: Fri Oct 14 23:37:28 2005 New Revision: 321298 URL: http://svn.apache.org/viewcvs?rev=321298view=rev Log: Protect against NPE. Issue reported and fix provided by Konstantin Pribluda. VELOCITY-411. Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java?rev=321298r1=321297r2=321298view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/app/event/implement/EscapeReference.java Fri Oct 14 23:37:28 2005 @@ -83,14 +83,25 @@ */ public Object referenceInsert(String reference, Object value) { +if(value == null) +{ +return value; +} + if (matchRegExp == null) +{ return escape(value); - +} + else if (perl.match(matchRegExp,reference)) +{ return escape(value); +} else +{ return value; +} } /** @@ -105,7 +116,9 @@ */ matchRegExp = rs.getConfiguration().getString(getMatchAttribute()); if ((matchRegExp != null) (matchRegExp.trim().length() == 0)) +{ matchRegExp = null; +} /** * Test the regular expression for a well formed pattern - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r321293 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
Author: wglass Date: Fri Oct 14 22:14:12 2005 New Revision: 321293 URL: http://svn.apache.org/viewcvs?rev=321293view=rev Log: No need to check the context if the datasource is passed in. Thanks to Vladimir Terzic for the further patch. VELOCITY-267 Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java?rev=321293r1=321292r2=321293view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java Fri Oct 14 22:14:12 2005 @@ -16,22 +16,20 @@ * limitations under the License. */ -import java.io.InputStream; import java.io.BufferedInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; -import javax.sql.DataSource; import javax.naming.InitialContext; import javax.naming.NamingException; - -import org.apache.velocity.runtime.log.Log; -import org.apache.velocity.runtime.resource.Resource; -import org.apache.velocity.exception.ResourceNotFoundException; +import javax.sql.DataSource; import org.apache.commons.collections.ExtendedProperties; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; -import java.sql.SQLException; +import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.runtime.resource.Resource; /** * PThis is a simple template file loader that loads templates @@ -320,27 +318,32 @@ } /** - * gets connection to the datasource specified through the configuration + * Gets connection to the datasource specified through the configuration * parameters. * * @return connection */ - private Connection openDbConnection() + private Connection openDbConnection() throws NamingException, SQLException -{ - if (ctx == null) + { + if (dataSource != null) + { +return dataSource.getConnection(); + } + + if (ctx == null) { - ctx = new InitialContext(); +ctx = new InitialContext(); } - if (dataSource == null) + if (dataSource == null) { - dataSource = (DataSource)ctx.lookup(dataSourceName); +dataSource = (DataSource) ctx.lookup(dataSourceName); } return dataSource.getConnection(); } - + /** * Closes connection to the datasource */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r312815 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
Author: wglass Date: Mon Oct 10 23:12:47 2005 New Revision: 312815 URL: http://svn.apache.org/viewcvs?rev=312815view=rev Log: fix error on Linux of failing AbsoluteFileResourceLoader (missing first slash) Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java?rev=312815r1=312814r2=312815view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java Mon Oct 10 23:12:47 2005 @@ -115,14 +115,6 @@ throw new ResourceNotFoundException ( msg ); } -/* - * if a / leads off, then just nip that :) - */ -if (template.startsWith(/)) -{ -template = template.substring(1); -} - int size = paths.size(); for (int i = 0; i size; i++) { @@ -274,6 +266,14 @@ } else { +/* + * if a / leads off, then just nip that :) + */ +if (template.startsWith(/)) +{ +template = template.substring(1); +} + file = new File ( path, template ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r306539 - /jakarta/velocity/core/trunk/build/build.xml
Author: wglass Date: Wed Oct 5 23:12:34 2005 New Revision: 306539 URL: http://svn.apache.org/viewcvs?rev=306539view=rev Log: Fix jar-dep to include all required collection classes. Modified: jakarta/velocity/core/trunk/build/build.xml Modified: jakarta/velocity/core/trunk/build/build.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/build/build.xml?rev=306539r1=306538r2=306539view=diff == --- jakarta/velocity/core/trunk/build/build.xml (original) +++ jakarta/velocity/core/trunk/build/build.xml Wed Oct 5 23:12:34 2005 @@ -331,14 +331,24 @@ delete fileset dir=${build.dest} include name=org/apache/commons/collections/**/*.class / - exclude name=org/apache/commons/collections/map/LRUMap.class / - exclude name=org/apache/commons/collections/map/AbstractHashedMap.class / - exclude name=org/apache/commons/collections/map/AbstractLinkedMap.class / - exclude name=org/apache/commons/collections/IterableMap.class / exclude name=org/apache/commons/collections/BoundedMap.class / - exclude name=org/apache/commons/collections/OrderedMap.class / exclude name=org/apache/commons/collections/ExtendedProperties*.class / - /fileset + exclude name=org/apache/commons/collections/IterableMap.class / + exclude name=org/apache/commons/collections/iterators/AbstractEmptyIterator.class / + exclude name=org/apache/commons/collections/iterators/EmptyIterator.class / + exclude name=org/apache/commons/collections/iterators/EmptyMapIterator.class / + exclude name=org/apache/commons/collections/iterators/EmptyOrderedIterator.class / + exclude name=org/apache/commons/collections/iterators/EmptyOrderedMapIterator.class / + exclude name=org/apache/commons/collections/KeyValue.class / + exclude name=org/apache/commons/collections/map/AbstractHashedMap*.class / + exclude name=org/apache/commons/collections/map/AbstractLinkedMap*.class / + exclude name=org/apache/commons/collections/map/LRUMap.class / + exclude name=org/apache/commons/collections/MapIterator.class / + exclude name=org/apache/commons/collections/OrderedMap.class / + exclude name=org/apache/commons/collections/OrderedMapIterator.class / + exclude name=org/apache/commons/collections/OrderedIterator.class / + exclude name=org/apache/commons/collections/ResettableIterator.class / + /fileset /delete /target - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r306522 - in /jakarta/velocity/core/trunk: src/java/org/apache/velocity/runtime/parser/ test/templates/ test/templates/compare/
Author: wglass Date: Wed Oct 5 21:25:59 2005 New Revision: 306522 URL: http://svn.apache.org/viewcvs?rev=306522view=rev Log: fixed bug with parse error when comment was last line of file. VELOCITY-272 Added: jakarta/velocity/core/trunk/test/templates/comment-eof.vm jakarta/velocity/core/trunk/test/templates/compare/comment-eof.cmp Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserConstants.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java jakarta/velocity/core/trunk/test/templates/templates.properties Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java?rev=306522r1=306521r2=306522view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java Wed Oct 5 21:25:59 2005 @@ -109,12 +109,12 @@ * thrown by the Macro class when something is amiss in the * Macro specification */ -rsvc.getLog().error(Parser Error: #macro() : + templateName, mee); +rsvc.error (Parser Error: #macro() : + templateName + : + StringUtils.stackTrace(mee)); throw new ParseException(mee.getMessage()); } catch (ParseException pe) { -rsvc.getLog().error(Parser Exception: + templateName, pe); +rsvc.error (Parser Exception: + templateName + : + StringUtils.stackTrace(pe)); throw new ParseException (pe.currentToken, pe.expectedTokenSequences, pe.tokenImage); } @@ -124,7 +124,7 @@ } catch (Exception e) { -rsvc.getLog().error(Parser Error: + templateName, e); +rsvc.error (Parser Error: + templateName + : + StringUtils.stackTrace(e)); } currentTemplateName = ; @@ -231,10 +231,10 @@ case RPAREN: case ESCAPE_DIRECTIVE: case SET_DIRECTIVE: +case SINGLE_LINE_COMMENT_START: case DOUBLE_ESCAPE: case ESCAPE: case TEXT: -case SINGLE_LINE_COMMENT: case FORMAL_COMMENT: case MULTI_LINE_COMMENT: case STRING_LITERAL: @@ -300,7 +300,7 @@ Reference(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { -case SINGLE_LINE_COMMENT: +case SINGLE_LINE_COMMENT_START: case FORMAL_COMMENT: case MULTI_LINE_COMMENT: Comment(); @@ -435,8 +435,16 @@ jjtree.openNodeScope(jjtn000); try { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLE_LINE_COMMENT: -jj_consume_token(SINGLE_LINE_COMMENT); + case SINGLE_LINE_COMMENT_START: +jj_consume_token(SINGLE_LINE_COMMENT_START); +switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { +case SINGLE_LINE_COMMENT: + jj_consume_token(SINGLE_LINE_COMMENT); + break; +default: + jj_la1[3] = jj_gen; + ; +} break; case MULTI_LINE_COMMENT: jj_consume_token(MULTI_LINE_COMMENT); @@ -445,14 +453,14 @@ jj_consume_token(FORMAL_COMMENT); break; default: -jj_la1[3] = jj_gen; +jj_la1[4] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } finally { - if (jjtc000) { -jjtree.closeNodeScope(jjtn000, true); - } + if (jjtc000) { +jjtree.closeNodeScope(jjtn000, true); + } } } @@ -563,7 +571,7 @@ {if (true) return ParserTreeConstants.JJTINTEGERLITERAL;} break; default: - jj_la1[4] = jj_gen; + jj_la1[5] = jj_gen; if (jj_2_3(2147483647)) { IntegerRange(); {if (true) return ParserTreeConstants.JJTINTEGERRANGE;} @@ -590,7 +598,7 @@ {if (true) return ParserTreeConstants.JJTFALSE;} break; default: - jj_la1[5] = jj_gen; + jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -623,7 +631,7 @@ t = jj_consume_token(BRACKETED_WORD); break; default: -jj_la1[6] = jj_gen; +jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -697,7 +705,7 @@ jj_consume_token(WHITESPACE); break; default
svn commit: r306528 - in /jakarta/velocity/core/trunk: src/java/org/apache/velocity/runtime/resource/loader/ src/test/org/apache/velocity/test/ test/absolute/ test/absolute/compare/
Author: wglass Date: Wed Oct 5 22:14:48 2005 New Revision: 306528 URL: http://svn.apache.org/viewcvs?rev=306528view=rev Log: treat the template name as an absolute path when the template path is empty. See VELOCITY-144 for a discussion about this patch. Added: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java jakarta/velocity/core/trunk/test/absolute/ jakarta/velocity/core/trunk/test/absolute/absolute.vm jakarta/velocity/core/trunk/test/absolute/compare/ jakarta/velocity/core/trunk/test/absolute/compare/absolute.cmp Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java?rev=306528r1=306527r2=306528view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java Wed Oct 5 22:14:48 2005 @@ -35,8 +35,11 @@ import org.apache.commons.collections.ExtendedProperties; /** - * A loader for templates stored on the file system. + * A loader for templates stored on the file system. Treats the template + * as relative to the configured root path. If the root path is empty + * treats the template name as an absolute path. * + * @author a href=mailto:[EMAIL PROTECTED]Will Glass-Husain/a * @author a href=mailto:[EMAIL PROTECTED]Aki Nieminen/a * @author a href=mailto:[EMAIL PROTECTED]Jason van Zyl/a * @version $Id$ @@ -161,7 +164,7 @@ { try { -File file = new File( path, template ); +File file = getFile(path,template); if ( file.canRead() ) { @@ -206,13 +209,13 @@ for (int i = 0; currentFile == null i paths.size(); i++) { String testPath = (String) paths.get(i); -File testFile = new File(testPath, fileName); +File testFile = getFile(testPath, fileName); if (testFile.canRead()) { currentFile = testFile; } } -File file = new File(path, fileName); +File file = getFile(path, fileName); if (currentFile == null || !file.exists()) { /* @@ -244,7 +247,7 @@ public long getLastModified(Resource resource) { String path = (String) templatePaths.get(resource.getName()); -File file = new File(path, resource.getName()); +File file = getFile(path, resource.getName()); if (file.canRead()) { @@ -254,5 +257,26 @@ { return 0; } +} + + +/** + * Create a File based on either a relative path if given, or absolute path otherwise + */ +private File getFile(String path, String template) +{ + +File file = null; + +if(.equals(path)) +{ +file = new File( template ); +} +else +{ +file = new File ( path, template ); +} + +return file; } } Added: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java?rev=306528view=auto == --- jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java (added) +++ jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java Wed Oct 5 22:14:48 2005 @@ -0,0 +1,143 @@ +package org.apache.velocity.test; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License) + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.BufferedWriter; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; + +import junit.framework.Test; + +import org.apache.velocity.Template; +import
svn commit: r306530 - /jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java
Author: wglass Date: Wed Oct 5 22:26:13 2005 New Revision: 306530 URL: http://svn.apache.org/viewcvs?rev=306530view=rev Log: minor change to make sure keywords are applied Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java?rev=306530r1=306529r2=306530view=diff == --- jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java (original) +++ jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java Wed Oct 5 22:26:13 2005 @@ -122,7 +122,6 @@ /* * put the Vector into the context, and merge both */ - VelocityContext context = new VelocityContext(); template1.merge(context, writer1); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r306531 - /jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java
Author: wglass Date: Wed Oct 5 22:27:03 2005 New Revision: 306531 URL: http://svn.apache.org/viewcvs?rev=306531view=rev Log: set keywords Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java (contents, props changed) Modified: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java?rev=306531r1=306530r2=306531view=diff == --- jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java (original) +++ jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java Wed Oct 5 22:27:03 2005 @@ -32,7 +32,7 @@ * Test use of an absolute path with the FileResourceLoader * * @author a href=mailto:[EMAIL PROTECTED]Will Glass-Husain/a - * @version $Id: MultipleFileResourcePathTest.java,v 1.8 2001/10/22 03:53:26 jon Exp $ + * @version $Id$ */ public class AbsoluteFileResourceLoaderTestCase extends BaseTestCase { @@ -121,7 +121,7 @@ /* * put the Vector into the context, and merge both - */ + */ VelocityContext context = new VelocityContext(); template1.merge(context, writer1); Propchange: jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java -- svn:keywords = Id Author Date Revision - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r293265 - in /jakarta/velocity/core/trunk/xdocs/docs: user-guide.xml vtl-reference-guide.xml
Author: wglass Date: Sun Oct 2 23:36:28 2005 New Revision: 293265 URL: http://svn.apache.org/viewcvs?rev=293265view=rev Log: updated docs for == operator describing toString() equality. VELOCITY-350. Modified: jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml Modified: jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml?rev=293265r1=293264r2=293265view=diff == --- jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml (original) +++ jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml Sun Oct 2 23:36:28 2005 @@ -1162,7 +1162,9 @@ pNote that the semantics of em==/em are slightly different than Java where em==/em can only be used to test object equality. In Velocity the equivalent operator -can be used to directly compare numbers, strings, or objects. +can be used to directly compare numbers, strings, or objects. When the objects + are of different classes, the string representations are obtained by calling + codetoString()/code for each object and then compared. /p p Modified: jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml?rev=293265r1=293264r2=293265view=diff == --- jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml (original) +++ jakarta/velocity/core/trunk/xdocs/docs/vtl-reference-guide.xml Sun Oct 2 23:36:28 2005 @@ -248,14 +248,23 @@ /tr /table - PNote: You can also use brackets to delimit directives. This is especially - useful when text immediately follows an code#else/code directive. - /P - + pNotes:/p + ol + li + The == operator can be used to compare numbers, strings, objects of the same class, or objects + of different classes. In the last case (when objects are of different classes), the toString() + method is called on each object and the resulting Strings are compared. + /li + li +You can also use brackets to delimit directives. This is especially +useful when text immediately follows an code#else/code directive. + /li + /ol + source![CDATA[ #if( $foo == $bar)it's true!#{else}it's not!#end/li ]]/source - + /subsection - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r293051 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeLogger.java
Author: wglass Date: Sat Oct 1 18:30:30 2005 New Revision: 293051 URL: http://svn.apache.org/viewcvs?rev=293051view=rev Log: bizarrely, I missed this in the VELOCITY-403 patch. I suspect all the delete/add combinations caused patch to miss the changes. Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeLogger.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeLogger.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeLogger.java?rev=293051r1=293050r2=293051view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeLogger.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeLogger.java Sat Oct 1 18:30:30 2005 @@ -17,38 +17,32 @@ */ /** - * Interface for internal runtime logging services that are needed by the + * Interface for internal runtime logging services. This will hopefully + * be dissolved into the Log class at some point soon. * * @author a href=mailto:[EMAIL PROTECTED]Geir Magusson Jr./a * @version $Id$ + * @deprecated This functionality has been taken over by the Log class */ public interface RuntimeLogger { /** - * Log a warning message. - * - * @param Object message to log + * @deprecated Use Log.warn(Object) */ public void warn(Object message); /** - * Log an info message. - * - * @param Object message to log + * @deprecated Use Log.warn(Object) */ public void info(Object message); /** - * Log an error message. - * - * @param Object message to log + * @deprecated Use Log.warn(Object) */ public void error(Object message); /** - * Log a debug message. - * - * @param Object message to log + * @deprecated Use Log.warn(Object) */ public void debug(Object message); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r293052 - /jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml
Author: wglass Date: Sat Oct 1 18:33:55 2005 New Revision: 293052 URL: http://svn.apache.org/viewcvs?rev=293052view=rev Log: doc patch from Nathan for new LogChute interface Modified: jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml Modified: jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml?rev=293052r1=293051r2=293052view=diff == --- jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml (original) +++ jakarta/velocity/core/trunk/xdocs/docs/developer-guide.xml Sat Oct 1 18:33:55 2005 @@ -70,7 +70,7 @@ /li li -a href=#ConfiguringtheLogSystemConfiguring the Log System/a +a href=#Configuring LoggingConfiguring Logging/a ul li a href=#UsingLog4jWithExistingCategoryUsing Log4j With Existing Category/a @@ -1440,16 +1440,16 @@ coderuntime.log.logsystem/codebr/ This property has no default value. It is used to give Velocity an instantiated instance of a logging class that supports the interface -codeorg.apache.velocity.runtime.log.LogSystem./code, which allows +codeorg.apache.velocity.runtime.log.LogChute./code, which allows the combination of Velocity log messages with your other application log messages. Please see the section -a href=#ConfiguringtheLogSystemConfiguring the Log System/a +a href=#Configuring LoggingConfiguring Logging/a for more information. /p p coderuntime.log.logsystem.class = -org.apache.velocity.runtime.log.AvalonLogSystem/codebr/ +org.apache.velocity.runtime.log.AvalonLogChute/codebr/ Class to be used for the Velocity-instantiated log system. /p @@ -1473,10 +1473,10 @@ coderuntime.log.logsystem.avalon.logger = iname/i /codebr/ Allows user to specify an existing logger iname/i in the Avalon hierarchy -without having to wrap with a LogSystem interface. bNote:/b +without having to wrap with a LogChute interface. bNote:/b You must also specify coderuntime.log.logsystem.class = -org.apache.velocity.runtime.log.AvalonLogSystem/code as the default +org.apache.velocity.runtime.log.AvalonLogChute/code as the default logsystem may change. There is bno/b guarantee that the Avalon log system will remain the default log system. /p @@ -1746,7 +1746,7 @@ /section -section name=Configuring the Log System href=ConfiguringtheLogSystem +section name=Configuring Logging href=Configuring Logging p Velocity has a few nice logging features to allow both simplicity and @@ -1790,7 +1790,7 @@ bExisting Log4j Logger/Category/bbr/ Starting with version 1.3, Velocity will log it's output to an existing Log4j Category setup elsewhere in the application. With version 1.5, we have -switched to using the Logger class, as the Categeory class is now deprecated +switched to using the Logger class, as the Category class is now deprecated in Log4j. To use this feature you must ol li @@ -1798,30 +1798,31 @@ anyway since you are using Log4j in the application using Velocity.) /li li -a) If your system still uses the deprecated Category, -configure Velocity to use the codeSimpleLog4JLogSystem/code class. -b) If your environment uses the Logger class, -cconfigure Velocity to use the codeLog4JLogSystem/code class. +a) If your environment uses the Logger class, +configure Velocity to use the codeLog4JLogChute/code class. +b) If your system still uses the deprecated Category, you can +configure Velocity to use the very deprecated +codeSimpleLog4JLogSystem/code class. /li li -a) If using a Category, specify the name of the existing Category to use via the -'runtime.log.logsystem.log4j.category' property. -b) If using a Logger, specify the name of the existing Logger to use via the +a) If using a Logger, specify the name of the existing Logger to use via the 'runtime.log.logsystem.log4j.logger' property. +b) If using a Category, specify the name of the existing Category to use via the +'runtime.log.logsystem.log4j.category' property. /li /ol Note that this support for Logger is in version 1.5 of Velocity. Further, -in version 1.5 we removed the now-ancient and very deprecated origianl -Log4JLogSystem class and replaced with the current Log4JLogSystem class which +in version 1.5 we removed the now-ancient and very deprecated original +Log4JLogSystem class and replaced with the current Log4JLogChute class which uses the Logger class. We apologize for the confusion, but we needed to move on. /li li bCustom Standalone Logger/bbr/ -You can create a custom logging class - you simply must implement the -interface codeorg.apache.velocity.runtime.log.LogSystem/code and +You can create a custom logging class - you just need to implement the +interface codeorg.apache.velocity.runtime.log.LogChute/code and then simply set the configuration property
svn commit: r293053 - /jakarta/velocity/core/trunk/examples/logger_example/LoggerExample.java
Author: wglass Date: Sat Oct 1 18:34:20 2005 New Revision: 293053 URL: http://svn.apache.org/viewcvs?rev=293053view=rev Log: change LoggerExample to use LogChute Modified: jakarta/velocity/core/trunk/examples/logger_example/LoggerExample.java Modified: jakarta/velocity/core/trunk/examples/logger_example/LoggerExample.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/examples/logger_example/LoggerExample.java?rev=293053r1=293052r2=293053view=diff == --- jakarta/velocity/core/trunk/examples/logger_example/LoggerExample.java (original) +++ jakarta/velocity/core/trunk/examples/logger_example/LoggerExample.java Sat Oct 1 18:34:20 2005 @@ -15,7 +15,7 @@ */ import org.apache.velocity.app.Velocity; -import org.apache.velocity.runtime.log.LogSystem; +import org.apache.velocity.runtime.log.LogChute; import org.apache.velocity.runtime.RuntimeServices; @@ -30,7 +30,7 @@ * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a * @version $Id$ */ -public class LoggerExample implements LogSystem +public class LoggerExample implements LogChute { public LoggerExample() { @@ -66,12 +66,31 @@ } /** - * This is the key method needed to implement a logging interface - * for Velocity. + * This just prints the message and level to System.out. */ -public void logVelocityMessage(int level, String message) +public void log(int level, String message) { System.out.println(level : + level + msg : + message); +} + + +/** + * This prints the level, message, and the Throwable's message to + * System.out. + */ +public void log(int level, String message, Throwable t) +{ +System.out.println(level : + level + msg : + message + t : + + t.getMessage()); +} + +/** + * This always returns true because logging levels can't be disabled in + * this impl. + */ +public void isLevelEnabled(int level) +{ +return true; } public static void main(String[] args) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r293068 - in /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log: Log4JLogChute.java SimpleLog4JLogSystem.java
Author: wglass Date: Sat Oct 1 21:11:55 2005 New Revision: 293068 URL: http://svn.apache.org/viewcvs?rev=293068view=rev Log: Properly close the appender. Addresses Velocity-193 and Velocity-78. Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/SimpleLog4JLogSystem.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java?rev=293068r1=293067r2=293068view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java Sat Oct 1 21:11:55 2005 @@ -241,6 +241,7 @@ { logger.removeAppender(appender); appender.close(); +appender = null; } } Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/SimpleLog4JLogSystem.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/SimpleLog4JLogSystem.java?rev=293068r1=293067r2=293068view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/SimpleLog4JLogSystem.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/log/SimpleLog4JLogSystem.java Sat Oct 1 21:11:55 2005 @@ -46,6 +46,7 @@ public class SimpleLog4JLogSystem implements LogSystem { private RuntimeServices rsvc = null; +private RollingFileAppender appender = null; /** log4java logging interface */ protected Category logger = null; @@ -118,7 +119,7 @@ */ logger.setLevel(Level.DEBUG); -RollingFileAppender appender = new RollingFileAppender( new PatternLayout( %d - %m%n), logfile, true); +appender = new RollingFileAppender( new PatternLayout( %d - %m%n), logfile, true); appender.setMaxBackupIndex( 1 ); @@ -166,11 +167,11 @@ /** Close all destinations*/ public void shutdown() { -Enumeration appenders = logger.getAllAppenders(); -while (appenders.hasMoreElements()) +if (appender != null) { -Appender appender = (Appender)appenders.nextElement(); +logger.removeAppender(appender); appender.close(); +appender = null; } } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r293073 - in /jakarta/velocity/core/trunk: contrib/ experimental/ experimental/localdirective/ experimental/templatetool/ experimental/veltag/
Author: wglass Date: Sat Oct 1 22:02:58 2005 New Revision: 293073 URL: http://svn.apache.org/viewcvs?rev=293073view=rev Log: clean up contrib directory, rename experimental. VELOCITY-400. Added: jakarta/velocity/core/trunk/experimental/ jakarta/velocity/core/trunk/experimental/localdirective/ - copied from r293050, jakarta/velocity/core/trunk/contrib/temporary/localdirective/ jakarta/velocity/core/trunk/experimental/templatetool/ - copied from r293050, jakarta/velocity/core/trunk/contrib/temporary/templatetool/ jakarta/velocity/core/trunk/experimental/veltag/ - copied from r293050, jakarta/velocity/core/trunk/contrib/temporary/veltag/ Removed: jakarta/velocity/core/trunk/contrib/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r292918 [3/3] - in /jakarta/velocity/core/trunk: ./ build/lib/ src/java/org/apache/velocity/ src/java/org/apache/velocity/app/event/ src/java/org/apache/velocity/app/event/implement/ src/java/org/apache/velocity/runtime/ src/java/org/apache...
Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java?rev=292918r1=292917r2=292918view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java Fri Sep 30 21:36:58 2005 @@ -80,7 +80,7 @@ */ public void init( ExtendedProperties configuration) { -rsvc.info(JarResourceLoader : initialization starting.); +log.info(JarResourceLoader : initialization starting.); // rest of Velocity engine still use legacy Vector // and Hashtable classes. Classes are implicitly @@ -97,34 +97,34 @@ if (paths != null paths.size() 0) { -rsvc.warn(JarResourceLoader : you are using a deprecated configuration +log.warn(JarResourceLoader : you are using a deprecated configuration + property for the JarResourceLoader - 'name.resource.loader.resource.path'. + Please change to the conventional 'name.resource.loader.path'.); } } -rsvc.info(JarResourceLoader # of paths : + paths.size() ); +log.info(JarResourceLoader # of paths : + paths.size() ); for ( int i=0; ipaths.size(); i++ ) { loadJar( (String)paths.get(i) ); } -rsvc.info(JarResourceLoader : initialization complete.); +log.info(JarResourceLoader : initialization complete.); } private void loadJar( String path ) { -rsvc.info(JarResourceLoader : trying to load: + path); +log.info(JarResourceLoader : trying to load: + path); // Check path information if ( path == null ) { -rsvc.error(JarResourceLoader : can not load JAR - JAR path is null); +log.error(JarResourceLoader : can not load JAR - JAR path is null); } if ( !path.startsWith(jar:) ) { -rsvc.error(JarResourceLoader : JAR path must start with jar: - + +log.error(JarResourceLoader : JAR path must start with jar: - + see java.net.JarURLConnection for information); } if ( !path.endsWith(!/) ) @@ -193,7 +193,7 @@ contains .. and may be trying to access + content outside of template root. Rejected.; -rsvc.error( JarResourceLoader : + msg ); +log.error( JarResourceLoader : + msg ); throw new ResourceNotFoundException ( msg ); } Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java?rev=292918r1=292917r2=292918view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java Fri Sep 30 21:36:58 2005 @@ -19,7 +19,7 @@ import java.io.InputStream; import org.apache.velocity.runtime.RuntimeServices; - +import org.apache.velocity.runtime.log.Log; import org.apache.velocity.runtime.resource.Resource; import org.apache.velocity.runtime.resource.ResourceCacheImpl; @@ -56,6 +56,7 @@ protected String className = null; protected RuntimeServices rsvc = null; +protected Log log = null; /** * This initialization is used by all resource @@ -65,6 +66,7 @@ public void commonInit( RuntimeServices rs, ExtendedProperties configuration) { this.rsvc = rs; +this.log = rsvc.getLog(); /* * these two properties are not required for all loaders. @@ -81,8 +83,7 @@ catch (Exception e) { isCachingOn = false; -rs.error(e.getMessage() + : Using default of ' + isCachingOn - + '\''); +log.error(Exception using default of ' + isCachingOn + '\'', e); } try { @@ -91,8 +92,8 @@ catch (Exception e) { modificationCheckInterval = 0; -rs.error(e.getMessage() + : Using default of ' + - modificationCheckInterval + '\''); +log.error(Exception using default of ' + + modificationCheckInterval + '\'', e);
svn commit: r291938 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java
Author: wglass Date: Tue Sep 27 06:53:10 2005 New Revision: 291938 URL: http://svn.apache.org/viewcvs?rev=291938view=rev Log: remove extra spaces in error message Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=291938r1=291937r2=291938view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Tue Sep 27 06:53:10 2005 @@ -83,7 +83,7 @@ * N O T E S O N R U N T I M E I N I T I A L I Z A T I O N * --- * init() - * + * * If init() is called by itself the RuntimeInstance will initialize * with a set of default values. * --- @@ -102,13 +102,13 @@ * @version $Id$ */ public class RuntimeInstance implements RuntimeConstants, RuntimeServices -{ +{ /** * VelocimacroFactory object to manage VMs */ private VelocimacroFactory vmFactory = null; -/** +/** * The Runtime logger. We start with an instance of * a 'primordial logger', which just collects log messages * then, when the log system is initialized, we dump @@ -116,12 +116,12 @@ */ private LogSystem logSystem = new PrimordialLogSystem(); -/** - * The Runtime parser pool +/** + * The Runtime parser pool */ private SimplePool parserPool; - -/** + +/** * Indicate whether the Runtime has been fully initialized. */ private boolean initialized; @@ -149,7 +149,7 @@ * can be retrieved from the main ExtendedProperties object * using something like the following: * - * ExtendedProperties loaderConfiguration = + * ExtendedProperties loaderConfiguration = * configuration.subset(loaderID); * * And a configuration is a lot more convenient to deal @@ -173,7 +173,7 @@ /* - * Opaque reference to something specificed by the + * Opaque reference to something specificed by the * application for use in application supplied/specified * pluggable components */ @@ -194,7 +194,7 @@ /* * make a new introspector and initialize it */ - + introspector = new Introspector( this ); /* @@ -236,13 +236,13 @@ initializeIntrospection(); /* - * initialize the VM Factory. It will use the properties + * initialize the VM Factory. It will use the properties * accessable from Runtime, so keep this here at the end. */ vmFactory.initVelocimacro(); info(Velocity successfully started.); - + initialized = true; } } @@ -320,10 +320,10 @@ { InputStream inputStream = getClass() .getResourceAsStream('/' + DEFAULT_RUNTIME_PROPERTIES); - + configuration.load( inputStream ); - -info (Default Properties File: + + +info (Default Properties File: + new File(DEFAULT_RUNTIME_PROPERTIES).getPath()); } catch (IOException ioe) @@ -344,10 +344,10 @@ if (overridingProperties == null) { overridingProperties = new ExtendedProperties(); -} - +} + overridingProperties.setProperty(key, value); -} +} /** * Allow an external system to set an ExtendedProperties @@ -399,11 +399,11 @@ if (overridingProperties == null) { overridingProperties = new ExtendedProperties(); -} - +} + overridingProperties.addProperty(key, value); } - + /** * Clear the values pertaining to a particular * property. @@ -415,9 +415,9 @@ if (overridingProperties != null) { overridingProperties.clearProperty(key); -} +} } - + /** * Allows an external caller to get a property. The calling * routine is required to know the type, as this routine @@ -440,21 +440,21 @@ */ private void initializeProperties() { -/* +/* * Always lay down the default properties first as * to provide a solid base. */ if (configuration.isInitialized() == false) { setDefaultProperties
svn commit: r292012 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java
Author: wglass Date: Tue Sep 27 11:18:29 2005 New Revision: 292012 URL: http://svn.apache.org/viewcvs?rev=292012view=rev Log: changed UBERSPECT_CLASSNAME and PARSER_POOL_SIZE constants to be public since these are user-accessible properties Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java?rev=292012r1=292011r2=292012view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java Tue Sep 27 11:18:29 2005 @@ -17,7 +17,7 @@ */ /** - * This class defines the keys that are used in the + * This class defines the keys that are used in the * velocity.properties file so that they can be referenced as a constant * within Java code. * @@ -42,46 +42,46 @@ * -- */ -/** +/** * Location of the velocity log file. */ -public static final String RUNTIME_LOG = +public static final String RUNTIME_LOG = runtime.log; - + /** * externally provided logger */ -public static final String RUNTIME_LOG_LOGSYSTEM = +public static final String RUNTIME_LOG_LOGSYSTEM = runtime.log.logsystem; /** * class of log system to use */ -public static final String RUNTIME_LOG_LOGSYSTEM_CLASS = +public static final String RUNTIME_LOG_LOGSYSTEM_CLASS = runtime.log.logsystem.class; -/** +/** * Stack trace output for error messages. */ -public static final String RUNTIME_LOG_ERROR_STACKTRACE = +public static final String RUNTIME_LOG_ERROR_STACKTRACE = runtime.log.error.stacktrace; - -/** + +/** * Stack trace output for warning messages. */ -public static final String RUNTIME_LOG_WARN_STACKTRACE = +public static final String RUNTIME_LOG_WARN_STACKTRACE = runtime.log.warn.stacktrace; - -/** + +/** * Stack trace output for info messages. */ -public static final String RUNTIME_LOG_INFO_STACKTRACE = +public static final String RUNTIME_LOG_INFO_STACKTRACE = runtime.log.info.stacktrace; /** * Logging of invalid references. */ -public static final String RUNTIME_LOG_REFERENCE_LOG_INVALID = +public static final String RUNTIME_LOG_REFERENCE_LOG_INVALID = runtime.log.invalid.references; /** @@ -98,24 +98,24 @@ * D I R E C T I V E C O N F I G U R A T I O N * -- * Directive properties are of the form: - * + * * directive.directive-name.property * -- */ -/** +/** * Initial counter value in #foreach directives. */ -public static final String COUNTER_NAME = +public static final String COUNTER_NAME = directive.foreach.counter.name; -/** +/** * Initial counter value in #foreach directives. */ -public static final String COUNTER_INITIAL_VALUE = +public static final String COUNTER_INITIAL_VALUE = directive.foreach.counter.initial.value; -/** +/** * Maximum allowed number of loops. */ public static final String MAX_NUMBER_LOOPS = directive.foreach.maxloops; @@ -125,21 +125,21 @@ * a parameter not allowed in the #include directive. Only * string literals, and references are allowed. */ -public static String ERRORMSG_START = +public static String ERRORMSG_START = directive.include.output.errormsg.start; - + /** * Ending tag for error messages triggered by passing * a parameter not allowed in the #include directive. Only * string literals, and references are allowed. */ -public static String ERRORMSG_END = +public static String ERRORMSG_END = directive.include.output.errormsg.end; /** * Maximum recursion depth allowed for the #parse directive. */ -public static String PARSE_DIRECTIVE_MAXDEPTH +public static String PARSE_DIRECTIVE_MAXDEPTH = directive.parse.max.depth; @@ -148,9 +148,9 @@ * R E S O U R C E M A N A G E R C O N F I G U R A T I O N * -- */ - + public static String RESOURCE_MANAGER_CLASS = resource.manager.class; - + /** * The coderesource.manager.cache.class/code
svn commit: r292114 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
Author: wglass Date: Tue Sep 27 20:47:42 2005 New Revision: 292114 URL: http://svn.apache.org/viewcvs?rev=292114view=rev Log: fix trivial tab issue Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java?rev=292114r1=292113r2=292114view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java Tue Sep 27 20:47:42 2005 @@ -30,25 +30,25 @@ /** * This is abstract class the all text resource loaders should * extend. - * + * * @author a href=mailto:[EMAIL PROTECTED]Jason van Zyl/a * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a * @version $Id$ */ public abstract class ResourceLoader { -/** +/** * Does this loader want templates produced with it * cached in the Runtime. */ protected boolean isCachingOn = false; - + /** * This property will be passed on to the templates * that are created with this loader. */ protected long modificationCheckInterval = 2; - + /** * Class name for this loader, for logging/debuggin * purposes. @@ -68,14 +68,14 @@ /* * these two properties are not required for all loaders. - * For example, for ClasspathLoader, what would cache mean? + * For example, for ClasspathLoader, what would cache mean? * so adding default values which I think are the safest * * don't cache, and modCheckInterval irrelevant... */ try - { +{ isCachingOn = configuration.getBoolean(cache, false); } catch (Exception e) @@ -94,7 +94,7 @@ rs.error(e.getMessage() + : Using default of ' + modificationCheckInterval + '\''); } - + /* * this is a must! */ @@ -110,17 +110,17 @@ } } -/** +/** * Initialize the template loader with a * a resources class. */ public abstract void init( ExtendedProperties configuration); -/** +/** * Get the InputStream that the Runtime will parse * to create a template. */ -public abstract InputStream getResourceStream( String source ) +public abstract InputStream getResourceStream( String source ) throws ResourceNotFoundException; /** @@ -128,7 +128,7 @@ * has been modified. */ public abstract boolean isSourceModified(Resource resource); - + /** * Get the last modified time of the InputStream source * that was used to create the template. We need the template @@ -175,7 +175,7 @@ { this.modificationCheckInterval = modificationCheckInterval; } - + /** * Get the interval at which the InputStream source * should be checked for modifications. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r291256 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java
Author: wglass Date: Fri Sep 23 23:04:39 2005 New Revision: 291256 URL: http://svn.apache.org/viewcvs?rev=291256view=rev Log: check to see if Velocity was initialized and give meaninful exception message if not. VELOCITY-374 Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=291256r1=291255r2=291256view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Fri Sep 23 23:04:39 2005 @@ -936,6 +936,12 @@ public Template getTemplate(String name, String encoding) throws ResourceNotFoundException, ParseErrorException, Exception { +if (resourceManager == null) +{ +throw new IllegalStateException + ( Cannot retrieve template as Velocity was not initialized.); +} + return (Template) resourceManager.getResource(name, ResourceManager.RESOURCE_TEMPLATE, encoding); @@ -975,6 +981,12 @@ public ContentResource getContent(String name, String encoding) throws ResourceNotFoundException, ParseErrorException, Exception { +if (resourceManager == null) +{ +throw new IllegalStateException + ( Cannot retrieve content as Velocity was not initialized.); +} + return (ContentResource) resourceManager.getResource(name, ResourceManager.RESOURCE_CONTENT, encoding); @@ -992,6 +1004,12 @@ */ public String getLoaderNameForResource(String resourceName) { +if (resourceManager == null) +{ +throw new IllegalStateException + ( Cannot retrieve template information as Velocity was not initialized.); +} + return resourceManager.getLoaderNameForResource(resourceName); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r291173 - /jakarta/velocity/core/trunk/build/build.xml
Author: wglass Date: Fri Sep 23 10:50:40 2005 New Revision: 291173 URL: http://svn.apache.org/viewcvs?rev=291173view=rev Log: add javacc parser task. resolves VELOCITY-222. Modified: jakarta/velocity/core/trunk/build/build.xml Modified: jakarta/velocity/core/trunk/build/build.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/build/build.xml?rev=291173r1=291172r2=291173view=diff == --- jakarta/velocity/core/trunk/build/build.xml (original) +++ jakarta/velocity/core/trunk/build/build.xml Fri Sep 23 10:50:40 2005 @@ -62,6 +62,11 @@ value=org/apache/velocity/runtime/defaults / + + !-- Needs to be configured with system location of javacc for parser task -- + property name=javacc.home value=/javacc-3.2/ + + !-- disabled for now == classpath issues taskdef name=fop classname=Fop/ taskdef name=xslt classname=Xslt/ @@ -90,6 +95,8 @@ ** envechos environment variables to screen ** prepareenv creates build dir, copies source ** J2EE-error prepare message if J2EE missing but required + ** parser env calls jjtree and javacc + ** (requires javaCC 3.1+ and ant 1.6.x) ** compileprepare compiles non-J2EE source ** compile-J2EE prepare, J2EE-error compiles J2EE source ** compile-copy move non-J2EE classes out of the way. @@ -179,6 +186,79 @@ * /echo /target + + + !-- === -- + !-- Calls jjtree and javacc -- + !-- === -- + target name=parser depends=env +echo + *** + ** Creating Parser.jj and Parser.java in source tree. + ** + ** Note: ASTNode files generated by jjtree are + ** not generated with this task. To create new ASTNode files, + ** run jjtree manually then copy the relevant files into + ** the runtime/parser/node directory (deleting all other + ** generated files). + ** + *** + /echo + + echo message=This task requires javacc 3.1+ and ant 1.6.x to be installed./ + echo message=Checking javcc.home='${javacc.home}' and ant.version='${ant.version}'./ + + condition property=parser-task-runnable +and + available file=${javacc.home} type=dir/ + + !-- include a list of acceptable ant versions here -- + or + contains string=${ant.version} substring=1.6/ + /or +/and + /condition + + antcall target=jjtree / + antcall target=javacc / + antcall target=javacc-cleanup / + antcall target=javacc-missing / + + /target + + + target name=jjtree if=parser-task-runnable +echo message=Running JJTree on Parser.jjt/ +jjtree + target=${src.java.dir}/org/apache/velocity/runtime/parser/Parser.jjt + outputdirectory=${src.java.dir}/org/apache/velocity/runtime/parser/ + javacchome=${javacc.home} buildnodefiles=false / + /target + + target name=javacc if=parser-task-runnable +echo message=Running JavaCC on Parser.jj/ +javacc target=${src.java.dir}/org/apache/velocity/runtime/parser/Parser.jj +outputdirectory=${src.java.dir}/org/apache/velocity/runtime/parser/ +javacchome=${javacc.home} / + /target + + target name=javacc-cleanup if=parser-task-runnable + delete + fileset dir=${src.java.dir}/org/apache/velocity/runtime/parser/ + include name=AST*/ + include name=Node.java/ + include name=SimpleNode.java/ + include name=ParserVisitor.java/ + /fileset + /delete + /target + + target name=javacc-missing unless=parser-task-runnable +echo message=Couldn't run javacc./ + echo message=JavaCC 3.1+ must be installed at ${javacc.home}./ + echo message=Ant must be version 1.6.x./ + /target + !-- === -- !-- Compiles the source directory without the J2EE dependent files -- - To unsubscribe, e-mail
svn commit: r291252 - in /jakarta/velocity/core/trunk: src/java/org/apache/velocity/runtime/parser/node/ src/test/org/apache/velocity/test/ test/templates/ test/templates/compare/
Author: wglass Date: Fri Sep 23 22:34:39 2005 New Revision: 291252 URL: http://svn.apache.org/viewcvs?rev=291252view=rev Log: equality and not equality now based on toString when classes are different. See VELOCITY-350 Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/TemplateTestCase.java jakarta/velocity/core/trunk/test/templates/compare/logical.cmp jakarta/velocity/core/trunk/test/templates/logical.vm Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java?rev=291252r1=291251r2=291252view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java Fri Sep 23 22:34:39 2005 @@ -111,27 +111,41 @@ } -/* - * check to see if they are the same class. I don't think this is slower - * as I don't think that getClass() results in object creation, and we can - * extend == to handle all classes - */ -if (left.getClass().equals( right.getClass() ) ) + /** +* assume that if one class is a subclass of the other +* that we should use the equals operator +*/ + +if (left.getClass().isAssignableFrom(right.getClass()) || +right.getClass().isAssignableFrom(left.getClass()) ) { return left.equals( right ); } else { -rsvc.error(Error in evaluation of == expression. - + Both arguments must be of the same Class. - + Currently left = + left.getClass() + , right = - + right.getClass() + . - + context.getCurrentTemplateName() + [line + getLine() - + , column + getColumn() + ] (ASTEQNode)); +/** + * Compare the String representations + */ +if ((left.toString() == null) || (right.toString() == null)) +{ +rsvc.error( ( left.toString() == null ? Left : Right ) + string side ++ String representation ( ++ jjtGetChild( (left == null? 0 : 1) ).literal() ++ ) of '!=' operation has null value. ++ Operation not possible. ++ context.getCurrentTemplateName() + [line + getLine() ++ , column + getColumn() + ]); + +return false; +} + +else +{ +return left.toString().equals(right.toString()); +} } -return false; } public Object value(InternalContextAdapter context) Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java?rev=291252r1=291251r2=291252view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java Fri Sep 23 22:34:39 2005 @@ -93,27 +93,41 @@ } -/* - * check to see if they are the same class. I don't think this is slower - * as I don't think that getClass() results in object creation, and we can - * extend == to handle all classes - */ - -if (left.getClass().equals( right.getClass() ) ) + /** +* assume that if one class is a subclass of the other +* that we should use the equals operator +*/ + +if (left.getClass().isAssignableFrom(right.getClass()) || +right.getClass().isAssignableFrom(left.getClass()) ) { -return !(left.equals( right )); +return !left.equals( right ); } else { -rsvc.error(Error in evaluation of != expression. - + Both arguments must be of the same Class. - + Currently left = + left.getClass() + , right = - + right.getClass() + . - + context.getCurrentTemplateName() + [line + getLine
svn commit: r291254 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
Author: wglass Date: Fri Sep 23 22:48:44 2005 New Revision: 291254 URL: http://svn.apache.org/viewcvs?rev=291254view=rev Log: Fixed VELOCITY-382. ClasspathResourceLoader now throws exception when template not found. Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java?rev=291254r1=291253r2=291254view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java Fri Sep 23 22:48:44 2005 @@ -120,6 +120,14 @@ throw new ResourceNotFoundException( fnfe.getMessage() ); } +if (result == null) +{ + String msg = FileResourceLoader Error: cannot find resource + + name; + + throw new ResourceNotFoundException( msg ); +} + return result; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r291032 - in /jakarta/velocity/core/trunk/test/templates: compare/logical.cmp compare/map.cmp logical.vm map.vm
Author: wglass Date: Thu Sep 22 16:16:23 2005 New Revision: 291032 URL: http://svn.apache.org/viewcvs?rev=291032view=rev Log: added test cases for issues VELOCITY-336 and VELOCITY-359 Modified: jakarta/velocity/core/trunk/test/templates/compare/logical.cmp jakarta/velocity/core/trunk/test/templates/compare/map.cmp jakarta/velocity/core/trunk/test/templates/logical.vm jakarta/velocity/core/trunk/test/templates/map.vm Modified: jakarta/velocity/core/trunk/test/templates/compare/logical.cmp URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/templates/compare/logical.cmp?rev=291032r1=291031r2=291032view=diff == --- jakarta/velocity/core/trunk/test/templates/compare/logical.cmp (original) +++ jakarta/velocity/core/trunk/test/templates/compare/logical.cmp Thu Sep 22 16:16:23 2005 @@ -186,3 +186,4 @@ right right + Modified: jakarta/velocity/core/trunk/test/templates/compare/map.cmp URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/templates/compare/map.cmp?rev=291032r1=291031r2=291032view=diff == --- jakarta/velocity/core/trunk/test/templates/compare/map.cmp (original) +++ jakarta/velocity/core/trunk/test/templates/compare/map.cmp Thu Sep 22 16:16:23 2005 @@ -12,7 +12,7 @@ - +booboo aval aval bval @@ -20,6 +20,8 @@ 2 value foovalue +$mymap.map.foo +{aa=aaa} 0 Modified: jakarta/velocity/core/trunk/test/templates/logical.vm URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/templates/logical.vm?rev=291032r1=291031r2=291032view=diff == --- jakarta/velocity/core/trunk/test/templates/logical.vm (original) +++ jakarta/velocity/core/trunk/test/templates/logical.vm Thu Sep 22 16:16:23 2005 @@ -451,4 +451,7 @@ right #else wrong -#end \ No newline at end of file +#end + +## check empty if statement is ok +#if( true )#end Modified: jakarta/velocity/core/trunk/test/templates/map.vm URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/test/templates/map.vm?rev=291032r1=291031r2=291032view=diff == --- jakarta/velocity/core/trunk/test/templates/map.vm (original) +++ jakarta/velocity/core/trunk/test/templates/map.vm Thu Sep 22 16:16:23 2005 @@ -31,8 +31,8 @@ #set($key = 'key') #set($value = 'value') -#set($mymap = { a : aval, 'b' : 'bval', 1 : 2, $key : $value, 'hash' : $hashmap } ) - +#set($mymap = { a : aval, bar : booboo, 'b' : 'bval', 1 : 2, $key : $value, 'hash' : $hashmap } ) +$mymap.put(bar, { aa : aaa }) $mymap.a $mymap.get(a) $mymap.b @@ -40,6 +40,8 @@ $mymap.get(1) $mymap.get($key) $mymap.hash.Foo +$mymap.map.foo +$mymap.bar ## ## test for empty map - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r290368 - in /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser: Parser.java Parser.jj Parser.jjt ParserTreeConstants.java
Author: wglass Date: Mon Sep 19 23:01:24 2005 New Revision: 290368 URL: http://svn.apache.org/viewcvs?rev=290368view=rev Log: allow empty body in #if, e.g. #if(true)#end as suggested in Velocity-359 Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java?rev=290368r1=290367r2=290368view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java Mon Sep 19 23:01:24 2005 @@ -1407,7 +1407,6 @@ try { label_10: while (true) { - Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: case RPAREN: @@ -1436,6 +1435,7 @@ jj_la1[32] = jj_gen; break label_10; } + Statement(); } } catch (Throwable jjte001) { if (jjtc001) { @@ -1518,7 +1518,6 @@ try { label_12: while (true) { - Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: case RPAREN: @@ -1547,6 +1546,7 @@ jj_la1[36] = jj_gen; break label_12; } + Statement(); } } catch (Throwable jjte001) { if (jjtc001) { @@ -1612,7 +1612,6 @@ try { label_13: while (true) { - Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: case RPAREN: @@ -1641,6 +1640,7 @@ jj_la1[38] = jj_gen; break label_13; } + Statement(); } } catch (Throwable jjte001) { if (jjtc001) { @@ -2626,11 +2626,6 @@ return false; } - final private boolean jj_3R_78() { -if (jj_3R_64()) return true; -return false; - } - final private boolean jj_3R_20() { Token xsp; xsp = jj_scanpos; @@ -2641,8 +2636,8 @@ return false; } - final private boolean jj_3R_77() { -if (jj_3R_63()) return true; + final private boolean jj_3R_78() { +if (jj_3R_64()) return true; return false; } @@ -2651,6 +2646,11 @@ return false; } + final private boolean jj_3R_77() { +if (jj_3R_63()) return true; +return false; + } + final private boolean jj_3R_76() { if (jj_3R_62()) return true; return false; @@ -2692,11 +2692,6 @@ return false; } - final private boolean jj_3R_71() { -if (jj_3R_59()) return true; -return false; - } - final private boolean jj_3R_28() { if (jj_3R_55()) return true; if (jj_scan_token(LPAREN)) return true; @@ -2707,6 +2702,11 @@ return false; } + final private boolean jj_3R_71() { +if (jj_3R_59()) return true; +return false; + } + final private boolean jj_3R_66() { Token xsp; xsp = jj_scanpos; @@ -2758,6 +2758,19 @@ return false; } + final private boolean jj_3R_84() { +if (jj_scan_token(COMMA)) return true; +if (jj_3R_24()) return true; +if (jj_scan_token(COLON)) return true; +if (jj_3R_24()) return true; +return false; + } + + final private boolean jj_3R_51() { +if (jj_3R_64()) return true; +return false; + } + final private boolean jj_3R_30() { Token xsp; xsp = jj_scanpos; @@ -2782,19 +2795,6 @@ return false; } - final private boolean jj_3R_84() { -if (jj_scan_token(COMMA)) return true; -if (jj_3R_24()) return true; -if (jj_scan_token(COLON)) return true; -if (jj_3R_24()) return true; -return false; - } - - final private boolean jj_3R_51() { -if (jj_3R_64()) return true; -return false; - } - final private boolean jj_3R_50() { if (jj_3R_63()) return true; return false; @@ -3100,13 +3100,13 @@ return false; } - final private boolean jj_3R_32() { -if (jj_3R_35()) return true; + final private boolean jj_3R_59() { +if (jj_scan_token(STRING_LITERAL)) return true; return false; } - final private boolean jj_3R_59() { -if (jj_scan_token(STRING_LITERAL)) return true; + final private boolean jj_3R_32() { +if (jj_3R_35()) return true; return false; } Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime
svn commit: r290369 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java
Author: wglass Date: Mon Sep 19 23:07:35 2005 New Revision: 290369 URL: http://svn.apache.org/viewcvs?rev=290369view=rev Log: Fix NullPointerException when calling an overloaded method with a null parameter. Thanks to Reggie Riser for the fix in VELOCITY-370. Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java?rev=290369r1=290368r2=290369view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java Mon Sep 19 23:07:35 2005 @@ -16,14 +16,8 @@ * limitations under the License. */ -import java.util.Map; -import java.util.Set; -import java.util.HashMap; -import java.util.HashSet; - import java.lang.reflect.Method; -import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.RuntimeLogger; /** @@ -112,8 +106,11 @@ { if ( i 0) msg = msg + , ; - -msg = msg + params[i].getClass().getName(); + +if (params[i] == null) +msg = msg + null; +else +msg = msg + params[i].getClass().getName(); } msg = msg + ) for class + c; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r290384 - in /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser: Parser.java Parser.jj Parser.jjt ParserTokenManager.java
Author: wglass Date: Tue Sep 20 00:26:47 2005 New Revision: 290384 URL: http://svn.apache.org/viewcvs?rev=290384view=rev Log: method calls now can take a map for a parameter. VELOCITY-336 Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java?rev=290384r1=290383r2=290384view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java Tue Sep 20 00:26:47 2005 @@ -2505,21 +2505,6 @@ finally { jj_save(11, xla); } } - final private boolean jj_3R_31() { -if (jj_3R_20()) return true; -return false; - } - - final private boolean jj_3R_26() { -if (jj_3R_35()) return true; -return false; - } - - final private boolean jj_3_10() { -if (jj_3R_28()) return true; -return false; - } - final private boolean jj_3R_81() { if (jj_scan_token(COMMA)) return true; if (jj_3R_24()) return true; @@ -3117,6 +3102,21 @@ final private boolean jj_3R_61() { if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; +return false; + } + + final private boolean jj_3R_31() { +if (jj_3R_20()) return true; +return false; + } + + final private boolean jj_3R_26() { +if (jj_3R_35()) return true; +return false; + } + + final private boolean jj_3_10() { +if (jj_3R_28()) return true; return false; } Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj?rev=290384r1=290383r2=290384view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj Tue Sep 20 00:26:47 2005 @@ -448,7 +448,7 @@ COLON : : } -DIRECTIVE +DIRECTIVE, REFMOD2 TOKEN : { LEFT_CURLEY : { @@ -989,7 +989,13 @@ SwitchTo(REFMODIFIER); } -| LCURLY: { +} + + +REFERENCE,REFMODIFIER +TOKEN : +{ +LCURLY: { | RCURLY: } { stateStackPop(); Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt?rev=290384r1=290383r2=290384view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt Tue Sep 20 00:26:47 2005 @@ -469,7 +469,7 @@ COLON : : } -DIRECTIVE +DIRECTIVE, REFMOD2 TOKEN : { LEFT_CURLEY : { @@ -1010,7 +1010,13 @@ SwitchTo(REFMODIFIER); } -| LCURLY: { +} + + +REFERENCE,REFMODIFIER +TOKEN : +{ +LCURLY: { | RCURLY: } { stateStackPop(); Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java?rev=290384r1=290383r2=290384view=diff == --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java Tue Sep 20 00:26:47 2005 @@ -2842,7 +2842,7 @@ catch(java.io.IOException e) { return curPos; } } } -private final int jjStopStringLiteralDfa_1(int pos, long active0, long active1) +private final int jjStopStringLiteralDfa_1(int pos, long active0) { switch (pos) { @@ -2889,9 +2889,9 @@ return -1; } } -private final int jjStartNfa_1(int pos, long active0, long active1) +private final int jjStartNfa_1(int pos, long active0) { - return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0, active1), pos + 1); + return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); } private final int jjStartNfaWithStates_1(int pos, int kind, int state) { @@ -2925,9 +2925,9 @@ case
svn commit: r290385 - /jakarta/velocity/core/trunk/xdocs/overview.xml
Author: wglass Date: Tue Sep 20 00:29:40 2005 New Revision: 290385 URL: http://svn.apache.org/viewcvs?rev=290385view=rev Log: Fix typo in overview page. Thanks Mitsu! Modified: jakarta/velocity/core/trunk/xdocs/overview.xml Modified: jakarta/velocity/core/trunk/xdocs/overview.xml URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/overview.xml?rev=290385r1=290384r2=290385view=diff == --- jakarta/velocity/core/trunk/xdocs/overview.xml (original) +++ jakarta/velocity/core/trunk/xdocs/overview.xml Tue Sep 20 00:29:40 2005 @@ -103,7 +103,7 @@ reference properties and methods. For example, you might create an introspector that retrieves data from Lucene or other search engine indexes. /li -liFinally, for the truly adept, the grammer for Velocity is processed in a parser +liFinally, for the truly adept, the grammar for Velocity is processed in a parser generated by a href=http://www.metamata.com/javacc/;JavaCC/a (Java Compiler Compiler) using the JJTree extension to create an Abstract Syntax Tree. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]