[jira] Commented: (VELTOOLS-68) VelocityViewServlet has hard coded ServletLogger

2006-11-04 Thread Henning Schmiedehausen (JIRA)
[ 
http://issues.apache.org/jira/browse/VELTOOLS-68?page=comments#action_12447135 
] 

Henning Schmiedehausen commented on VELTOOLS-68:


Ah yes, I forgot about backwards compatibility again. So your point with 
LogSystem is surely valid. 

About the priority: Well as the current is Avalon, Log4j, JDK, I'd probably say 
that making it configurable for the user and adding a default of ServletLogging 
(which should always be available in a servlet environment... :-) ) might be 
fine.



 VelocityViewServlet has hard coded ServletLogger
 

 Key: VELTOOLS-68
 URL: http://issues.apache.org/jira/browse/VELTOOLS-68
 Project: VelocityTools
  Issue Type: Bug
  Components: VelocityView
Affects Versions: 1.3
Reporter: Henning Schmiedehausen
Priority: Minor

 VelocityViewServlet configures the Velocity engine to use the ServletLogger 
 (~line 323). Integration of the servlet into applications that use other 
 logging systems (e.g. log4j / commons-logging) is very hard because of that.
 - VVS should honor the logging setttings in velocity.properties (e.g. for 
 explicit jdk logging)
 - It should add the ServletLogger to the log engine search path and only use 
 it if no other logger was found (log4j / avalon etc.)
 - The ServletLogger class implements the deprecated LogSystem. VelocityTools 
 should provide a LogChute implementation of the SrevletLogger.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r471244 - in /jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools: generic/ generic/log/ struts/ view/ view/servlet/ view/tools/

2006-11-04 Thread henning
Author: henning
Date: Sat Nov  4 10:34:38 2006
New Revision: 471244

URL: http://svn.apache.org/viewvc?view=revrev=471244
Log:
Some style fixes (remove unused Imports, unused Variables, adding
Serial Version ID for serializable fields 

Modified:

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/IteratorTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/log/LogSystemCommonsLog.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/ActionMessagesTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/FormTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/MessageTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/SecureLinkTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/StrutsLinkTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/TilesTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/ValidatorTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/ImportSupport.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/ToolboxRuleSet.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/XMLToolboxManager.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/servlet/ServletToolInfo.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/servlet/ServletToolboxManager.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/servlet/ServletToolboxRuleSet.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/servlet/VelocityLayoutServlet.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/servlet/WebappLoader.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/tools/AbstractSearchTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/tools/BrowserSnifferTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/tools/CookieTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/tools/ImportTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/tools/LinkTool.java

jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/view/tools/ViewRenderTool.java

Modified: 
jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/IteratorTool.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/IteratorTool.java?view=diffrev=471244r1=471243r2=471244
==
--- 
jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/IteratorTool.java
 (original)
+++ 
jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/IteratorTool.java
 Sat Nov  4 10:34:38 2006
@@ -20,7 +20,6 @@
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Vector;
 
 import org.apache.velocity.util.ArrayIterator;
 import org.apache.velocity.util.EnumerationIterator;

Modified: 
jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/log/LogSystemCommonsLog.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/log/LogSystemCommonsLog.java?view=diffrev=471244r1=471243r2=471244
==
--- 
jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/log/LogSystemCommonsLog.java
 (original)
+++ 
jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/generic/log/LogSystemCommonsLog.java
 Sat Nov  4 10:34:38 2006
@@ -33,7 +33,7 @@
  * /code
  * /p
  * 
- * @version $Id: LogSystemCommonsLog.java,v 1.4 2004/11/11 07:00:54 nbubna Exp 
$
+ * @version $Id$
  */
 public class LogSystemCommonsLog implements Log
 {
@@ -52,7 +52,6 @@
 //   begin non-static stuff ***
 
 private boolean printStackTrace = false;
-private String name;
 
 public LogSystemCommonsLog() 
 {

Modified: 
jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/ActionMessagesTool.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/ActionMessagesTool.java?view=diffrev=471244r1=471243r2=471244
==
--- 
jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/ActionMessagesTool.java
 (original)
+++ 
jakarta/velocity/tools/trunk/src/java/org/apache/velocity/tools/struts/ActionMessagesTool.java
 Sat Nov  4 10:34:38 2006
@@ -19,12 +19,12 @@
 import java.util.ArrayList;
 import 

[jira] Updated: (VELTOOLS-68) VelocityViewServlet has hard coded ServletLogger

2006-11-04 Thread Henning Schmiedehausen (JIRA)
 [ http://issues.apache.org/jira/browse/VELTOOLS-68?page=all ]

Henning Schmiedehausen updated VELTOOLS-68:
---

Attachment: velocity-tools.patch

How about the attached patch? It factors out the property setting by the 
servlet to work similar to the engine itself (load a properties file from the 
class path). This explicitly shows what gets set automagically by the servlet 
and gives useful hints to users that e.g. want to turn on caching for the 
webapp loader in the application velocity.properties...

(webapp.resource.loader.cache = true)

The patch also cleans up a number of minor nits, e.g. the usage of 
getServletContext().log() instead of log() directly...

 VelocityViewServlet has hard coded ServletLogger
 

 Key: VELTOOLS-68
 URL: http://issues.apache.org/jira/browse/VELTOOLS-68
 Project: VelocityTools
  Issue Type: Bug
  Components: VelocityView
Affects Versions: 1.3
Reporter: Henning Schmiedehausen
Priority: Minor
 Attachments: velocity-tools.patch


 VelocityViewServlet configures the Velocity engine to use the ServletLogger 
 (~line 323). Integration of the servlet into applications that use other 
 logging systems (e.g. log4j / commons-logging) is very hard because of that.
 - VVS should honor the logging setttings in velocity.properties (e.g. for 
 explicit jdk logging)
 - It should add the ServletLogger to the log engine search path and only use 
 it if no other logger was found (log4j / avalon etc.)
 - The ServletLogger class implements the deprecated LogSystem. VelocityTools 
 should provide a LogChute implementation of the SrevletLogger.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r471245 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java

2006-11-04 Thread henning
Author: henning
Date: Sat Nov  4 10:59:08 2006
New Revision: 471245

URL: http://svn.apache.org/viewvc?view=revrev=471245
Log:
Remove the random sorted qualifiers (public, static and final) from all 
constants as they are not needed inside an interface.

Modified:

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java

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=471245r1=471244r2=471245
==
--- 
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 10:59:08 2006
@@ -16,18 +16,17 @@
  * 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.
+ * under the License.
  */
 
 /**
- * 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.
+ * 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.
  *
- * @author a href=mailto:[EMAIL PROTECTED]Jon S. Stevens/a
- * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
- * @author a href=mailto:[EMAIL PROTECTED]Jason van Zyl/a
- * @version $Id$
+ * @author  a href=mailto:[EMAIL PROTECTED]Jon S. Stevens/a
+ * @author  a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
+ * @author  a href=mailto:[EMAIL PROTECTED]Jason van Zyl/a
+ * @version  $Id$
  */
 public interface RuntimeConstants
 {
@@ -45,61 +44,62 @@
  * --
  */
 
+/** Location of the velocity log file. */
+String RUNTIME_LOG = runtime.log;
+
+/** externally provided logger. */
+String RUNTIME_LOG_LOGSYSTEM = runtime.log.logsystem;
+
+/** class of log system to use. */
+String RUNTIME_LOG_LOGSYSTEM_CLASS = runtime.log.logsystem.class;
+
 /**
- * Location of the velocity log file.
+ * @deprecated  This appears to have always been meaningless.
  */
-public static final String RUNTIME_LOG =
-runtime.log;
+String RUNTIME_LOG_ERROR_STACKTRACE = runtime.log.error.stacktrace;
 
 /**
- *  externally provided logger
+ * @deprecated  The functionality this controlled is confusing and no 
longer necessary.
  */
-public static final String RUNTIME_LOG_LOGSYSTEM =
-runtime.log.logsystem;
+String RUNTIME_LOG_WARN_STACKTRACE = runtime.log.warn.stacktrace;
 
 /**
- *  class of log system to use
+ * @deprecated  This appears to have always been meaningless.
  */
-public static final String RUNTIME_LOG_LOGSYSTEM_CLASS =
-runtime.log.logsystem.class;
+String RUNTIME_LOG_INFO_STACKTRACE = runtime.log.info.stacktrace;
+
+/** Logging of invalid references. */
+String RUNTIME_LOG_REFERENCE_LOG_INVALID = 
runtime.log.invalid.references;
 
 /**
- * @deprecated This appears to have always been meaningless.
+ * @deprecated  Use LogChute.TRACE_PREFIX instead
  */
-public static final String RUNTIME_LOG_ERROR_STACKTRACE =
-runtime.log.error.stacktrace;
+String TRACE_PREFIX =  [trace] ;
 
 /**
- * @deprecated The functionality this controlled is
- * confusing and no longer necessary.
+ * @deprecated  Use LogChute.DEBUG_PREFIX instead
  */
-public static final String RUNTIME_LOG_WARN_STACKTRACE =
-runtime.log.warn.stacktrace;
+String DEBUG_PREFIX =  [debug] ;
 
 /**
- * @deprecated This appears to have always been meaningless.
+ * @deprecated  Use LogChute.INFO_PREFIX instead
  */
-public static final String RUNTIME_LOG_INFO_STACKTRACE =
-runtime.log.info.stacktrace;
+String INFO_PREFIX =   [info] ;
 
 /**
- * Logging of invalid references.
+ * @deprecated  Use LogChute.WARN_PREFIX instead
  */
-public static final String RUNTIME_LOG_REFERENCE_LOG_INVALID  =
-runtime.log.invalid.references;
+String WARN_PREFIX =   [warn] ;
 
-/** @deprecated Use LogChute.TRACE_PREFIX instead */
-public final static String TRACE_PREFIX =  [trace] ;
-/** @deprecated Use LogChute.DEBUG_PREFIX instead */
-public final static String DEBUG_PREFIX =  [debug] ;
-/** @deprecated Use LogChute.INFO_PREFIX instead */
-public final static String INFO_PREFIX  =   [info] ;
-/** @deprecated Use LogChute.WARN_PREFIX instead */
-public final static String WARN_PREFIX  =   [warn] ;
-/** @deprecated Use 

svn commit: r471246 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java

2006-11-04 Thread henning
Author: henning
Date: Sat Nov  4 11:06:59 2006
New Revision: 471246

URL: http://svn.apache.org/viewvc?view=revrev=471246
Log:
Serialize the resource retrieval per engine to avoid racing
when parsing the template (one thread parses the template,
another is reloading it). This showed prominently when running
a load benchmark on VelocityViewServlet with caching off.

Turning caching on hides the problem. But only synchronizing
the getResource method really fixes it. This slows applications
down visibly that don't run with template caching and and reload
a number of templates again and again. 

Fixes VELOCITY-24. Should be revisited for Velocity-2.0

Modified:

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java

Modified: 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?view=diffrev=471246r1=471245r2=471246
==
--- 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 (original)
+++ 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 Sat Nov  4 11:06:59 2006
@@ -284,7 +284,7 @@
  *  to syntax (or other) error.
  * @throws Exception if a problem in parse
  */
-public Resource getResource(String resourceName, int resourceType, String 
encoding )
+public synchronized Resource getResource(String resourceName, int 
resourceType, String encoding )
 throws ResourceNotFoundException, ParseErrorException, Exception
 {
 /*



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r471247 - /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java

2006-11-04 Thread henning
Author: henning
Date: Sat Nov  4 11:08:45 2006
New Revision: 471247

URL: http://svn.apache.org/viewvc?view=revrev=471247
Log:
Major rewrite of the ResourceManager implementation to use 
Iterators and clear up the init logic. Mostly happened while
hunting for the template loading race condition found here.

Modified:

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java

Modified: 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?view=diffrev=471247r1=471246r2=471247
==
--- 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 (original)
+++ 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 Sat Nov  4 11:08:45 2006
@@ -16,12 +16,14 @@
  * 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.
+ * under the License.
  */
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Vector;
 
 import org.apache.commons.collections.ExtendedProperties;
@@ -35,171 +37,163 @@
 import org.apache.velocity.util.ClassUtils;
 import org.apache.velocity.util.StringUtils;
 
+
 /**
- * Class to manage the text resource for the Velocity
- * Runtime.
+ * Class to manage the text resource for the Velocity Runtime.
  *
- * @author a href=mailto:[EMAIL PROTECTED]Will Glass-Husain/a
- * @author a href=mailto:[EMAIL PROTECTED]Jason van Zyl/a
- * @author a href=mailto:[EMAIL PROTECTED]Paulo Gaspar/a
- * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
- * @version $Id$
+ * @author  a href=mailto:[EMAIL PROTECTED]Will Glass-Husain/a
+ * @author  a href=mailto:[EMAIL PROTECTED]Jason van Zyl/a
+ * @author  a href=mailto:[EMAIL PROTECTED]Paulo Gaspar/a
+ * @author  a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
+ * @author  a href=mailto:[EMAIL PROTECTED]Henning P. Schmiedehausen/a
+ * @version  $Id$
  */
-public class ResourceManagerImpl implements ResourceManager
+public class ResourceManagerImpl
+implements ResourceManager
 {
-/**
- * A template resources.
- */
+
+/** A template resources. */
 public static final int RESOURCE_TEMPLATE = 1;
 
-/**
- * A static content resource.
- */
+/** A static content resource. */
 public static final int RESOURCE_CONTENT = 2;
 
-/**
- * token used to identify the loader internally
- */
+/** token used to identify the loader internally. */
 private static final String RESOURCE_LOADER_IDENTIFIER = 
_RESOURCE_LOADER_IDENTIFIER_;
 
-/**
- *  Object implementing ResourceCache to
- *  be our resource manager's Resource cache.
- */
+/** Object implementing ResourceCache to be our resource manager's 
Resource cache. */
 protected ResourceCache globalCache = null;
 
-/**
- * The List of templateLoaders that the Runtime will
- * use to locate the InputStream source of a template.
- */
-protected  ArrayList resourceLoaders = new ArrayList();
+/** The List of templateLoaders that the Runtime will use to locate the 
InputStream source of a template. */
+protected final List resourceLoaders = new ArrayList();
 
 /**
- * This is a list of the template input stream source
- * initializers, basically properties for a particular
- * template stream source. The order in this list
- * reflects numbering of the properties i.e.
+ * This is a list of the template input stream source initializers, 
basically properties for a particular template stream
+ * source. The order in this list reflects numbering of the properties i.e.
  *
- * loader-id.resource.loader.property = value
+ * plt;loader-idgt;.resource.loader.lt;propertygt; = 
lt;valuegt;/p
  */
-private  ArrayList sourceInitializerList = new ArrayList();
+private final List sourceInitializerList = new ArrayList();
 
 /**
- * Each loader needs a configuration object for
- * its initialization, this flags keeps track of whether
- * or not the configuration objects have been created
- * for the resource loaders.
+ * Has this Manager been initialized?
  */
-private  boolean resourceLoaderInitializersActive = false;
+private boolean isInit = false;
 
-/**
- *  switch to turn off log notice when a resource is found for
- *  the first time.
- */
-private  boolean logWhenFound = true;
+/** switch to turn off log notice when a resource is found for the first 
time. */
+private 

[jira] Assigned: (VELOCITY-24) calls to local macros not always made when template caching is off

2006-11-04 Thread Henning Schmiedehausen (JIRA)
 [ http://issues.apache.org/jira/browse/VELOCITY-24?page=all ]

Henning Schmiedehausen reassigned VELOCITY-24:
--

Assignee: Henning Schmiedehausen

 calls to local macros not always made when template caching is off
 --

 Key: VELOCITY-24
 URL: http://issues.apache.org/jira/browse/VELOCITY-24
 Project: Velocity
  Issue Type: Bug
  Components: Engine
Affects Versions: 1.5 beta1
 Environment: Operating System: other
 Platform: Other
Reporter: peterwlynch
 Assigned To: Henning Schmiedehausen
Priority: Blocker
 Fix For: 1.5


 In the latest nightly build Oct 28, 2001 and also in velocity 1.2 rc2 i 
 noticed 
 the following problem with autoreloading macros.
 Made a simple html page. added a simple one line macro that accepted one 
 param, 
 a letter
 something like
 ## local macro, not global
 #macro(letter $char)
 This is the letter $char
 #end
 #letter(A)
 #letter(B)
 #letter(C)
 etc to Z
 --
 The html page would be loaded in response to a form being submitted. If I 
 clicked on the submit button five times, quickly ( five separate submits), 
 most 
 times the final response would out put something like...
 
 This is the letter A
 This is the letter B
 This is the letter C
 This is the letter D
 This is the letter E
 #letter#letter#letter 
 #letter ..
 This is the letter Z
 As you can see, some macro calls did not get parsed.
 We were just happening to use velocity through turbine, but I don't think 
 that 
 affects the bug. Besides, the bug went away when the autoreload was false.
 Once scarab's runbox is back up, might be interesting to test this out on 
 their 
 macros too for comparison, although I don't see that they have any local 
 macros.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Resolved: (VELOCITY-24) calls to local macros not always made when template caching is off

2006-11-04 Thread Henning Schmiedehausen (JIRA)
 [ http://issues.apache.org/jira/browse/VELOCITY-24?page=all ]

Henning Schmiedehausen resolved VELOCITY-24.


Resolution: Fixed

getResource() must be synchronized. Yes, that sucks for applications that 
hammer on that and have caching off. Here are some numbers (running on my shiny 
new Core 2 Duo box, Tomcat and VelocityViewServlet running under the debugger)

ab -c 5 -n 1000 http://localhost:8080/testbed/templates/issues/velocity-24.vm

unsynced, caching off:

Document Path:  /testbed/templates/issues/velocity-24.vm
Document Length:663 bytes

Concurrency Level:  5
Time taken for tests:   4.193717 seconds
Complete requests:  1000
Failed requests:760   -- 
!!!
   (Connect: 0, Length: 760, Exceptions: 0)
Write errors:   0
Total transferred:  595970 bytes
HTML transferred:   449860 bytes
Requests per second:238.45 [#/sec] (mean)
Time per request:   20.969 [ms] (mean)
Time per request:   4.194 [ms] (mean, across all concurrent requests)
Transfer rate:  138.78 [Kbytes/sec] received

unsynced, cache on:

Document Path:  /testbed/templates/issues/velocity-24.vm
Document Length:663 bytes

Concurrency Level:  5
Time taken for tests:   0.479525 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  809809 bytes
HTML transferred:   663663 bytes
Requests per second:2085.40 [#/sec] (mean)
Time per request:   2.398 [ms] (mean)
Time per request:   0.480 [ms] (mean, across all concurrent requests)
Transfer rate:  1647.46 [Kbytes/sec] received

synced, cache off:

Document Path:  /testbed/templates/issues/velocity-24.vm
Document Length:663 bytes

Concurrency Level:  5
Time taken for tests:   11.92560 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  809000 bytes
HTML transferred:   663000 bytes
Requests per second:90.15 [#/sec] (mean)
Time per request:   55.463 [ms] (mean)
Time per request:   11.093 [ms] (mean, across all concurrent requests)
Transfer rate:  71.22 [Kbytes/sec] received

synced, cache on

Document Path:  /testbed/templates/issues/velocity-24.vm
Document Length:663 bytes

Concurrency Level:  5
Time taken for tests:   0.333444 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  810618 bytes
HTML transferred:   664326 bytes
Requests per second:2999.00 [#/sec] (mean)
Time per request:   1.667 [ms] (mean)
Time per request:   0.333 [ms] (mean, across all concurrent requests)
Transfer rate:  2372.21 [Kbytes/sec] received

The response time for cache on (which should be the normal production mode) is 
about the same level for synced and unsynced. But without cache, syncing makes 
the difference between fast but wrong and slower but correct. I personally 
opt for the latter.

 calls to local macros not always made when template caching is off
 --

 Key: VELOCITY-24
 URL: http://issues.apache.org/jira/browse/VELOCITY-24
 Project: Velocity
  Issue Type: Bug
  Components: Engine
Affects Versions: 1.5 beta1
 Environment: Operating System: other
 Platform: Other
Reporter: peterwlynch
 Assigned To: Henning Schmiedehausen
Priority: Blocker
 Fix For: 1.5


 In the latest nightly build Oct 28, 2001 and also in velocity 1.2 rc2 i 
 noticed 
 the following problem with autoreloading macros.
 Made a simple html page. added a simple one line macro that accepted one 
 param, 
 a letter
 something like
 ## local macro, not global
 #macro(letter $char)
 This is the letter $char
 #end
 #letter(A)
 #letter(B)
 #letter(C)
 etc to Z
 --
 The html page would be loaded in response to a form being submitted. If I 
 clicked on the submit button five times, quickly ( five separate submits), 
 most 
 times the final response would out put something like...
 
 This is the letter A
 This is the letter B
 This is the letter C
 This is the letter D
 This is the letter E
 #letter#letter#letter 
 #letter ..
 This is the letter Z
 As you can see, some macro calls did not get parsed.
 We were just happening to use velocity through turbine, but I don't think 
 that 
 affects the bug. Besides, the bug went away when the autoreload was false.
 Once scarab's runbox is back up, might be interesting to test this out on 
 their 
 macros too for comparison, although I don't see that they have any local 
 macros.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 

[jira] Assigned: (VELOCITY-414) Extend the MethodInvocation exception to be able to give the velocity macro writer a usefull error page

2006-11-04 Thread Henning Schmiedehausen (JIRA)
 [ http://issues.apache.org/jira/browse/VELOCITY-414?page=all ]

Henning Schmiedehausen reassigned VELOCITY-414:
---

Assignee: Henning Schmiedehausen

 Extend the MethodInvocation exception to be able to give the velocity macro 
 writer a usefull error page
 ---

 Key: VELOCITY-414
 URL: http://issues.apache.org/jira/browse/VELOCITY-414
 Project: Velocity
  Issue Type: Improvement
  Components: Source
Affects Versions: 1.5, 1.4
Reporter: Matthijs Lambooy
 Assigned To: Henning Schmiedehausen
 Fix For: 1.5


 We use velocity macros that invoke methods in a java written web engine.
 When an invoked method fails because of an exception,  it is not
 possible to use the
 MethodInvocation exception to give the velocity macro writer a usefull
 error page since the MethodInvocation Exception has not cause set.
 So to be short the reason why the method invocation failed can not be
 routed back to the veloticy macro writer on a running system.
 I extended the MethodInvocationException.java and the method execute in
 ASTMethod.java 
 proposed changes in MethodInvocationException.java : 
 ===
 package org.apache.velocity.exception; 
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.parser.Token;
 /*
  * 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.
  */
 /**
  *  Application-level exception thrown when a reference method is 
  *  invoked and an exception is thrown.
  *  br
  *  When this exception is thrown, a best effort will be made to have
  *  useful information in the exception's message.  For complete 
  *  information, consult the runtime log.
  *
  * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
  * @version $Id: MethodInvocationException.java,v 1.2.14.1 2004/03/03 
 23:22:54 geirm Exp $
  */
 public class MethodInvocationException extends VelocityException
 {
 private String methodName = ;
 private String referenceName = ;
 private Throwable wrapped = null;
 private int line; // Added by CX
 private int column; // Added by CX
 /**
  *  CTOR - wraps the passed in exception for
  *  examination later
  *
  *  @param message 
  *  @param e Throwable that we are wrapping
  *  @param methodName name of method that threw the exception
  */
 public MethodInvocationException( String message, Throwable e, String 
 methodName )
 {
 super(message);
 this.wrapped = e;
 this.methodName = methodName;
 }   
 /**
  *  Returns the name of the method that threw the
  *  exception
  *
  *  @return String name of method
  */
 public String getMethodName()
 {
 return methodName;
 }
 /**
  *  returns the wrapped Throwable that caused this
  *  MethodInvocationException to be thrown
  *  
  *  @return Throwable thrown by method invocation
  */
 public Throwable getWrappedThrowable()
 {
 return wrapped;
 }
 /**
  *  Sets the reference name that threw this exception
  *
  *  @param reference name of reference
  */
 public void setReferenceName( String ref )
 {
 referenceName = ref;
 }
 /**
  *  Retrieves the name of the reference that caused the 
  *  exception
  *
  *  @return name of reference
  */
 public String getReferenceName()
 {
 return referenceName;
 }
 /**
  *  Retrieves the line number where the error occured
  * 
  * @return line number
  */
   public int getLine() 
   {
   return line;
   }
   
 /**
  *  Sets the line number where the error occured
  *
  *  @param line
  */
   public void setLine(int line) 
   {
   this.line = line;
   }
   /**
* Retrieves the line number where the error occured
* 
* @return column number
*/
   public int getColumn() 
   {
   return column;
   }
   /**
*  Sets the column number where the error occured
*  
* @param column
*/
   

[jira] Commented: (VELOCITY-414) Extend the MethodInvocation exception to be able to give the velocity macro writer a usefull error page

2006-11-04 Thread Henning Schmiedehausen (JIRA)
[ 
http://issues.apache.org/jira/browse/VELOCITY-414?page=comments#action_12447181 
] 

Henning Schmiedehausen commented on VELOCITY-414:
-

Yes, and we actually have everything we need already in place (in form of 
ExtendedParseException).

 Extend the MethodInvocation exception to be able to give the velocity macro 
 writer a usefull error page
 ---

 Key: VELOCITY-414
 URL: http://issues.apache.org/jira/browse/VELOCITY-414
 Project: Velocity
  Issue Type: Improvement
  Components: Source
Affects Versions: 1.5, 1.4
Reporter: Matthijs Lambooy
 Assigned To: Henning Schmiedehausen
 Fix For: 1.5


 We use velocity macros that invoke methods in a java written web engine.
 When an invoked method fails because of an exception,  it is not
 possible to use the
 MethodInvocation exception to give the velocity macro writer a usefull
 error page since the MethodInvocation Exception has not cause set.
 So to be short the reason why the method invocation failed can not be
 routed back to the veloticy macro writer on a running system.
 I extended the MethodInvocationException.java and the method execute in
 ASTMethod.java 
 proposed changes in MethodInvocationException.java : 
 ===
 package org.apache.velocity.exception; 
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.parser.Token;
 /*
  * 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.
  */
 /**
  *  Application-level exception thrown when a reference method is 
  *  invoked and an exception is thrown.
  *  br
  *  When this exception is thrown, a best effort will be made to have
  *  useful information in the exception's message.  For complete 
  *  information, consult the runtime log.
  *
  * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
  * @version $Id: MethodInvocationException.java,v 1.2.14.1 2004/03/03 
 23:22:54 geirm Exp $
  */
 public class MethodInvocationException extends VelocityException
 {
 private String methodName = ;
 private String referenceName = ;
 private Throwable wrapped = null;
 private int line; // Added by CX
 private int column; // Added by CX
 /**
  *  CTOR - wraps the passed in exception for
  *  examination later
  *
  *  @param message 
  *  @param e Throwable that we are wrapping
  *  @param methodName name of method that threw the exception
  */
 public MethodInvocationException( String message, Throwable e, String 
 methodName )
 {
 super(message);
 this.wrapped = e;
 this.methodName = methodName;
 }   
 /**
  *  Returns the name of the method that threw the
  *  exception
  *
  *  @return String name of method
  */
 public String getMethodName()
 {
 return methodName;
 }
 /**
  *  returns the wrapped Throwable that caused this
  *  MethodInvocationException to be thrown
  *  
  *  @return Throwable thrown by method invocation
  */
 public Throwable getWrappedThrowable()
 {
 return wrapped;
 }
 /**
  *  Sets the reference name that threw this exception
  *
  *  @param reference name of reference
  */
 public void setReferenceName( String ref )
 {
 referenceName = ref;
 }
 /**
  *  Retrieves the name of the reference that caused the 
  *  exception
  *
  *  @return name of reference
  */
 public String getReferenceName()
 {
 return referenceName;
 }
 /**
  *  Retrieves the line number where the error occured
  * 
  * @return line number
  */
   public int getLine() 
   {
   return line;
   }
   
 /**
  *  Sets the line number where the error occured
  *
  *  @param line
  */
   public void setLine(int line) 
   {
   this.line = line;
   }
   /**
* Retrieves the line number where the error occured
* 
* @return column number
*/
   public int getColumn() 
   {
   return column;
   }
   /**
*  

svn commit: r471254 - in /jakarta/velocity/engine/trunk: ./ src/java/org/apache/velocity/exception/ src/java/org/apache/velocity/runtime/parser/node/

2006-11-04 Thread henning
Author: henning
Date: Sat Nov  4 12:11:29 2006
New Revision: 471254

URL: http://svn.apache.org/viewvc?view=revrev=471254
Log:
Reorganize the Throwable wrapping a bit (shuffle it up into VelocityException).
Add Template Name, Line Number and Column Number recording to 
MethodInvocationException
by implementing the ExtendedParseException interface thus allowing Velocity 
integrators
to retrieve the location and the template exactly and in the same way as with 
the other
parse exceptions. Resolves VELOCITY-414.

Modified:
jakarta/velocity/engine/trunk/CONTRIBUTORS

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/VelocityException.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/ASTMethod.java

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java

Modified: jakarta/velocity/engine/trunk/CONTRIBUTORS
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/CONTRIBUTORS?view=diffrev=471254r1=471253r2=471254
==
--- jakarta/velocity/engine/trunk/CONTRIBUTORS (original)
+++ jakarta/velocity/engine/trunk/CONTRIBUTORS Sat Nov  4 12:11:29 2006
@@ -25,6 +25,7 @@
 Leon Messerschmidt
 Llewellyn Falco
 Matt Raible
+Matthijs Lambooy
 Nathan Bubna   
 Paulo Gaspar
 Peter Romianowski

Modified: 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java?view=diffrev=471254r1=471253r2=471254
==
--- 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java
 (original)
+++ 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java
 Sat Nov  4 12:11:29 2006
@@ -1,5 +1,7 @@
 package org.apache.velocity.exception;
 
+import org.apache.commons.lang.StringUtils;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,10 +18,9 @@
  * 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.
+ * under the License.
  */
 
-import org.apache.velocity.util.ExceptionUtils;
 
 
 /**
@@ -33,16 +34,20 @@
  * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
  * @version $Id$
  */
-public class MethodInvocationException extends VelocityException
+public class MethodInvocationException extends VelocityException implements 
ExtendedParseException
 {
 /**
  * Version Id for serializable
  */
-private static final long serialVersionUID = 7305685093478106341L;
+private static final long serialVersionUID = 7305685093478106342L;
 
-private String methodName = ;
 private String referenceName = ;
-private Throwable wrapped = null;
+
+private final String methodName;
+
+private final int lineNumber;
+private final int columnNumber;
+private final String templateName;
 
 /**
  *  CTOR - wraps the passed in exception for
@@ -51,18 +56,21 @@
  *  @param message
  *  @param e Throwable that we are wrapping
  *  @param methodName name of method that threw the exception
+ *  @param templateName The name of the template where the exception 
occured.
  */
-public MethodInvocationException( String message, Throwable e, String 
methodName )
+public MethodInvocationException(final String message, final Throwable e, 
final String methodName, final String templateName, final int lineNumber, final 
int columnNumber)
 {
-super(message);
-this.wrapped = e;
-ExceptionUtils.setCause(this, e);
+super(message, e);
+
 this.methodName = methodName;
+this.templateName = templateName;
+this.lineNumber = lineNumber;
+this.columnNumber = columnNumber;
 }
 
 /**
  *  Returns the name of the method that threw the
- *  exception
+ *  exception.
  *
  *  @return String name of method
  */
@@ -72,34 +80,60 @@
 }
 
 /**
- *  returns the wrapped Throwable that caused this
- *  MethodInvocationException to be thrown
- *
- *  @return Throwable thrown by method invocation
- */
-public Throwable getWrappedThrowable()
-{
-return wrapped;
-}
-
-/**
- *  Sets the reference name that threw this exception
+ *  Sets the reference name that threw this exception.
  *
  *  

[jira] Commented: (VELOCITY-24) calls to local macros not always made when template caching is off

2006-11-04 Thread Will Glass-Husain (JIRA)
[ 
http://issues.apache.org/jira/browse/VELOCITY-24?page=comments#action_12447184 
] 

Will Glass-Husain commented on VELOCITY-24:
---

So, it cuts the speed in half for uncached operation?

Seems acceptable to me, since we offer a pretty good cache.

Nice work on tracking this down and solving it.  

 calls to local macros not always made when template caching is off
 --

 Key: VELOCITY-24
 URL: http://issues.apache.org/jira/browse/VELOCITY-24
 Project: Velocity
  Issue Type: Bug
  Components: Engine
Affects Versions: 1.5 beta1
 Environment: Operating System: other
 Platform: Other
Reporter: peterwlynch
 Assigned To: Henning Schmiedehausen
Priority: Blocker
 Fix For: 1.5


 In the latest nightly build Oct 28, 2001 and also in velocity 1.2 rc2 i 
 noticed 
 the following problem with autoreloading macros.
 Made a simple html page. added a simple one line macro that accepted one 
 param, 
 a letter
 something like
 ## local macro, not global
 #macro(letter $char)
 This is the letter $char
 #end
 #letter(A)
 #letter(B)
 #letter(C)
 etc to Z
 --
 The html page would be loaded in response to a form being submitted. If I 
 clicked on the submit button five times, quickly ( five separate submits), 
 most 
 times the final response would out put something like...
 
 This is the letter A
 This is the letter B
 This is the letter C
 This is the letter D
 This is the letter E
 #letter#letter#letter 
 #letter ..
 This is the letter Z
 As you can see, some macro calls did not get parsed.
 We were just happening to use velocity through turbine, but I don't think 
 that 
 affects the bug. Besides, the bug went away when the autoreload was false.
 Once scarab's runbox is back up, might be interesting to test this out on 
 their 
 macros too for comparison, although I don't see that they have any local 
 macros.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r471259 - in /jakarta/velocity/engine/trunk/src/java/org/apache/velocity: exception/ runtime/resource/loader/

2006-11-04 Thread henning
Author: henning
Date: Sat Nov  4 12:26:57 2006
New Revision: 471259

URL: http://svn.apache.org/viewvc?view=revrev=471259
Log:
Add C'Tors taking Throwable to ResourceNotFoundException. Clean up the
resource loaders using this (actually only one generates RNFE from another
exception but this is a good excuse to add some StringUtils sprinkling to 
String tests...

Modified:

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/ResourceNotFoundException.java

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/VelocityException.java

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.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/JarHolder.java

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java

Modified: 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/ResourceNotFoundException.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/ResourceNotFoundException.java?view=diffrev=471259r1=471258r2=471259
==
--- 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/ResourceNotFoundException.java
 (original)
+++ 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/ResourceNotFoundException.java
 Sat Nov  4 12:26:57 2006
@@ -39,10 +39,26 @@
 private static final long serialVersionUID = -4287732191458420347L;
 
 /**
- * @param exceptionMessage
+ * @see VelocityException#VelocityException(String)
  */
-public ResourceNotFoundException(String exceptionMessage)
+public ResourceNotFoundException(final String exceptionMessage)
 {
 super(exceptionMessage);
+}
+
+/**
+ * @see VelocityException#VelocityException(String, Throwable)
+ */
+public ResourceNotFoundException(final String exceptionMessage, final 
Throwable t)
+{
+super(exceptionMessage, t);
+}
+
+/**
+ * @see VelocityException#VelocityException(Throwable)
+ */
+public ResourceNotFoundException(final Throwable t)
+{
+super(t);
 }
 }

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=471259r1=471258r2=471259
==
--- 
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
 Sat Nov  4 12:26:57 2006
@@ -41,7 +41,7 @@
 /**
  * @param exceptionMessage The message to register.
  */
-public VelocityException(String exceptionMessage)
+public VelocityException(final String exceptionMessage)
 {
 super(exceptionMessage);
 wrapped = null;
@@ -49,10 +49,21 @@
 
 /**
  * @param exceptionMessage The message to register.
+ * @param throwable A throwable object that caused the Exception.
  */
 public VelocityException(final String exceptionMessage, final Throwable 
wrapped)
 {
 super(exceptionMessage);
+this.wrapped = wrapped;
+ExceptionUtils.setCause(this, wrapped);
+}
+
+/**
+ * @param throwable A throwable object that caused the Exception.
+ */
+public VelocityException(final Throwable wrapped)
+{
+super();
 this.wrapped = wrapped;
 ExceptionUtils.setCause(this, wrapped);
 }

Modified: 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java?view=diffrev=471259r1=471258r2=471259
==
--- 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
 (original)
+++ 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
 Sat Nov  4 12:26:57 2006
@@ -21,12 +21,12 @@
 
 import java.io.InputStream;
 
+import org.apache.commons.collections.ExtendedProperties;
+import org.apache.commons.lang.StringUtils;
+import 

[jira] Assigned: (VELOCITY-435) ParseErrorException not thrown with #macro parse error

2006-11-04 Thread Will Glass-Husain (JIRA)
 [ http://issues.apache.org/jira/browse/VELOCITY-435?page=all ]

Will Glass-Husain reassigned VELOCITY-435:
--

Assignee: Will Glass-Husain

 ParseErrorException not thrown with #macro parse error
 --

 Key: VELOCITY-435
 URL: http://issues.apache.org/jira/browse/VELOCITY-435
 Project: Velocity
  Issue Type: Bug
  Components: Engine
Affects Versions: 1.5
 Environment: Windows XP, JDK 1.4.2_09
Reporter: Malcolm Edgar
 Assigned To: Will Glass-Husain
 Fix For: 1.5

 Attachments: macroargumenterror.patch


 I have just been reviewing the new error handlingin Velocity 1.5-dev.
 One change I have observed it that an invalid macro call, passing 2
 arguments instead of one will log an error message:
 [Velocity] [error] VM #writeForm: error : too many arguments to macro.
 Wanted 1 got 2
 [Velocity] [error] VM error writeForm. Null AST
 However it will not throw an ParseErrorException like it used to in
 1.5-dev. Please see the example below for the earlier behaviour:
 http://www.sunvolt.com/click-examples/exception.htm?actionLink=brokenBorderLink#
 I prefer earlier approach, as the error is explicit. The new approach
 logs an error message, but beyond that you would not have known that
 an error occured. The #writeForm() call is not even rendered, as is
 done with an invalid object reference.
 regards Malcolm Edgar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Resolved: (VELOCITY-414) Extend the MethodInvocation exception to be able to give the velocity macro writer a usefull error page

2006-11-04 Thread Henning Schmiedehausen (JIRA)
 [ http://issues.apache.org/jira/browse/VELOCITY-414?page=all ]

Henning Schmiedehausen resolved VELOCITY-414.
-

Resolution: Fixed

Make MethodInvocationException implement ExtendedParseException thus giving it 
access to Template name, line number and column number. Not exactly the 
suggested patch but the same in spirit. Thanks for the suggestion!

 Extend the MethodInvocation exception to be able to give the velocity macro 
 writer a usefull error page
 ---

 Key: VELOCITY-414
 URL: http://issues.apache.org/jira/browse/VELOCITY-414
 Project: Velocity
  Issue Type: Improvement
  Components: Source
Affects Versions: 1.5, 1.4
Reporter: Matthijs Lambooy
 Assigned To: Henning Schmiedehausen
 Fix For: 1.5


 We use velocity macros that invoke methods in a java written web engine.
 When an invoked method fails because of an exception,  it is not
 possible to use the
 MethodInvocation exception to give the velocity macro writer a usefull
 error page since the MethodInvocation Exception has not cause set.
 So to be short the reason why the method invocation failed can not be
 routed back to the veloticy macro writer on a running system.
 I extended the MethodInvocationException.java and the method execute in
 ASTMethod.java 
 proposed changes in MethodInvocationException.java : 
 ===
 package org.apache.velocity.exception; 
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.parser.Token;
 /*
  * 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.
  */
 /**
  *  Application-level exception thrown when a reference method is 
  *  invoked and an exception is thrown.
  *  br
  *  When this exception is thrown, a best effort will be made to have
  *  useful information in the exception's message.  For complete 
  *  information, consult the runtime log.
  *
  * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
  * @version $Id: MethodInvocationException.java,v 1.2.14.1 2004/03/03 
 23:22:54 geirm Exp $
  */
 public class MethodInvocationException extends VelocityException
 {
 private String methodName = ;
 private String referenceName = ;
 private Throwable wrapped = null;
 private int line; // Added by CX
 private int column; // Added by CX
 /**
  *  CTOR - wraps the passed in exception for
  *  examination later
  *
  *  @param message 
  *  @param e Throwable that we are wrapping
  *  @param methodName name of method that threw the exception
  */
 public MethodInvocationException( String message, Throwable e, String 
 methodName )
 {
 super(message);
 this.wrapped = e;
 this.methodName = methodName;
 }   
 /**
  *  Returns the name of the method that threw the
  *  exception
  *
  *  @return String name of method
  */
 public String getMethodName()
 {
 return methodName;
 }
 /**
  *  returns the wrapped Throwable that caused this
  *  MethodInvocationException to be thrown
  *  
  *  @return Throwable thrown by method invocation
  */
 public Throwable getWrappedThrowable()
 {
 return wrapped;
 }
 /**
  *  Sets the reference name that threw this exception
  *
  *  @param reference name of reference
  */
 public void setReferenceName( String ref )
 {
 referenceName = ref;
 }
 /**
  *  Retrieves the name of the reference that caused the 
  *  exception
  *
  *  @return name of reference
  */
 public String getReferenceName()
 {
 return referenceName;
 }
 /**
  *  Retrieves the line number where the error occured
  * 
  * @return line number
  */
   public int getLine() 
   {
   return line;
   }
   
 /**
  *  Sets the line number where the error occured
  *
  *  @param line
  */
   public void setLine(int line) 
   {
   this.line = line;
   }
   /**
* Retrieves the line number where the error occured
* 
* @return column number
*/
 

svn commit: r471260 - in /jakarta/velocity/engine/trunk/src/java/org/apache/velocity: exception/VelocityException.java runtime/resource/ResourceManagerImpl.java

2006-11-04 Thread henning
Author: henning
Date: Sat Nov  4 12:37:20 2006
New Revision: 471260

URL: http://svn.apache.org/viewvc?view=revrev=471260
Log:
Javadoc fixes.


Modified:

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/exception/VelocityException.java

jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java

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=471260r1=471259r2=471260
==
--- 
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
 Sat Nov  4 12:37:20 2006
@@ -49,7 +49,7 @@
 
 /**
  * @param exceptionMessage The message to register.
- * @param throwable A throwable object that caused the Exception.
+ * @param wrapped A throwable object that caused the Exception.
  */
 public VelocityException(final String exceptionMessage, final Throwable 
wrapped)
 {
@@ -59,7 +59,7 @@
 }
 
 /**
- * @param throwable A throwable object that caused the Exception.
+ * @param wrapped A throwable object that caused the Exception.
  */
 public VelocityException(final Throwable wrapped)
 {

Modified: 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?view=diffrev=471260r1=471259r2=471260
==
--- 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 (original)
+++ 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 Sat Nov  4 12:37:20 2006
@@ -92,7 +92,7 @@
 /**
  * Initialize the ResourceManager.
  *
- * @param  rs  The Runtime Services object which is associated with this 
Resource Manager.
+ * @param  rsvc  The Runtime Services object which is associated with this 
Resource Manager.
  *
  * @throws  Exception
  */
@@ -621,4 +621,4 @@
 
 return null;
 }
-}
\ No newline at end of file
+}



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

2006-11-04 Thread wglass
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: 

[jira] Resolved: (VELOCITY-435) ParseErrorException not thrown with #macro parse error

2006-11-04 Thread Will Glass-Husain (JIRA)
 [ http://issues.apache.org/jira/browse/VELOCITY-435?page=all ]

Will Glass-Husain resolved VELOCITY-435.


Resolution: Fixed

Fix applied.  Need to set property velocimacro.arguments.strict to true for 
the exception to be thrown.  Thanks for the idea, Malcom!

 ParseErrorException not thrown with #macro parse error
 --

 Key: VELOCITY-435
 URL: http://issues.apache.org/jira/browse/VELOCITY-435
 Project: Velocity
  Issue Type: Bug
  Components: Engine
Affects Versions: 1.5
 Environment: Windows XP, JDK 1.4.2_09
Reporter: Malcolm Edgar
 Assigned To: Will Glass-Husain
 Fix For: 1.5

 Attachments: macroargumenterror.patch


 I have just been reviewing the new error handlingin Velocity 1.5-dev.
 One change I have observed it that an invalid macro call, passing 2
 arguments instead of one will log an error message:
 [Velocity] [error] VM #writeForm: error : too many arguments to macro.
 Wanted 1 got 2
 [Velocity] [error] VM error writeForm. Null AST
 However it will not throw an ParseErrorException like it used to in
 1.5-dev. Please see the example below for the earlier behaviour:
 http://www.sunvolt.com/click-examples/exception.htm?actionLink=brokenBorderLink#
 I prefer earlier approach, as the error is explicit. The new approach
 logs an error message, but beyond that you would not have known that
 an error occured. The #writeForm() call is not even rendered, as is
 done with an invalid object reference.
 regards Malcolm Edgar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (VELOCITY-413) Add Velocity 1.5 jar to DVSL

2006-11-04 Thread Will Glass-Husain (JIRA)
 [ http://issues.apache.org/jira/browse/VELOCITY-413?page=all ]

Will Glass-Husain updated VELOCITY-413:
---

  Summary: Add Velocity 1.5 jar to DVSL  (was: DVSL doesn't appear to 
work with Velocity 1.5)
Fix Version/s: (was: 1.5)

 Add Velocity 1.5 jar to DVSL
 

 Key: VELOCITY-413
 URL: http://issues.apache.org/jira/browse/VELOCITY-413
 Project: Velocity
  Issue Type: Bug
  Components: DVSL, Source
Affects Versions: 1.5
 Environment: WinXP Pro
Reporter: Nathan Bubna

 I tried to generate the docs for VelocityTools (which are generated via DVSL) 
 using a recent build of Velocity-1.5-dev, and the files DVSL generated were 
 empty.  No error messages were sent to std out and Ant considered the build 
 successful.
 Also, DVSL only appears to work with older versions of Dom4j (such as 1.1).  
 If used with Dom4j 1.6.1, then NoClassDefFoundErrors pop up.  It might be 
 good to upgrade DVSL, if possible.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r471374 - /jakarta/velocity/engine/trunk/xdocs/changes.xml

2006-11-04 Thread wglass
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]



synchronization of Template class

2006-11-04 Thread Will Glass-Husain

Henning--

Since you just dug into the synchronization issue, do you have any thoughts on

http://issues.apache.org/jira/browse/VELOCITY-383

?

WILL

--
Forio Business Simulations

Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: POLL - release beta 2?

2006-11-04 Thread Will Glass-Husain

We've a go-ahead to release Velocity 1.5 beta 2.  I haven't cast an
official vote yet, but mine is obviously +1.

+1
Malcolm Edgar
Matthijs Lambooy
Nathan Bubna
Henning P. Schmiedehausen
Will Glass-Husain

I'll go ahead and get things started.  I'd like to put a link to it on
the home page this time.

best,
WILL

On 11/1/06, Will Glass-Husain [EMAIL PROTECTED] wrote:

Hi,

I think we should release a beta 2 version of Velocity allowing
users to test out the recent spurt of bug fixes and improvements.  You
can see a report on improvements made during the recent Hackathon at
these links:

http://www.mail-archive.com/velocity-dev@jakarta.apache.org/msg15131.html
http://wiki.apache.org/jakarta-velocity/HackaThon2006

Opinions?

[ ] +1 Let's do Beta Two
[ ]  0 I don't care.
[ ] -1 No go

I'll collect votes till Saturday.

WILL




--
Forio Business Simulations

Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]