Apache Velocity Template engine : Message Getting Truncated - apache-velocity

I am using Apache velocity engine to parse a message . I am observing a behaviour
Correct Behaviour
Input
"message": "a: \nSaurabh" (there are 3 space between colon: and newline \n)
Output :
message :
a
Saurabh
Wrong Behaviour
Input
"message": "a:\nSaurabh" (There is no space between colon: and newline \n)
Output :
message :
a
The message is getting truncated . Can somebody help me understand this behaviour in apache velocity engine.
Template
Message:${message}
Does :\n refers to truncate ?

Related

How to use gherkin localization in Karate framework?

I want to use gherkin localization in Karate Framework.
English version of scenario works perfect. But with Russian version it looks like Karate FeatureParser doesn't know localized tags and fails. Here is the error log:
line 15:0 mismatched input '<EOF>' expecting {FEATURE_TAGS, FEATURE}
16:44:01.263 [main] ERROR com.intuit.karate.core.FeatureParser - syntax error: mismatched input '<EOF>' expecting {FEATURE_TAGS, FEATURE}
16:44:01.270 [main] ERROR com.intuit.karate.core.FeatureParser - not a valid feature file: src/test/java/ru.feature - mismatched input '<EOF>' expecting {FEATURE_TAGS, FEATURE}
Exception in thread "main" java.lang.RuntimeException: mismatched input '<EOF>' expecting {FEATURE_TAGS, FEATURE}
at com.intuit.karate.core.FeatureParser.<init>(FeatureParser.java:150)
at com.intuit.karate.core.FeatureParser.<init>(FeatureParser.java:126)
at com.intuit.karate.core.FeatureParser.parse(FeatureParser.java:69)
at com.intuit.karate.IdeUtils.exec(IdeUtils.java:61)
at cucumber.api.cli.Main.main(Main.java:36)
English version of feature file:
Feature: Services A and B
Background:
* url 'http://localhost:8080'
Scenario: call service A
Given path 'service-a'
And method get
Then status 200
Scenario: call service B
Given path 'service-b'
And method get
Then status 200
Russian version of feature file:
# language: ru
Функция: Сервисы А и Б
Контекст:
* адрес 'http://localhost:8080'
Сценарий: вызов сервиса А
Дано путь 'service-a'
И метод get
То статус 200
Сценарий: вызов сервиса B
Дано путь 'service-b'
И метод get
То статус 200
What should I do to fix it?
Yes, Karate does not support localization after we switched away from Cucumber in version 0.9.0.
We decided not to support localization because the goals of Karate are very different from Cucumber. Karate is more like a programming language, better explained here: https://stackoverflow.com/a/47799207/143475
So just like Java or JavaScript do not support localized keywords, Karate does not either. We haven't had any complaints so far :)

How to use token which contains XML strings in a website SetParameters.xml file on VSTS?

On VSTS, I use the "Replace Tokens" task to replace tokens in SetParameters.xml file with the VSTS variables. But I have variables which contains a XML string.
For example, with a VSTS variable which contains:
<string>aaa</string><string>bbb</string><string>ccc</string>
I got in the SetParameters.xml:
<setParameter name="FolderTreeStructureRootFullControl"
value="<string>aaa</string><string>bbb</string><string>ccc</string>" />
After, when I deploy the website with the "WinRM - IIS Web App Deployment" task, I have this error :
System.Exception: Error: '<', hexadecimal value 0x3C, is an invalid attribute character.
Is there a way to fix this error without replace all '<' and '>' characters by < and > escape strings ?
Thank you.
No, you can’t, I recommend that you can encode the value to base64 and decoding the value in the code.

ROBLOX Lua Error in script: '=' expected near '<eof>'

Hello I am writing a scipt on ROBLOX and I have encountered a problem.
function showVictoryMessage(playerName)
local message = Instance.new("Message")
message.Text = playerName .." has won!"
message.Parent = game.Workspace
wait (2)
message.Destroy()
end
Upon running this function, or more specifically the "message.Destroy" command, I get the error: Error in script: '=' expected near '< eof >'
I have never seen this error before, and the ROBLOX wiki page on Lua errors doesn't mention it.
I would very much appreciate help in this, because I don't personally know anyone who has coded in Lua.
Looks like a syntax error. message.Destroy() should be message:Destroy() according to this Roblox wiki page http://wiki.roblox.com/index.php?title=API:Class/Instance/Destroy
Also see the section Explosions, Messages, and More at URL http://wiki.roblox.com/index.php?title=Basic_Scripting which provides similar syntax using the colon (:) operator.
See also Difference between . and : in Lua and explanation of "possible side-effects of calculations/access are calculated only once" with colon notation.
Instead of message.Destroy() it should be message:Destroy()
Remember that '.' are used directory-wise and ":' are used for inbuilt functions.
WOOOOOOOO! It was a syntax error. The correct command is message:Destroy. Cause why would object.Destroy work and message.Destroy not?

Joomla - DateTime::__construct() [datetime.--construct]: Failed to parse time string

Since I develop under J3.2, I've got a recurrent error with the Joomla "calendar" field.
Once the field value is recorded in BDD with the sql format : "Y-m-d H:i:s", I've got an error 500 when I open the form for edit my content.
DateTime::__construct() [datetime.--construct]: Failed to parse time string (2014-10-17 10-28-58) at position 11 (1): Unexpected character
The component K2 and all these associated extension are disabled.
It appear that the parser have a problem with the empty string between the date and the time.
Is anybody can give me a solution ??
Thankz by advance for your help !
Mickael
I found my mistake : the format string of my calendar field was bad.
I used "Y-m-d H-i-s" instead of "Y-m-d H:i:s"

Json string more than 524288 exception

I try to parse a huge json file, it's more that 524288 characters and I can't parse it with groovy and haven't text of exception. Is it a known issue, is there any workaround?
Can it be limitation of tomcat?
Update:
I've got an exception:
ERROR (org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver) - JSONException occurred when processing request: [POST] /person/parsePersonJson
Expected a ',' or ']' at character 524288 of ...
Update2:
in grails I used:
JSON.parse(params.myJson)
Changed tomcat settings of maxPostSize to "0"
It may concern to value of configured POST parameter size in Tomcat (maxPostSize). You should refer to this documentation: http://tomcat.apache.org/tomcat-5.5-doc/config/http.html (keyword: "maxPostSize") for more explanation. Then you can try to increase that value. Hope this helps!
It was a problem with input size. Max input size by specification is 512k

Resources