Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/967#discussion_r192681830
--- Diff:
rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
---
@@ -182,10 +206,10 @@ private EntityDetail fromEntity(Entity entity) {
public List<EntityDetail> fetch(String entityIds, String
extraSensorsS) {
List<String> extraSensorNames =
JavaStringEscapes.unwrapOptionallyQuotedJavaStringList(extraSensorsS);
List<AttributeSensor<?>> extraSensors =
extraSensorNames.stream().map((s) -> Sensors.newSensor(Object.class,
s)).collect(Collectors.toList());
-
+
List<EntityDetail> entitySummaries = Lists.newArrayList();
for (Entity application : mgmt().getApplications()) {
- entitySummaries.add(addSensors(fromEntity(application),
application, extraSensors));
+
entitySummaries.add(addSensorsByName((EntityDetail)fromEntity(application,
false, -1, null, null), application, extraSensors));
--- End diff --
It looks like this is doing something sneaky (passing in depth `-1`, so the
recursion will never terminate early by reaching depth `0`). If I'm reading
that right, it really needs to be documented. Someone could easily change the
behaviour of `fromEntity` in the future without realising that someone was
relying on negative depth to mean infinite!
---