Merge branch 'master' of github.com:jamesagnew/hapi-fhir
This commit is contained in:
commit
de51a40904
|
@ -126,7 +126,7 @@ public class StringDt extends BasePrimitive<String> implements IQueryParameterTy
|
|||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && StringUtils.isBlank(getValue());
|
||||
return super.isBaseEmpty() && StringUtils.isBlank(getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -968,9 +968,10 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
theEventWriter.writeStartObject();
|
||||
theEventWriter.write("url", ext.getUrl().getValue());
|
||||
|
||||
if (value == null && ext.getAllUndeclaredExtensions().isEmpty()) {
|
||||
boolean noValue = value == null || value.isEmpty();
|
||||
if (noValue && ext.getAllUndeclaredExtensions().isEmpty()) {
|
||||
ourLog.debug("Extension with URL[{}] has no value", ext.getUrl().getValue());
|
||||
} else if (value == null) {
|
||||
} else if (noValue) {
|
||||
theEventWriter.writeStartArray("extension");
|
||||
for (ExtensionDt next : ext.getUndeclaredExtensions()) {
|
||||
writeUndeclaredExt(theResDef, theResource, theEventWriter, next);
|
||||
|
|
|
@ -558,7 +558,7 @@ public class RestfulServer extends HttpServlet {
|
|||
statusCode=((BaseServerResponseException) e).getStatusCode();
|
||||
issue.getDetails().setValue(e.getMessage());
|
||||
} else {
|
||||
ourLog.error("Failure during REST processing: {}"+ e.toString(), e);
|
||||
ourLog.error("Failure during REST processing", e);
|
||||
issue.getDetails().setValue(e.toString() + "\n\n" + ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package ca.uhn.fhir.model.primitive;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class StringDtTest {
|
||||
|
||||
@Test
|
||||
public void testBlank() {
|
||||
|
||||
assertTrue(new StringDt("").isEmpty());
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -68,12 +68,24 @@ public class JsonParserTest {
|
|||
@Test
|
||||
public void testEncodingNullExtension() {
|
||||
Patient p = new Patient();
|
||||
p.addUndeclaredExtension(new ExtensionDt(false, "http://foo#bar"));
|
||||
String str = new FhirContext().newJsonParser().encodeResourceToString(p);
|
||||
ExtensionDt extension = new ExtensionDt(false, "http://foo#bar");
|
||||
p.addUndeclaredExtension(extension);
|
||||
String str = ourCtx.newJsonParser().encodeResourceToString(p);
|
||||
|
||||
assertEquals("{\"resourceType\":\"Patient\",\"extension\":[{\"url\":\"http://foo#bar\"}]}", str);
|
||||
|
||||
extension.setValue(new StringDt());
|
||||
|
||||
str = ourCtx.newJsonParser().encodeResourceToString(p);
|
||||
assertEquals("{\"resourceType\":\"Patient\",\"extension\":[{\"url\":\"http://foo#bar\"}]}", str);
|
||||
|
||||
extension.setValue(new StringDt(""));
|
||||
|
||||
str = ourCtx.newJsonParser().encodeResourceToString(p);
|
||||
assertEquals("{\"resourceType\":\"Patient\",\"extension\":[{\"url\":\"http://foo#bar\"}]}", str);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeBinaryResource() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue