Skip to content

Commit

Permalink
Remove deferredExecutionRestrictedMethods from config
Browse files Browse the repository at this point in the history
  • Loading branch information
manheychiu1 committed May 24, 2023
1 parent dc12467 commit 012183b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
14 changes: 0 additions & 14 deletions src/main/java/com/hubspot/jinjava/JinjavaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public class JinjavaConfig {
private final Set<String> restrictedMethods;

private final Set<String> restrictedProperties;
private final Set<String> deferredExecutionRestrictedMethods;

private final boolean failOnUnknownTokens;
private final boolean nestedInterpretationEnabled;
Expand Down Expand Up @@ -129,7 +128,6 @@ private JinjavaConfig(Builder builder) {
disabled = builder.disabled;
restrictedMethods = builder.restrictedMethods;
restrictedProperties = builder.restrictedProperties;
deferredExecutionRestrictedMethods = builder.deferredExecutionRestrictedMethods;
trimBlocks = builder.trimBlocks;
lstripBlocks = builder.lstripBlocks;
enableRecursiveMacroCalls = builder.enableRecursiveMacroCalls;
Expand Down Expand Up @@ -235,10 +233,6 @@ public Set<String> getRestrictedProperties() {
return restrictedProperties;
}

public Set<String> getDeferredExecutionRestrictedMethods() {
return deferredExecutionRestrictedMethods;
}

public boolean isFailOnUnknownTokens() {
return failOnUnknownTokens;
}
Expand Down Expand Up @@ -329,7 +323,6 @@ public static class Builder {

private Set<String> restrictedMethods = new HashSet<>();
private Set<String> restrictedProperties = new HashSet<>();
private Set<String> deferredExecutionRestrictedMethods = new HashSet<>();

private boolean trimBlocks;
private boolean lstripBlocks;
Expand Down Expand Up @@ -391,13 +384,6 @@ public Builder withRestrictedProperties(Set<String> restrictedProperties) {
return this;
}

public Builder withDeferredExecutionRestrictedMethods(
Set<String> deferredExecutionRestrictedMethods
) {
this.deferredExecutionRestrictedMethods = deferredExecutionRestrictedMethods;
return this;
}

public Builder withMaxRenderDepth(int maxRenderDepth) {
this.maxRenderDepth = maxRenderDepth;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class JinjavaBeanELResolver extends BeanELResolver {
.add("wait")
.build();

private static final Set<String> DEFAULT_DEFERRED_EXECUTION_RESTRICTED_METHODS = ImmutableSet
private static final Set<String> DEFERRED_EXECUTION_RESTRICTED_METHODS = ImmutableSet
.<String>builder()
.add("put")
.add("putAll")
Expand Down Expand Up @@ -126,13 +126,8 @@ public Object invoke(
);
}

Set<String> allDeferredExecutionRestrictedMethods = Sets.union(
interpreter.getConfig().getDeferredExecutionRestrictedMethods(),
DEFAULT_DEFERRED_EXECUTION_RESTRICTED_METHODS
);

if (
allDeferredExecutionRestrictedMethods.contains(method.toString()) &&
DEFERRED_EXECUTION_RESTRICTED_METHODS.contains(method.toString()) &&
EagerReconstructionUtils.isDeferredExecutionMode()
) {
throw new DeferredValueException(
Expand Down

0 comments on commit 012183b

Please sign in to comment.