Skip to content

Commit

Permalink
LDEV-4896 - improve eeq method
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jun 16, 2024
1 parent 6816de5 commit ce54b61
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
20 changes: 17 additions & 3 deletions core/src/main/java/lucee/runtime/op/OpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -795,9 +795,23 @@ public static boolean nct(PageContext pc, Object left, Object right) throws Page
* @return
* @throws PageException
*/
public static boolean eeq(PageContext pc, Object left, Object right) throws PageException {
if (compare(pc, left, right) != 0) return false;
return Caster.toTypeName(left).equals(Caster.toTypeName(right));
public static boolean eeq(PageContext pc, Object left, Object right) {
// same object is a match
if (left == right) return true;
// not same type not a match
if (Caster.toTypeName(left).equals(Caster.toTypeName(right))) return false;

// simple vales - left and right have the same type
if (left instanceof String) return ((String) left).equalsIgnoreCase((String) right);
else if (left instanceof Number) return ((Number) left).equals(right);
else if (left instanceof Boolean) return ((Boolean) left).equals(right);
else if (left instanceof Date) return ((Date) left).equals(right);
else if (left instanceof Locale) return ((Locale) left).equals(right);
else if (left instanceof TimeZone) return ((TimeZone) left).equals(right);
else if (left instanceof Character) return ((Character) left).equals(right);
else if (left instanceof Calendar) return ((Calendar) left).equals(right);

return left == right;
}

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

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

0 comments on commit ce54b61

Please sign in to comment.