Skip to content

Commit

Permalink
fix default type defintion
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Dec 9, 2024
1 parent 86c1fdf commit 16f9252
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ public static Struct call(PageContext pc, String type, UDF onMissingKey) throws
}

public static int toType(String type) throws ApplicationException {
int res = toType(type, Struct.TYPE_UNDEFINED);
if (res == Struct.TYPE_UNDEFINED)
throw new ApplicationException("valid struct types are [normal, weak, linked, soft, synchronized,ordered-casesensitive,casesensitive,max:<number>]");
return res;
}

public static int toType(String type, int defaultValue) {
if (type == null) return defaultValue;
type = type.toLowerCase();
if (type.equals("linked")) return Struct.TYPE_LINKED;
else if (type.equals("ordered")) return Struct.TYPE_LINKED;
Expand All @@ -82,7 +90,7 @@ public static int toType(String type) throws ApplicationException {
else if (type.equals("ordered-casesensitive")) return StructImpl.TYPE_LINKED_CASESENSITIVE;
else if (type.equals("casesensitive")) return StructImpl.TYPE_CASESENSITIVE;
else if (type.startsWith("max:")) return StructImpl.TYPE_MAX;
else throw new ApplicationException("valid struct types are [normal, weak, linked, soft, synchronized,ordered-casesensitive,casesensitive,max:<number>]");
else return defaultValue;

}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/lucee/runtime/type/StructImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import lucee.runtime.dump.DumpProperties;
import lucee.runtime.exp.ExpressionException;
import lucee.runtime.exp.PageException;
import lucee.runtime.op.Caster;
import lucee.runtime.functions.struct.StructNew;
import lucee.runtime.op.Duplicator;
import lucee.runtime.op.ThreadLocalDuplication;
import lucee.runtime.type.it.StringIterator;
Expand Down Expand Up @@ -71,7 +71,7 @@ public class StructImpl extends StructSupport {
public static final int DEFAULT_TYPE;

static {
DEFAULT_TYPE = Caster.toIntValue(SystemUtil.getSystemPropOrEnvVar("lucee.struct.type", null), TYPE_REGULAR);
DEFAULT_TYPE = StructNew.toType(SystemUtil.getSystemPropOrEnvVar("lucee.struct.type", null), TYPE_REGULAR);
}

/**
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.193-SNAPSHOT"/>
<property name="version" value="6.2.0.194-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.193-SNAPSHOT</version>
<version>6.2.0.194-SNAPSHOT</version>
<packaging>jar</packaging>

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

0 comments on commit 16f9252

Please sign in to comment.