summaryrefslogtreecommitdiff
path: root/src/main/java/dev
diff options
context:
space:
mode:
authorPaul-Christian Volkmer2026-09-07 08:35:18 +0200
committerPaul-Christian Volkmer2026-09-07 08:35:18 +0200
commit63674260450e915078c15d94f6eebf3a3152331e (patch)
tree7e6192ba017fa693f208ff3628c7c3347b95d82b /src/main/java/dev
parent7671aa9f44df07a4fe3719ab7952db999feab8df (diff)
fix: possible NPE and throw IllegalStateException for gICS
Diffstat (limited to 'src/main/java/dev')
-rw-r--r--src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java b/src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java
index 2439e44..3b75e7c 100644
--- a/src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java
+++ b/src/main/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentService.java
@@ -75,15 +75,25 @@ public class GicsGetBroadConsentService extends AbstractConsentService {
return evaluateConsentResponse(consentStatusResponse);
}
+ /**
+ * This method is used to retrieve broad consent data from the gICS service.
+ *
+ * @param personIdentifierValue patient identifier used for consent data
+ * @param requestDate Ignored, just present for compatibility with other consent services
+ * @param consentDomain Ignored, just present for compatibility with other consent services
+ * @return A {@link Bundle} containing the consent data or empty Bundle if consent fails
+ */
@Override
public Bundle getConsent(
String personIdentifierValue, Date requestDate, ConsentDomain consentDomain) {
- return fhirContext
- .newJsonParser()
- .parseResource(
- Bundle.class,
- requestResponse(
- personIdentifierValue, gIcsConfigProperties.getBroadConsentDomainName()));
+ final var response =
+ requestResponse(personIdentifierValue, gIcsConfigProperties.getBroadConsentDomainName());
+
+ if (null == response) {
+ throw new IllegalStateException("Failed to retrieve consent data from gICS");
+ }
+
+ return fhirContext.newJsonParser().parseResource(Bundle.class, response);
}
@Nullable