Hi,
Is it possible to configure velocity to raise an exception if a variable
is reference which is undefined at the parsing stage? I know you use quiet
syntax to not output the variable name but I want to stop parsing the
message.
cheers
Dan
parsing? do you mean the merging stage? there's no context at the
parsing stage. and if the latter, then yes, that should be doable.
look in the developer's guide for the ReferenceInsertionEventHandler.
On 11/18/05, Daniel Burke [EMAIL PROTECTED] wrote:
Hi,
Is it possible to configure
Sorry, merging. I had a look at that however I don't think that will
address my issue. I want to throw an Exception if the value is null.
However the interface method
ReferenceInsertionEventHandler.referenceInsert is not defined as throwing
an exception. I think at this stage I'm stuck. Anyone got
ant? I assume you mean maven? Or am I in the wrong source tree?
Here's what I did:
I created
test/texen/templates/nested_elements.vm
test/texen/compare/nested_elements.txt
I updated
test/texen/templates/Control.vm
test/texen-classpath/jar-contents/Control.vm
Hey Daniel,
Will I took a look at this earlier today, should have a patch in soon,
I'll send a usable build later today.
llewellyn.
- Original Message -
From: Daniel Burke [EMAIL PROTECTED]
To: velocity-dev@jakarta.apache.org
Sent: Friday, November 18, 2005 7:27 AM
Subject:
I can think of two different methods...
(1) Implement a ReferenceInsertionHandler. This has a method that receives
the complete reference string (e.g. foo.bar.someMethod() ) and allows you
to modify the result. The problem is that this will not be called for
invalid references.
(2) better
Hi Hilco,
Actually, the ant build is the standard build. The maven build is still
experimental. (Though I thought it ran those tests).
Basically, most of the tests are run via junit in one big TestSuite. But
there's 3 or 4 that depend on ant (or depend on custom classpath settings).
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
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
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
Hi,
I'm rethinking my earlier message. Definitely implement a custom
ReferenceInsertionHandler. If the refererence is invalid then the value
will be null.
If you want to stop parsing, throw a custom defined Error instead of an
exception. Velocity catches all Exceptions from both the
[ http://issues.apache.org/jira/browse/VELOCITY-423?page=all ]
Will Glass-Husain updated VELOCITY-423:
---
Attachment: invalidreference.txt
Report invalid references
-
Key: VELOCITY-423
URL:
Report invalid references
-
Key: VELOCITY-423
URL: http://issues.apache.org/jira/browse/VELOCITY-423
Project: Velocity
Type: New Feature
Components: Source
Reporter: Will Glass-Husain
Fix For: 1.5
Attachments:
Hi,
I've coded an event handler (InvalidReferenceHandler) that implements this.
It's in a patch file at
http://issues.apache.org/jira/browse/VELOCITY-423
It can be configured to either parse the whole page and collect a list of
invalid resources, or to throw a runtime exception upon
[
http://issues.apache.org/jira/browse/VELOCITY-132?page=comments#action_12358041
]
Llewellyn Falco commented on VELOCITY-132:
--
the following test breaks.
package com.spun.util.velocity.tests;
import junit.framework.TestCase;
import
[ http://issues.apache.org/jira/browse/VELOCITY-422?page=all ]
Hilco Wijbenga updated VELOCITY-422:
Attachment: texen.tar.bz2
The contents of the attached tarball is listed below.
The patch itself (code documentation):
[
http://issues.apache.org/jira/browse/VELOCITY-422?page=comments#action_12358055
]
Will Glass-Husain commented on VELOCITY-422:
Sounds very promising.
Sorry to be obnoxious about this, but...
Could you submit this as one diff? It's really
But in the uberspect you don't have access to the full reference string.
Seems less useful.
Maybe there's a different way. We could make a new event handler to be
called upon invalid references. (as opposed to null references).
Of course, this isn't a one versus other. The uberspect
[ http://issues.apache.org/jira/browse/VELOCITY-422?page=all ]
Hilco Wijbenga updated VELOCITY-422:
Attachment: patch.txt
I didn't realise diff could be used like this. Very nice! The attached file is
exactly what you suggested: 'svn diff .' in the
[
http://issues.apache.org/jira/browse/VELOCITY-422?page=comments#action_12358057
]
Will Glass-Husain commented on VELOCITY-422:
what is test.jar? It's very unusual to store a jar file in source control?
Add support for property and
[
http://issues.apache.org/jira/browse/VELOCITY-422?page=comments#action_12358058
]
Will Glass-Husain commented on VELOCITY-422:
never mind, I get it. Maybe we could have the ant script generate this.
Add support for property and propertyset
21 matches
Mail list logo