This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new d80976cbf6e CAMEL-20297 camel-dhis2: do not swallow interrupted
exceptions
d80976cbf6e is described below
commit d80976cbf6eb37f2d32c138edfa78c983b5976da
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Thu Jan 11 10:19:58 2024 +0100
CAMEL-20297 camel-dhis2: do not swallow interrupted exceptions
---
.../component/dhis2/api/Dhis2ResourceTables.java | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git
a/components/camel-dhis2/camel-dhis2-api/src/main/java/org/apache/camel/component/dhis2/api/Dhis2ResourceTables.java
b/components/camel-dhis2/camel-dhis2-api/src/main/java/org/apache/camel/component/dhis2/api/Dhis2ResourceTables.java
index a7a6fc22fa0..db5e8b71980 100644
---
a/components/camel-dhis2/camel-dhis2-api/src/main/java/org/apache/camel/component/dhis2/api/Dhis2ResourceTables.java
+++
b/components/camel-dhis2/camel-dhis2-api/src/main/java/org/apache/camel/component/dhis2/api/Dhis2ResourceTables.java
@@ -48,17 +48,19 @@ public class Dhis2ResourceTables {
while (notification == null || !(Boolean)
notification.get("completed")) {
try {
Thread.sleep(Objects.requireNonNullElse(interval, 30000));
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- Iterable<Map> notifications =
dhis2Client.get("system/tasks/ANALYTICS_TABLE/{taskId}",
- taskId).withoutPaging().transfer().returnAs(Map.class);
- if (notifications.iterator().hasNext()) {
- notification = notifications.iterator().next();
- if (notification.get("level").equals("ERROR")) {
- throw new RuntimeException("Analytics failed => " +
notification);
+
+ Iterable<Map> notifications =
dhis2Client.get("system/tasks/ANALYTICS_TABLE/{taskId}",
+ taskId).withoutPaging().transfer().returnAs(Map.class);
+ if (notifications.iterator().hasNext()) {
+ notification = notifications.iterator().next();
+ if (notification.get("level").equals("ERROR")) {
+ throw new RuntimeException("Analytics failed => " +
notification);
+ }
}
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
}
+
}
}