{RETIRED} XWiki Enterprise
  1. {RETIRED} XWiki Enterprise
  2. XE-767

Error with Apostrophe in Space Title or Page Title

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.7 RC1, 2.6.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      2003 Server, HSQDB (BDD), Jetty (Web Engine).
      IE 7 & FireFox 3.5.7
    • keywords:
      apostrophe, space, Title
    • Similar issues:

      Description

      Hi,

      When I created a Space or Page with " ' " in title for exemple I create a Space with name(TEST with ') and I post it. I have an error in Dashboard with Activity Stream (Failed to execute the [velocity] macro).

      In xwiki.log I have this :

      2010-12-02 14:35:32,166 http://srv0067:8080/xwiki/bin/view/Main/ ERROR hql.PARSER - line 1:119: unexpected token: ' and act.space<>'
      2010-12-02 14:35:32,166 http://srv0067:8080/xwiki/bin/view/Main/ ERROR internal.DefaultVelocityEngine - Exception in macro #displayActivity at unknown namespace[line 2, column 1]

      In Dashboard I have this :

      org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [html
      #displayActivity()
      /html]
      at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:125)
      at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:44)
      at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:298)
      at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:190)
      at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:57)
      at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transformOnce(MacroTransformation.java:184)
      at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:129)
      at org.xwiki.rendering.internal.macro.wikibridge.DefaultWikiMacro.execute(DefaultWikiMacro.java:207)
      at org.xwiki.rendering.internal.macro.wikibridge.DefaultWikiMacro.execute(DefaultWikiMacro.java:55)
      at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transformOnce(MacroTransformation.java:184)
      at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:129)
      at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:72)
      at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:7409)
      at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:7358)
      at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:831)
      at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:782)
      at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:874)
      at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:537)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
      at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
      at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
      at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:493)
      at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
      at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:196)
      at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:161)
      at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116)
      at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1874)
      at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1812)
      at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:896)
      at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
      at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
      at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
      at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:332)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212)
      at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:196)
      at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:161)
      at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116)
      at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1922)
      at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1844)
      at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:155)
      at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:226)
      at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:117)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
      at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:129)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:218)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:326)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
      at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:915)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with id [unknown namespace]
      at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:205)
      at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:161)
      at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:118)
      ... 98 more
      Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'searchEvents' in class com.xpn.xwiki.plugin.activitystream.plugin.ActivityStreamPluginApi threw exception com.xpn.xwiki.plugin.activitystream.api.ActivityStreamException: Error number 3223 in 3: Error number 3223 in 3: Exception while searching documents with sql select act from ActivityEventImpl as act where act.page=TEST with .WebHome and act.space<>Scheduler and month(date)=12 and year(date)=2010 and day(date)=2 and 1=1 and act.wiki in (xwiki) and not (act.version not like %.1 and act.type = update) order by act.date desc
      Wrapped Exception: unexpected char: % [select act from com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl as act where act.page=TEST with .WebHome and act.space<>Scheduler and month(date)=12 and year(date)=2010 and day(date)=2 and 1=1 and act.wiki in (xwiki) and not (act.version not like %.1 and act.type = update) order by act.date desc]
      Wrapped Exception: unexpected char: '%' [select act from com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl as act where act.page='TEST with '.WebHome' and act.space<>'Scheduler' and month(date)=12 and year(date)=2010 and day(date)=2 and 1=1 and act.wiki in ('xwiki') and not (act.version not like '%.1' and act.type = 'update') order by act.date desc] at unknown namespace[line 647, column 37]
      at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
      at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
      at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
      at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:493)
      at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
      at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:366)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212)
      at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:196)
      ... 100 more
      Caused by: com.xpn.xwiki.plugin.activitystream.api.ActivityStreamException: Error number 3223 in 3: Error number 3223 in 3: Exception while searching documents with sql select act from ActivityEventImpl as act where act.page=TEST with .WebHome and act.space<>Scheduler and month(date)=12 and year(date)=2010 and day(date)=2 and 1=1 and act.wiki in (xwiki) and not (act.version not like %.1 and act.type = update) order by act.date desc
      Wrapped Exception: unexpected char: % [select act from com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl as act where act.page=TEST with .WebHome and act.space<>Scheduler and month(date)=12 and year(date)=2010 and day(date)=2 and 1=1 and act.wiki in (xwiki) and not (act.version not like %.1 and act.type = update) order by act.date desc]
      Wrapped Exception: unexpected char: '%' [select act from com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl as act where act.page='TEST with '.WebHome' and act.space<>'Scheduler' and month(date)=12 and year(date)=2010 and day(date)=2 and 1=1 and act.wiki in ('xwiki') and not (act.version not like '%.1' and act.type = 'update') order by act.date desc]
      at com.xpn.xwiki.plugin.activitystream.impl.ActivityStreamImpl.searchEvents(ActivityStreamImpl.java:678)
      at com.xpn.xwiki.plugin.activitystream.impl.ActivityStreamImpl.searchEvents(ActivityStreamImpl.java:634)
      at com.xpn.xwiki.plugin.activitystream.impl.ActivityStreamImpl.searchEvents(ActivityStreamImpl.java:616)
      at com.xpn.xwiki.plugin.activitystream.impl.ActivityStreamImpl.searchEvents(ActivityStreamImpl.java:589)
      at com.xpn.xwiki.plugin.activitystream.plugin.ActivityStreamPluginApi.searchEvents(ActivityStreamPluginApi.java:239)
      at sun.reflect.GeneratedMethodAccessor243.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
      at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
      ... 117 more

        Activity

        Hide
        Jerome added a comment -

        Yes, the Aspostrophe don't display in IE 7.
        But when I post a Page with " ' ", I have a Velocity Macro error in 'Activity Stream'. Claudio Coreggioli have an error too with velocity Macro?

        Show
        Jerome added a comment - Yes, the Aspostrophe don't display in IE 7. But when I post a Page with " ' ", I have a Velocity Macro error in 'Activity Stream'. Claudio Coreggioli have an error too with velocity Macro?
        Hide
        Sergiu Dumitriu added a comment -

        No, I accidentally linked the other issue before actually reading the issue description. This is a different issue than XWIKI-5514.

        Show
        Sergiu Dumitriu added a comment - No, I accidentally linked the other issue before actually reading the issue description. This is a different issue than XWIKI-5514 .
        Hide
        Vincent Massol added a comment - - edited

        The problem is that there's no escaping done in Main.Activity nor in ActivityStreamImpl:

        vmassol@wiki $ grep searchEvents src/main/resources/Main/Activity.xml 
           #set($events= $xwiki.activitystream.searchEvents("act.page='$pageName' and act.space&lt;&gt;'Scheduler' $!whereClause", false, 0, 0))
        

        Actually the problem is that Main.Activity is not using searchEvents correctly: it should pass parameter values and use a parametrized query instead:

            public List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, boolean globalSearch, int nb,
                int start, List<Object> parameterValues, XWikiContext context) throws ActivityStreamException
        
        Show
        Vincent Massol added a comment - - edited The problem is that there's no escaping done in Main.Activity nor in ActivityStreamImpl: vmassol@wiki $ grep searchEvents src/main/resources/Main/Activity.xml #set($events= $xwiki.activitystream.searchEvents("act.page='$pageName' and act.space&lt;&gt;'Scheduler' $!whereClause", false, 0, 0)) Actually the problem is that Main.Activity is not using searchEvents correctly: it should pass parameter values and use a parametrized query instead: public List<ActivityEvent> searchEvents(String fromHql, String hql, boolean filter, boolean globalSearch, int nb, int start, List<Object> parameterValues, XWikiContext context) throws ActivityStreamException
        Hide
        Vincent Massol added a comment -

        Fixed for the page name but the whole call needs to be reviewed to verify if we need more parameters. The code is quite bad right now with a lot of string concatenation (yuck!).

        Show
        Vincent Massol added a comment - Fixed for the page name but the whole call needs to be reviewed to verify if we need more parameters. The code is quite bad right now with a lot of string concatenation (yuck!).
        Hide
        Jerome added a comment -

        Yes, Thanks for all. This revision correct this error.

        Show
        Jerome added a comment - Yes, Thanks for all. This revision correct this error.

          People

          • Assignee:
            Vincent Massol
            Reporter:
            Jerome
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Date of First Response: