This is an automated email from the ASF dual-hosted git repository.
ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push:
new 444df33 CAY-2720 ConcurrentModificationException in the
TypeAwareSQLTreeProcessor - revert as a required data could be initialized
lazily
444df33 is described below
commit 444df33111c9bc30165275ed46137ef3c2daf34c
Author: Nikita Timofeev <[email protected]>
AuthorDate: Thu Sep 9 18:21:38 2021 +0300
CAY-2720 ConcurrentModificationException in the TypeAwareSQLTreeProcessor
- revert as a required data could be initialized lazily
---
.../cayenne/access/sqlbuilder/sqltree/PerAttributeChildProcessor.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git
a/cayenne-server/src/main/java/org/apache/cayenne/access/sqlbuilder/sqltree/PerAttributeChildProcessor.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/sqlbuilder/sqltree/PerAttributeChildProcessor.java
index dc278dd..9677ffc 100644
---
a/cayenne-server/src/main/java/org/apache/cayenne/access/sqlbuilder/sqltree/PerAttributeChildProcessor.java
+++
b/cayenne-server/src/main/java/org/apache/cayenne/access/sqlbuilder/sqltree/PerAttributeChildProcessor.java
@@ -35,20 +35,18 @@ public class PerAttributeChildProcessor<T extends Node>
implements ChildProcesso
private final Map<DbAttribute, ChildProcessor<T>> processorByAttribute =
new ConcurrentHashMap<>();
private final Function<T, DbAttribute> attributeMapper;
private final Function<DbAttribute, ChildProcessor<T>> processorFactory;
- private final ChildProcessor<T> nullProcessor;
public PerAttributeChildProcessor(Function<T, DbAttribute> attributeMapper,
Function<DbAttribute, ChildProcessor<T>>
processorFactory) {
this.processorFactory = processorFactory;
this.attributeMapper = attributeMapper;
- this.nullProcessor = processorFactory.apply(null);
}
@Override
public Optional<Node> process(Node parent, T child, int index) {
DbAttribute dbAttribute = attributeMapper.apply(child);
if(dbAttribute == null) {
- return nullProcessor.process(parent, child, index);
+ return processorFactory.apply(null).process(parent, child, index);
}
return processorByAttribute
.computeIfAbsent(dbAttribute, processorFactory)