Skip to content

Commit

Permalink
LDEV-4732 - add support for attribute "throwonerror"
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Oct 25, 2023
1 parent 57dac7c commit a3bf1bb
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,6 @@ private ConfigServerImpl getConfigServerImpl() {
}

private ConfigServerImpl getConfigServerImpl(ConfigServerImpl existing, boolean quick) {
long start = System.currentTimeMillis();
if (configServer == null) {
try {
Resource context = getSeverContextConfigDirectory(factory);
Expand Down
13 changes: 9 additions & 4 deletions core/src/main/java/lucee/runtime/tag/Flush.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
**/
package lucee.runtime.tag;

import java.io.IOException;

import lucee.runtime.PageContextImpl;
import lucee.runtime.exp.PageException;
import lucee.runtime.ext.tag.TagImpl;
Expand All @@ -39,10 +37,13 @@ public final class Flush extends TagImpl {
*/
private double interval = -1;

private boolean throwonerror = true;

@Override
public void release() {
super.release();
interval = -1;
throwonerror = true;
}

/**
Expand All @@ -56,14 +57,18 @@ public void setInterval(double interval) {
this.interval = interval;
}

public void setThrowonerror(boolean throwonerror) {
this.throwonerror = throwonerror;
}

@Override
public int doStartTag() throws PageException {
try {
if (interval == -1) ((PageContextImpl) pageContext).getRootOut().flush();
else((PageContextImpl) pageContext).getRootOut().setBufferConfig((int) interval, true);
}
catch (IOException e) {
throw Caster.toPageException(e);
catch (Exception e) {
if (throwonerror) throw Caster.toPageException(e);
}
return SKIP_BODY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ private final Tag __multiAttrStatement(Body parent, Data data, TagLibTag tlt) th

}

boolean isValid = (data.srcCode.isCurrent(' ') || (tlt.getHasBody() && data.srcCode.isCurrent('{')));
boolean isValid = (data.srcCode.isCurrent(' ') || data.srcCode.isCurrent(';') || (tlt.getHasBody() && data.srcCode.isCurrent('{')));
if (isValid && (data.srcCode.isCurrent(" ", "=") || data.srcCode.isCurrent(" ", "("))) { // simply avoid a later exception
isValid = false;
}
Expand Down
11 changes: 10 additions & 1 deletion core/src/main/java/resource/tld/core-base.tld
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ To use cached data, the tag must be called with the exact same arguments. Only u
<body-content>empty</body-content>
<body-rtexprvalue>false</body-rtexprvalue>
<script>
<type>single</type>
<type>multiple</type>
<rtexprvalue>true</rtexprvalue>
</script>
<description>Flushes currently available data to the client.</description>
Expand All @@ -1763,6 +1763,15 @@ To use cached data, the tag must be called with the exact same arguments. Only u
headers, and any data that is already available when you make this call, are not included in
the count.</description>
</attribute>
<attribute>
<type>boolean</type>
<name>throwonerror</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<default>true</default>
<script-support>optional</script-support>
<description>If set to false, any exceptions thrown by the servlet engine, such as those resulting from a client disconnection, will be suppressed.</description>
</attribute>
</tag>

<!-- Forward -->
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="5.4.4.22-SNAPSHOT"/>
<property name="version" value="5.4.4.23-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>5.4.4.22-SNAPSHOT</version>
<version>5.4.4.23-SNAPSHOT</version>
<packaging>jar</packaging>

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

0 comments on commit a3bf1bb

Please sign in to comment.