From e439891ea280137d23bc0f46b90237033ebb5130 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Wed, 29 Apr 2020 15:21:54 -0400 Subject: [PATCH] Add test --- .../fhir/jpa/dao/TolerantJsonParserR4Test.java | 16 ++++++++++++++++ .../rest/server/ApacheProxyAddressStrategy.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TolerantJsonParserR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TolerantJsonParserR4Test.java index 6b462d7db2f..dea758dc150 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TolerantJsonParserR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TolerantJsonParserR4Test.java @@ -46,6 +46,22 @@ public class TolerantJsonParserR4Test { assertEquals("0.5", obs.getValueQuantity().getValueElement().getValueAsString()); } + @Test + public void testParseInvalidNumeric_DoubleZeros() { + String input = "{\n" + + "\"resourceType\": \"Observation\",\n" + + "\"valueQuantity\": {\n" + + " \"value\": 00\n" + + " }\n" + + "}"; + + + TolerantJsonParser parser = new TolerantJsonParser(myFhirContext, new LenientErrorHandler()); + Observation obs = parser.parseResource(Observation.class, input); + + assertEquals("0", obs.getValueQuantity().getValueElement().getValueAsString()); + } + @Test public void testParseInvalidNumeric2() { String input = "{\n" + diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/ApacheProxyAddressStrategy.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/ApacheProxyAddressStrategy.java index a05a2a78526..b6e2652543b 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/ApacheProxyAddressStrategy.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/ApacheProxyAddressStrategy.java @@ -168,4 +168,4 @@ public class ApacheProxyAddressStrategy extends IncomingRequestAddressStrategy { public static ApacheProxyAddressStrategy forHttps() { return new ApacheProxyAddressStrategy(true); } -} \ No newline at end of file +}