You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
com.schibsted.spt.data.jslt.JsltException: Parse error: Encountered " "," ", "" at line 33, column 3.
Was expecting one of:
"]" ...
":" ...
"or" ...
"and" ...
"==" ...
"!=" ...
">=" ...
">" ...
"<" ...
"<=" ...
"+" ...
"-" ...
"*" ...
"/" ...
"|" ...
at :33:2
at com.schibsted.spt.data.jslt.parser.ParserImpl.compileExpression(ParserImpl.java:62)
at com.schibsted.spt.data.jslt.Parser.compile(Parser.java:226)
at com.schibsted.spt.data.jslt.Parser.compileString(Parser.java:86)
at com.atex.integration.camel.jslt.TestJsltCustomFunctions.callParser(TestJsltCustomFunctions.java:195)
at com.atex.integration.camel.jslt.TestJsltCustomFunctions.testLoadingFromTestJSLTNotReady(TestJsltCustomFunctions.java:129)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
`
However, add the line: let dummy=true
at line 6, after the last let statement, and it compiles OK.
/*
JSLT Function to lookup a property from a given security parent
*/
public class PropertyLookupFunction extends AbstractFunction {
private PropertyProvider provider;
public PropertyLookupFunction(PropertyProvider provider) {
super("property-lookup", 2, 99);
this.provider = provider;
}
@Override
public JsonNode call(final JsonNode jsonNode, final JsonNode[] params) {
String siteId = params[0].textValue();
String key= params[1].textValue();
String value = null;
try {
value = provider.getProperty(siteId, key);
} catch (CMException e) {
e.printStackTrace();
}
if (value == null) {
if (params.length > 2) {
for (int i = 2; i < params.length;i++) {
String val = params[i].textValue();
if (StringUtils.isNotBlank(val)) {
value = val;
break;
}
}
}
}
return value == null ? NullNode.instance : new TextNode(value);
}
}
The text was updated successfully, but these errors were encountered:
Actually, the bug appears to be the use of the array object. The use case is to take a single document and convert into an array of documents. Removing the "[" opening bracket solves the compilation, as does add a dummy let statement without a function.
So the combination of "[" and a function is breaking the parser somewhow.
I tried debugging, but I ran out of time,
The following JSLT fails:
with:
`
com.schibsted.spt.data.jslt.JsltException: Parse error: Encountered " "," ", "" at line 33, column 3.
Was expecting one of:
"]" ...
":" ...
"or" ...
"and" ...
"==" ...
"!=" ...
">=" ...
">" ...
"<" ...
"<=" ...
"+" ...
"-" ...
"*" ...
"/" ...
"|" ...
at :33:2
`
However, add the line:
let dummy=true
at line 6, after the last let statement, and it compiles OK.
The text was updated successfully, but these errors were encountered: