Skip to content

Commit

Permalink
Merge branch '6.2' into 7.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	core/src/main/java/lucee/runtime/config/ConfigWebFactory.java
#	loader/build.xml
#	loader/pom.xml
  • Loading branch information
michaeloffner committed Dec 13, 2024
2 parents 9fb8d36 + 4b37063 commit 42b5a45
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 26 deletions.
8 changes: 8 additions & 0 deletions core/src/main/java/lucee/runtime/config/ConfigImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5288,10 +5288,18 @@ public int getCFMLWriterType() {
if (StringUtil.isEmpty(str)) {
str = ConfigFactoryImpl.getAttr(root, "cfmlWriter");
}

// CB compatibility
if (StringUtil.isEmpty(str, true)) {
str = ConfigFactoryImpl.getAttr(root, "whitespaceManagement");
}

if (!StringUtil.isEmpty(str, true)) {
str = str.trim();
if ("white-space".equalsIgnoreCase(str)) writerType = ConfigPro.CFML_WRITER_WS;
else if ("simple".equalsIgnoreCase(str)) writerType = ConfigPro.CFML_WRITER_WS;
else if ("white-space-pref".equalsIgnoreCase(str)) writerType = ConfigPro.CFML_WRITER_WS_PREF;
else if ("snart".equalsIgnoreCase(str)) writerType = ConfigPro.CFML_WRITER_WS_PREF;
else if ("regular".equalsIgnoreCase(str)) writerType = ConfigPro.CFML_WRITER_REFULAR;
else writerType = ConfigPro.CFML_WRITER_REFULAR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public LitNumber createLitNumber(Number n) {

@Override
public LitNumber createLitNumber(Number n, Position start, Position end) {
return new LitNumberImpl(this, n instanceof BigDecimal ? (BigDecimal) n : BigDecimal.valueOf(n.doubleValue()), start, end);
return new LitNumberImpl(this, n, start, end);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.GeneratorAdapter;

import lucee.runtime.engine.ThreadLocalPageContext;
import lucee.runtime.op.Caster;
import lucee.transformer.Factory;
import lucee.transformer.Position;
Expand Down Expand Up @@ -61,8 +60,7 @@ public LitBooleanImpl(Factory f, boolean b, Position start, Position end) {

@Override
public Number getNumber(Number defaultValue) {
if (ThreadLocalPageContext.preciseMath(null)) return b ? BigDecimal.ONE : BigDecimal.ZERO;
return Caster.toDouble(b);
return b ? BigDecimal.ONE : BigDecimal.ZERO;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,17 @@ public class LitNumberImpl extends ExpressionBase implements LitNumber, ExprNumb
}

private String number;
private BigDecimal bd;
private Number nbr;

public LitNumberImpl(Factory f, String number, Position start, Position end) {
super(f, start, end);
this.number = number;
}

public LitNumberImpl(Factory f, BigDecimal bd, Position start, Position end) {
public LitNumberImpl(Factory f, Number nbr, Position start, Position end) {
super(f, start, end);
this.bd = bd;
this.number = Caster.toString(bd);

this.nbr = nbr;
this.number = Caster.toString(nbr);
}

@Override
Expand Down Expand Up @@ -96,14 +95,13 @@ public Boolean getBoolean(Boolean defaultValue) {
}

public BigDecimal getBigDecimal() throws CasterException {
if (bd == null) bd = Caster.toBigDecimal(number);
return bd;
if (nbr == null) return Caster.toBigDecimal(number);
return Caster.toBigDecimal(nbr);
}

@Override
public Type _writeOut(BytecodeContext bc, int mode) throws TransformerException {
GeneratorAdapter adapter = bc.getAdapter();

// are we within a method not providing PageContext as first argument?
boolean firstIsPC = ASMUtil.isFirstArgumentPageContext(bc);

Expand All @@ -116,7 +114,8 @@ public Type _writeOut(BytecodeContext bc, int mode) throws TransformerException
}
return Types.DOUBLE_VALUE;
}
Long l = justNumberDigits(number) ? Caster.toLong(number, null) : null;
// we only take length 18 to avoid edge cases
Long l = number.length() < 18 && justNumberDigits(number) ? Caster.toLong(number, null) : null;

if (l != null && Caster.toString(l).equals(number)) {
if (firstIsPC) adapter.loadArg(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import lucee.commons.lang.ExceptionUtil;
import lucee.commons.lang.StringUtil;
import lucee.runtime.config.ConfigPro;
import lucee.runtime.engine.ThreadLocalPageContext;
import lucee.runtime.op.Caster;
import lucee.transformer.Factory;
import lucee.transformer.Position;
Expand Down Expand Up @@ -140,9 +139,7 @@ private static ExprString _toExpr(Factory factory, String str) {

@Override
public Number getNumber(Number defaultValue) {
Number res;
if (ThreadLocalPageContext.preciseMath(null)) res = Caster.toBigDecimal(str, null);
else res = Caster.toDouble(getString(), null);
Number res = Caster.toBigDecimal(str, null);
if (res != null) return res;
return defaultValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.math.BigDecimal;

import lucee.runtime.engine.ThreadLocalPageContext;
import lucee.runtime.op.Caster;
import lucee.transformer.Factory;
import lucee.transformer.Position;
Expand Down Expand Up @@ -78,8 +77,7 @@ public boolean getBooleanValue() {

@Override
public Number getNumber(Number defaultValue) {
if (ThreadLocalPageContext.preciseMath(null)) return b ? BigDecimal.ONE : BigDecimal.ZERO;
return Caster.toDouble(b);
return b ? BigDecimal.ONE : BigDecimal.ZERO;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package lucee.transformer.interpreter.literal;

import lucee.runtime.engine.ThreadLocalPageContext;
import lucee.runtime.op.Caster;
import lucee.transformer.Factory;
import lucee.transformer.Position;
Expand Down Expand Up @@ -41,9 +40,7 @@ public String getString() {

@Override
public Number getNumber(Number defaultValue) {
Number res;
if (ThreadLocalPageContext.preciseMath(null)) res = Caster.toBigDecimal(str, null);
else res = Caster.toDouble(getString(), null);
Number res = Caster.toBigDecimal(str, null);
if (res != null) return res;
return defaultValue;
}
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="7.0.0.75-SNAPSHOT"/>
<property name="version" value="7.0.0.76-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>7.0.0.75-SNAPSHOT</version>
<version>7.0.0.76-SNAPSHOT</version>
<packaging>jar</packaging>

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

0 comments on commit 42b5a45

Please sign in to comment.