Skip to content
This repository was archived by the owner on Jun 29, 2018. It is now read-only.

Commit b040645

Browse files
committed
Merge branch '1.2.x'
2 parents 215f2a1 + 6967ddd commit b040645

File tree

1 file changed

+8
-9
lines changed
  • spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/registry

1 file changed

+8
-9
lines changed

spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/registry/StatusUpdater.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.springframework.context.ApplicationEventPublisher;
2323
import org.springframework.context.ApplicationEventPublisherAware;
2424
import org.springframework.http.ResponseEntity;
25-
import org.springframework.web.client.RestClientException;
2625
import org.springframework.web.client.RestTemplate;
2726

2827
import de.codecentric.boot.admin.event.ClientApplicationStatusChangedEvent;
@@ -34,7 +33,7 @@
3433
* The StatusUpdater is responsible for updatig the status of all or a single application querying
3534
* the healthUrl.
3635
*
37-
* @author Johannes Stelzer
36+
* @author Johannes Edmeier
3837
*/
3938
public class StatusUpdater implements ApplicationEventPublisherAware {
4039
private static final Logger LOGGER = LoggerFactory.getLogger(StatusUpdater.class);
@@ -70,8 +69,8 @@ public void updateStatus(Application application) {
7069
store.save(newState);
7170

7271
if (!newStatus.equals(oldStatus)) {
73-
publisher.publishEvent(new ClientApplicationStatusChangedEvent(newState, oldStatus,
74-
newStatus));
72+
publisher.publishEvent(
73+
new ClientApplicationStatusChangedEvent(newState, oldStatus, newStatus));
7574
}
7675
}
7776

@@ -80,19 +79,19 @@ private StatusInfo queryStatus(Application application) {
8079

8180
try {
8281
@SuppressWarnings("unchecked")
83-
ResponseEntity<Map<String, String>> response = restTemplate.getForEntity(
84-
application.getHealthUrl(), (Class<Map<String, String>>) (Class<?>) Map.class);
82+
ResponseEntity<Map<String, Object>> response = restTemplate.getForEntity(
83+
application.getHealthUrl(), (Class<Map<String, Object>>) (Class<?>) Map.class);
8584
LOGGER.debug("/health for {} responded with {}", application, response);
8685

87-
if (response.hasBody() && response.getBody().get("status") != null) {
88-
return StatusInfo.valueOf(response.getBody().get("status"));
86+
if (response.hasBody() && response.getBody().get("status") instanceof String) {
87+
return StatusInfo.valueOf((String) response.getBody().get("status"));
8988
} else if (response.getStatusCode().is2xxSuccessful()) {
9089
return StatusInfo.ofUp();
9190
} else {
9291
return StatusInfo.ofDown();
9392
}
9493

95-
} catch (RestClientException ex) {
94+
} catch (Exception ex) {
9695
LOGGER.warn("Couldn't retrieve status for {}", application, ex);
9796
return StatusInfo.ofOffline();
9897
}

0 commit comments

Comments
 (0)