Skip to content

Commit da2b67b

Browse files
jasmith-hsclaude
andcommitted
Address Sidekick review feedback: null check ordering in SizeLimitingPySet
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4b2551f commit da2b67b

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/main/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ protected void coerceValue(
168168
Class<?> type
169169
) {
170170
if (type.equals(JinjavaInterpreter.class)) {
171-
Array.set(array, index, JinjavaInterpreter.getCurrent());
171+
Array.set(array, index, JinjavaInterpreter.getCurrent()); // Could be null if there's no current interpreter
172172
} else {
173173
super.coerceValue(array, index, factory, value, type);
174174
}

src/main/java/com/hubspot/jinjava/objects/collections/SizeLimitingPySet.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.hubspot.jinjava.interpret.TemplateError.ErrorType;
88
import com.hubspot.jinjava.objects.PyWrapper;
99
import java.util.Collection;
10+
import java.util.Objects;
1011
import java.util.Set;
1112
import javax.annotation.Nonnull;
1213

@@ -16,10 +17,7 @@ public class SizeLimitingPySet extends PySet implements PyWrapper {
1617
private boolean hasWarned;
1718

1819
public SizeLimitingPySet(Set<Object> set, int maxSize) {
19-
super(set);
20-
if (set == null) {
21-
throw new IllegalArgumentException("set is null");
22-
}
20+
super(Objects.requireNonNull(set, "set is null"));
2321
if (maxSize <= 0) {
2422
throw new IllegalArgumentException("maxSize must be >= 1");
2523
}

0 commit comments

Comments
 (0)