Skip to content

Commit

Permalink
LDEV-4929 - set version
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Aug 19, 2024
1 parent 7f0d5c6 commit fe35e10
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() != '}'
Expand All @@ -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());
}

}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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, ')'));
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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()]);
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.2.0.50-SNAPSHOT"/>
<property name="version" value="6.2.0.51-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.2.0.50-SNAPSHOT</version>
<version>6.2.0.51-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit fe35e10

Please sign in to comment.