Skip to content

Commit e50fd2e

Browse files
committed
GH-2858 - Fix potential stackoverflow in recursive projections.
1 parent caea3f1 commit e50fd2e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/org/springframework/data/neo4j/core/PropertyFilterSupport.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,13 @@ private static void addPropertiesFrom(Class<?> domainType, Class<?> returnedType
153153
break;
154154
}
155155

156-
addPropertiesFrom(domainType, returnedType, factory, filteredProperties,
157-
nextProjectionPathProcessor, mappingContext);
156+
if (projectionPathProcessor.typeInformation.getActualType().getType().equals(nextProjectionPathProcessor.typeInformation.getActualType().getType())
157+
|| (!projectionPathProcessor.typeInformation.isCollectionLike() && !projectionPathProcessor.typeInformation.isMap() && projectionPathProcessor.typeInformation.getType().equals(nextProjectionPathProcessor.typeInformation.getType()))) {
158+
filteredProperties.add(new PropertyFilter.ProjectedPath(propertyPath, true));
159+
} else {
160+
addPropertiesFrom(domainType, returnedType, factory, filteredProperties,
161+
nextProjectionPathProcessor, mappingContext);
162+
}
158163
}
159164
} else {
160165
// An open projection at this place needs to get replaced with the matching (real) entity

0 commit comments

Comments
 (0)