You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Will Glass-Husain (JIRA)" <ji...@apache.org> on 2005/11/17 21:01:41 UTC

[jira] Resolved: (VELOCITY-126) String containing '##' is treated as unterminated String.

     [ http://issues.apache.org/jira/browse/VELOCITY-126?page=all ]
     
Will Glass-Husain resolved VELOCITY-126:
----------------------------------------

    Resolution: Fixed
     Assign To:     (was: Velocity-Dev List)

After thinking about this, I believe we should keep the intent of current behavior.  Comments are interpreted in double quote strings and ignored in single quote strings.  I agree with Claude this is a little odd, but there's a certain logic there none the less.  Regardless, we can't change it as existing users may depend on this behavior.

There was an additional problem that caused the exception.  The final character before the ## was being chopped off.  I've fixed this bug which should remove the exception.  I also added more test cases into "interpolation.vm" to test different situations.

"test##test" => "test"
'test##test' => 'test##test'
"######" => ""

My advice is to use single quotes when you want ## symbols to appear in a String.

> String containing '##' is treated as unterminated String.
> ---------------------------------------------------------
>
>          Key: VELOCITY-126
>          URL: http://issues.apache.org/jira/browse/VELOCITY-126
>      Project: Velocity
>         Type: Bug
>   Components: Source
>     Versions: 1.5
>  Environment: Operating System: All
> Platform: All
>     Reporter: Jimmy Wan
>      Fix For: 1.5

>
> The following template snippet
> ${System_err.println("###############################################")}
> Results in this output:
> [INFO,STDERR] [rrd] 1042589262000 Error in interpolating string literal : 
> org.apache.velocity.runtime.parser.ParseException: Lexical error: 
> org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 1, 
> column 49.  Encountered: <EOF> after : ""
> If you're wondering what I'm doing, I've got System.err passed into velocity as 
> System_err

-- 
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: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org