[jira] [Created] (VELOCITY-893) Calling macro with closing brace on newline throws ParseErrorException
Steve O'Hara created VELOCITY-893: - Summary: Calling macro with closing brace on newline throws ParseErrorException Key: VELOCITY-893 URL: https://issues.apache.org/jira/browse/VELOCITY-893 Project: Velocity Issue Type: Bug Components: Engine Affects Versions: 2.0 Environment: V2.0, line whitespace gobbling Reporter: Steve O'Hara This is a regression from 1.7. {code:java} #macroLayoutPlanner( "planWidget" "false" [ "plannerConfigs_controlBarConfigs,$PaletteOvrd, layoutPlanWidgetAdditions" ], $Props, ${PlanEntity.SVGContent} ) {code} This fails because the closing bracket is on a new line. {code} 2018-05-30 19:00:54 ERROR filter.RequestFilter - org.springframework.core.NestedIOException: Could not load Velocity template for URL [widgets/layoutplanner.vm]; nested exception is org.apache.velocity.exception.ParseErrorException: Encountered ")" at widgets/layoutplanner.vm[line 144, column 17] Was expecting one of: "," ... "##" ... ... ... {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org
[jira] [Created] (VELOCITY-892) Method arguments conversions should be based on Type instead of Class
Thomas Mortagne created VELOCITY-892: Summary: Method arguments conversions should be based on Type instead of Class Key: VELOCITY-892 URL: https://issues.apache.org/jira/browse/VELOCITY-892 Project: Velocity Issue Type: Improvement Components: Engine Affects Versions: 2.0 Reporter: Thomas Mortagne Fix For: 2.0 I was happy to see that method arguments conversion has been added to 2.0 so that I can remove the uberspector we have on XWiki side but unfortunately ConversionHandler is limited to classes which is way too restrictive for us (for example if the parameter type is List it won't do the same thing than if the type is List). Our uberspector can be found on https://github.com/xwiki/xwiki-commons/blob/master/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/MethodArgumentsUberspector.java to see what we do exactly. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org
Re: [jira] [Commented] (VELOCITY-891) Upgrade to v2.0 causes parser failures
Have you tried {{#set ($JQId = '#' + $Utils.getJQuerySelector($SparklineElementId))}} eg #set ($ok = '#' + 'ok') $ok then outputs #ok #set ($ok = "#" + 'ok') gives Failed to parse String literal at 2f336dfc-5fee-4e00-a58d-1b5a54729690:standard[line 1, column 13] org.apache.velocity.exception.ParseErrorException On 30 May 2018 at 15:09, Steve O'Hara (JIRA) wrote: > > [ https://issues.apache.org/jira/browse/VELOCITY-891?page= > com.atlassian.jira.plugin.system.issuetabpanels:comment- > tabpanel=16495207#comment-16495207 ] > > Steve O'Hara commented on VELOCITY-891: > --- > > Added the stack trace to the description. > > > Upgrade to v2.0 causes parser failures > > -- > > > > Key: VELOCITY-891 > > URL: https://issues.apache.org/jira/browse/VELOCITY-891 > > Project: Velocity > > Issue Type: Bug > > Components: Engine > >Affects Versions: 2.0 > >Reporter: Steve O'Hara > >Priority: Major > > > > We are upgrading from v1.7 to v2.0 but have come across a problem almost > immediately. > > Our templates can contain a lot of Javascript with references to things > that begin with the '#' character e.g. Kendo JS templates. These used to be > ignored by 1.7 but now they are causing parser failures as follows; > > {{#set ($JQId = "#" + $Utils.getJQuerySelector($SparklineElementId))}} > > {{org.apache.velocity.exception.ParseErrorException: Failed to parse > String literal}} > > It is complaining about the {{"#"}} > > I can't find any directive that switches this off or a way to circumvent > it. > > A workaround is to replace the '#' with {{$HASH}} but we have thousands > of these and no way of fixing the end-user commited templates. > > {code:java} > > 2018-05-30 15:07:30 ERROR context.ContextLoader - Context initialization > failed > > org.springframework.beans.factory.BeanCreationException: Error creating > bean with name 'velocityConfig' defined in ServletContext resource > [/WEB-INF/applicationContext.xml]: Invocation of init method failed; > nested exception is org.apache.velocity.exception.VelocityException: > Velocimacro: Error using VM library: ../macros/macros-forms.vm > > at org.springframework.beans.factory.support. > AbstractAutowireCapableBeanFactory.initializeBean( > AbstractAutowireCapableBeanFactory.java:1514) > > at org.springframework.beans.factory.support. > AbstractAutowireCapableBeanFactory.doCreateBean( > AbstractAutowireCapableBeanFactory.java:519) > > at org.springframework.beans.factory.support. > AbstractAutowireCapableBeanFactory.createBean( > AbstractAutowireCapableBeanFactory.java:456) > > at org.springframework.beans.factory.support. > AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) > > at org.springframework.beans.factory.support. > DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry. > java:223) > > at org.springframework.beans.factory.support. > AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) > > at org.springframework.beans.factory.support. > AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) > > at org.springframework.beans.factory.support. > DefaultListableBeanFactory.preInstantiateSingletons( > DefaultListableBeanFactory.java:638) > > at org.springframework.context.support.AbstractApplicationContext. > finishBeanFactoryInitialization(AbstractApplicationContext.java:942) > > at org.springframework.context.support.AbstractApplicationContext. > refresh(AbstractApplicationContext.java:482) > > at org.springframework.web.context.ContextLoader. > configureAndRefreshWebApplicationContext(ContextLoader.java:410) > > at org.springframework.web.context.ContextLoader. > initWebApplicationContext(ContextLoader.java:306) > > at org.springframework.web.context.ContextLoaderListener. > contextInitialized(ContextLoaderListener.java:112) > > at com._4ng.web.servlet.Initialisation.contextInitialized( > Initialisation.java:175) > > at org.apache.catalina.core.StandardContext.listenerStart( > StandardContext.java:4745) > > at org.apache.catalina.core.StandardContext.startInternal( > StandardContext.java:5207) > > at org.apache.catalina.util.LifecycleBase.start( > LifecycleBase.java:150) > > 30-May-2018 15:07:30.618 SEVERE [null Initialisation] > org.apache.catalina.core.StandardContext.startInternal One or more > listeners failed to start. Full details will be found in the appropriate > container log file > > at org.apache.catalina.core.ContainerBase.addChildInternal( > ContainerBase.java:752) > > 30-May-2018 15:07:30.621 SEVERE [null Initialisation] > org.apache.catalina.core.StandardContext.startInternal Context [] startup > failed due to previous errors > > at org.apache.catalina.core.ContainerBase.addChild( > ContainerBase.java:728) > > at
[jira] [Commented] (VELOCITY-891) Upgrade to v2.0 causes parser failures
[ https://issues.apache.org/jira/browse/VELOCITY-891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16495207#comment-16495207 ] Steve O'Hara commented on VELOCITY-891: --- Added the stack trace to the description. > Upgrade to v2.0 causes parser failures > -- > > Key: VELOCITY-891 > URL: https://issues.apache.org/jira/browse/VELOCITY-891 > Project: Velocity > Issue Type: Bug > Components: Engine >Affects Versions: 2.0 >Reporter: Steve O'Hara >Priority: Major > > We are upgrading from v1.7 to v2.0 but have come across a problem almost > immediately. > Our templates can contain a lot of Javascript with references to things that > begin with the '#' character e.g. Kendo JS templates. These used to be > ignored by 1.7 but now they are causing parser failures as follows; > {{#set ($JQId = "#" + $Utils.getJQuerySelector($SparklineElementId))}} > {{org.apache.velocity.exception.ParseErrorException: Failed to parse String > literal}} > It is complaining about the {{"#"}} > I can't find any directive that switches this off or a way to circumvent it. > A workaround is to replace the '#' with {{$HASH}} but we have thousands of > these and no way of fixing the end-user commited templates. > {code:java} > 2018-05-30 15:07:30 ERROR context.ContextLoader - Context initialization > failed > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'velocityConfig' defined in ServletContext resource > [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested > exception is org.apache.velocity.exception.VelocityException: Velocimacro: > Error using VM library: ../macros/macros-forms.vm > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) > at > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:638) > at > org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942) > at > org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) > at > org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) > at > org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) > at > org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) > at > com._4ng.web.servlet.Initialisation.contextInitialized(Initialisation.java:175) > at > org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) > at > org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) > 30-May-2018 15:07:30.618 SEVERE [null Initialisation] > org.apache.catalina.core.StandardContext.startInternal One or more listeners > failed to start. Full details will be found in the appropriate container log > file > at > org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) > 30-May-2018 15:07:30.621 SEVERE [null Initialisation] > org.apache.catalina.core.StandardContext.startInternal Context [] startup > failed due to previous errors > at > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) > at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) > at > org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at >
[jira] [Updated] (VELOCITY-891) Upgrade to v2.0 causes parser failures
[ https://issues.apache.org/jira/browse/VELOCITY-891?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Steve O'Hara updated VELOCITY-891: -- Description: We are upgrading from v1.7 to v2.0 but have come across a problem almost immediately. Our templates can contain a lot of Javascript with references to things that begin with the '#' character e.g. Kendo JS templates. These used to be ignored by 1.7 but now they are causing parser failures as follows; {{#set ($JQId = "#" + $Utils.getJQuerySelector($SparklineElementId))}} {{org.apache.velocity.exception.ParseErrorException: Failed to parse String literal}} It is complaining about the {{"#"}} I can't find any directive that switches this off or a way to circumvent it. A workaround is to replace the '#' with {{$HASH}} but we have thousands of these and no way of fixing the end-user commited templates. {code:java} 2018-05-30 15:07:30 ERROR context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'velocityConfig' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.apache.velocity.exception.VelocityException: Velocimacro: Error using VM library: ../macros/macros-forms.vm at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:638) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at com._4ng.web.servlet.Initialisation.contextInitialized(Initialisation.java:175) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 30-May-2018 15:07:30.618 SEVERE [null Initialisation] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) 30-May-2018 15:07:30.621 SEVERE [null Initialisation] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)