From fe35e10760ed21e19cbf521b04c3547c409e4d29 Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Mon, 19 Aug 2024 22:20:09 +0200 Subject: [PATCH] LDEV-4929 - set version --- .../CFMLExpressionInterpreter.java | 32 +++++++++++-------- loader/build.xml | 2 +- loader/pom.xml | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java b/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java index e4940c5c59..6d686ca04b 100755 --- a/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java +++ b/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java @@ -233,11 +233,11 @@ public Object interpret(PageContext pc, String str, boolean preciseMath) throws throw new InterpreterException("Syntax Error, invalid Expression " + getExceptionPosition(), getExceptionSnippet()); } - private String getExceptionPosition(){ - return "[" + cfml.getCurrent() + "] at position [" + cfml.getPos() + "]"; + private String getExceptionPosition() { + return "[" + cfml.getCurrent() + "] at position [" + cfml.getPos() + "]"; } - private String getExceptionSnippet(){ + private String getExceptionSnippet() { if (cfml.toString().length() > 1024) { if (cfml.getPos() > 1024) { int offset = cfml.getPos() - 10; @@ -1033,7 +1033,7 @@ else if ((str.length() - pos) <= 10) { throw new InterpreterException("Syntax Error, Invalid Construct", " at position " + (pos + 1) + " in [" + str + "]"); } -protected Ref json(FunctionLibFunction flf, char start, char end) throws PageException { + protected Ref json(FunctionLibFunction flf, char start, char end) throws PageException { if (!cfml.isCurrent(start)) return null; /* * String[] str = cfml.toString().split(","); if(cfml.getCurrent() == '{' && cfml.getNext() != '}' @@ -1057,14 +1057,16 @@ protected Ref json(FunctionLibFunction flf, char start, char end) throws PageExc if (flf == LITERAL_ARRAY) { if (args[0] instanceof LFunctionValue) { for (int i = 1; i < args.length; i++) { - if (!(args[i] instanceof LFunctionValue)) - throw new TemplateException("invalid argument for literal ordered struct, only named arguments are allowed like {name:\"value\",name2:\"value2\"}"); + if (!(args[i] instanceof LFunctionValue)) throw new TemplateException( + "invalid argument for literal ordered struct, only named arguments are allowed like {name:\"value\",name2:\"value2\"}" + getExceptionPosition(), + getExceptionSnippet()); } flf = LITERAL_ORDERED_STRUCT; } else { for (int i = 1; i < args.length; i++) { - if (args[i] instanceof LFunctionValue) throw new TemplateException("invalid argument for literal array, no named arguments are allowed"); + if (args[i] instanceof LFunctionValue) + throw new TemplateException("invalid argument for literal array, no named arguments are allowed " + getExceptionPosition(), getExceptionSnippet()); } } @@ -1120,7 +1122,8 @@ else if (cfml.isCurrent(quoter)) { str.append(cfml.getCurrent()); } } - if (!cfml.forwardIfCurrent(quoter)) throw new InterpreterException("Invalid String Literal Syntax Closing [" + quoter + "] not found " + getExceptionPosition(), getExceptionSnippet()); + if (!cfml.forwardIfCurrent(quoter)) + throw new InterpreterException("Invalid String Literal Syntax Closing [" + quoter + "] not found " + getExceptionPosition(), getExceptionSnippet()); comments(); mode = STATIC; @@ -1237,7 +1240,7 @@ private Ref dynamic() throws PageException { comments(); Ref ref = assignOp(); - if (!cfml.forwardIfCurrent(')')) throw new InterpreterException("Invalid Syntax Closing [)] not found " + getExceptionPosition(), getExceptionSnippet()); + if (!cfml.forwardIfCurrent(')')) throw new InterpreterException("Invalid Syntax Closing [)] not found " + getExceptionPosition(), getExceptionSnippet()); comments(); return limited ? ref : subDynamic(ref); } @@ -1300,7 +1303,8 @@ else if (cfml.forwardIfCurrent('[')) { comments(); if (cfml.isCurrent('(')) { - if (!(ref instanceof Set)) throw new InterpreterException("Invalid syntax " + ref.getTypeName() + " can't called as function " + getExceptionPosition(), getExceptionSnippet()); + if (!(ref instanceof Set)) + throw new InterpreterException("Invalid syntax " + ref.getTypeName() + " can't called as function " + getExceptionPosition(), getExceptionSnippet()); Set set = (Set) ref; ref = new UDFCall(set.getParent(pc), set.getKey(pc), functionArg(name, false, null, ')')); } @@ -1356,7 +1360,7 @@ private Ref newOp() throws PageException { if (cfml.forwardIfCurrent('.')) { comments(); name = identifier(true); - if (name == null) throw new InterpreterException("Invalid Component declaration " + getExceptionPosition(), getExceptionSnippet()); + if (name == null) throw new InterpreterException("Invalid Component declaration " + getExceptionPosition(), getExceptionSnippet()); comments(); fullName.append('.'); fullName.append(name); @@ -1495,7 +1499,8 @@ private Ref[] functionArg(String name, boolean checkLibrary, FunctionLibFunction max = flf.getArgMax(); // Dynamic if (isDynamic) { - if (max != -1 && max <= count) throw new InterpreterException("Too many Attributes in function [" + name + "] " + getExceptionPosition(), getExceptionSnippet()); + if (max != -1 && max <= count) + throw new InterpreterException("Too many Attributes in function [" + name + "] " + getExceptionPosition(), getExceptionSnippet()); } // Fix else { @@ -1530,7 +1535,8 @@ private Ref[] functionArg(String name, boolean checkLibrary, FunctionLibFunction } // check min attributes - if (checkLibrary && flf.getArgMin() > count) throw new InterpreterException("To few Attributes in function [" + name + "] " + getExceptionPosition(), getExceptionSnippet()); + if (checkLibrary && flf.getArgMin() > count) + throw new InterpreterException("To few Attributes in function [" + name + "] " + getExceptionPosition(), getExceptionSnippet()); comments(); return arr.toArray(new Ref[arr.size()]); diff --git a/loader/build.xml b/loader/build.xml index 15c23e8487..14648bcce2 100644 --- a/loader/build.xml +++ b/loader/build.xml @@ -2,7 +2,7 @@ - + diff --git a/loader/pom.xml b/loader/pom.xml index 754a703731..f44ab0e6bf 100644 --- a/loader/pom.xml +++ b/loader/pom.xml @@ -3,7 +3,7 @@ org.lucee lucee - 6.2.0.50-SNAPSHOT + 6.2.0.51-SNAPSHOT jar Lucee Loader Build