diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e69de29bb..410f872bb 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +Validator: +* no changes + +Other code: +* Continue to work on connection timeout issues +* Fix bug in DiagnosticReportRenderer (wrong element accessed) +* change type of resource parameter to ResourceRender.build \ No newline at end of file diff --git a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/utils/client/ClientUtils.java b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/utils/client/ClientUtils.java index 0ecd807e7..9508a02ac 100644 --- a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/utils/client/ClientUtils.java +++ b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/utils/client/ClientUtils.java @@ -107,6 +107,7 @@ public class ClientUtils { private String password; private ToolingClientLogger logger; private int retryCount; + private HttpClient httpclient; public HttpHost getProxy() { return proxy; @@ -291,14 +292,11 @@ public class ClientUtils { while (!ok) { try { tryCount++; - HttpClient httpclient = new DefaultHttpClient(); - HttpParams params = httpclient.getParams(); - HttpConnectionParams.setConnectionTimeout(params, TIMEOUT_CONNECT); - HttpConnectionParams.setSoTimeout(params, timeout < 1 ? this.timeout : timeout * 1000); - - if(proxy != null) { - httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + if (httpclient == null) { + makeClient(proxy); } + HttpParams params = httpclient.getParams(); + HttpConnectionParams.setSoTimeout(params, timeout < 1 ? this.timeout : timeout * 1000); request.setEntity(new ByteArrayEntity(payload)); log(request); response = httpclient.execute(request); @@ -313,7 +311,7 @@ public class ClientUtils { } } else { if (tryCount > 1) { - System.out.println("Giving up: "+ioe.getMessage()+" ("+(System.currentTimeMillis()-t)+"ms / "+Utilities.describeSize(payload.length)+" for "+message+")"); + System.out.println("Giving up: "+ioe.getMessage()+" (R3 / "+(System.currentTimeMillis()-t)+"ms / "+Utilities.describeSize(payload.length)+" for "+message+")"); } throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe); } @@ -322,6 +320,18 @@ public class ClientUtils { return response; } + @SuppressWarnings("deprecation") + public void makeClient(HttpHost proxy) { + httpclient = new DefaultHttpClient(); + HttpParams params = httpclient.getParams(); + HttpConnectionParams.setConnectionTimeout(params, TIMEOUT_CONNECT); + HttpConnectionParams.setSoTimeout(params, timeout); + HttpConnectionParams.setSoKeepalive(params, true); + if(proxy != null) { + httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + } + } + /** * * @param request @@ -331,13 +341,8 @@ public class ClientUtils { protected HttpResponse sendRequest(HttpUriRequest request) { HttpResponse response = null; try { - HttpClient httpclient = new DefaultHttpClient(); - log(request); - HttpParams params = httpclient.getParams(); - HttpConnectionParams.setConnectionTimeout(params, timeout); - HttpConnectionParams.setSoTimeout(params, timeout); - if(proxy != null) { - httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + if (httpclient == null) { + makeClient(proxy); } response = httpclient.execute(request); } catch(IOException ioe) { @@ -582,7 +587,9 @@ public class ClientUtils { HttpResponse response = null; try { log(request); - HttpClient httpclient = new DefaultHttpClient(); + if (httpclient == null) { + makeClient(proxy); + } request.setEntity(new ByteArrayEntity(payload)); response = httpclient.execute(request); log(response); diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/client/ClientUtils.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/client/ClientUtils.java index 442d7d7c3..c9d9ac2ae 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/client/ClientUtils.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/client/ClientUtils.java @@ -107,6 +107,7 @@ public class ClientUtils { private String password; private ToolingClientLogger logger; private int retryCount; + private HttpClient httpclient; public HttpHost getProxy() { return proxy; @@ -291,14 +292,11 @@ public class ClientUtils { while (!ok) { try { tryCount++; - HttpClient httpclient = new DefaultHttpClient(); - HttpParams params = httpclient.getParams(); - HttpConnectionParams.setConnectionTimeout(params, TIMEOUT_CONNECT); - HttpConnectionParams.setSoTimeout(params, timeout < 1 ? this.timeout : timeout * 1000); - - if(proxy != null) { - httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + if (httpclient == null) { + makeClient(proxy); } + HttpParams params = httpclient.getParams(); + HttpConnectionParams.setSoTimeout(params, timeout < 1 ? this.timeout : timeout * 1000); request.setEntity(new ByteArrayEntity(payload)); log(request); response = httpclient.execute(request); @@ -313,7 +311,7 @@ public class ClientUtils { } } else { if (tryCount > 1) { - System.out.println("Giving up: "+ioe.getMessage()+" ("+(System.currentTimeMillis()-t)+"ms / "+Utilities.describeSize(payload.length)+" for "+message+")"); + System.out.println("Giving up: "+ioe.getMessage()+" (R4 / "+(System.currentTimeMillis()-t)+"ms / "+Utilities.describeSize(payload.length)+" for "+message+")"); } throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe); } @@ -322,6 +320,18 @@ public class ClientUtils { return response; } + @SuppressWarnings("deprecation") + public void makeClient(HttpHost proxy) { + httpclient = new DefaultHttpClient(); + HttpParams params = httpclient.getParams(); + HttpConnectionParams.setConnectionTimeout(params, TIMEOUT_CONNECT); + HttpConnectionParams.setSoTimeout(params, timeout); + HttpConnectionParams.setSoKeepalive(params, true); + if(proxy != null) { + httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + } + } + /** * * @param request @@ -331,13 +341,8 @@ public class ClientUtils { protected HttpResponse sendRequest(HttpUriRequest request) { HttpResponse response = null; try { - HttpClient httpclient = new DefaultHttpClient(); - log(request); - HttpParams params = httpclient.getParams(); - HttpConnectionParams.setConnectionTimeout(params, timeout); - HttpConnectionParams.setSoTimeout(params, timeout); - if(proxy != null) { - httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + if (httpclient == null) { + makeClient(proxy); } response = httpclient.execute(request); } catch(IOException ioe) { @@ -583,7 +588,9 @@ public class ClientUtils { HttpResponse response = null; try { log(request); - HttpClient httpclient = new DefaultHttpClient(); + if (httpclient == null) { + makeClient(proxy); + } request.setEntity(new ByteArrayEntity(payload)); response = httpclient.execute(request); log(response); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index 3062c0734..d8ed01548 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -570,8 +570,9 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte CacheToken cacheToken = txCache.generateExpandToken(vs, hierarchical); ValueSetExpansionOutcome res; res = txCache.getExpansion(cacheToken); - if (res != null) + if (res != null) { return res; + } Parameters p = expParameters.copy(); p.setParameter("includeDefinition", false); p.setParameter("excludeNested", !hierarchical); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DiagnosticReportRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DiagnosticReportRenderer.java index 9a2daa048..d026fcab5 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DiagnosticReportRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DiagnosticReportRenderer.java @@ -79,7 +79,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer { if (dr.has("issued")) { tr = tbl.tr(); tr.td().tx("Reported"); - eff = (DataType) getProperty(dr, "effective[x]").value().getBase(); + eff = (DataType) getProperty(dr, "issued").value().getBase(); render(tr.td(), getProperty(dr, "issued").value()); } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java index 1904b74cd..61fd75c3f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java @@ -50,7 +50,7 @@ public abstract class ResourceRenderer extends DataRenderer { this.rcontext = rcontext; } - public XhtmlNode build(DomainResource dr) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome { + public XhtmlNode build(Resource dr) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); render(x, dr); return x; diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java index 4d0e53427..41933ffb6 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java @@ -144,7 +144,7 @@ public class ValueSetCheckerSimple implements ValueSetChecker { throw new FHIRException(warningMessage); } - if (cs!=null && cs.getContent() == CodeSystemContentMode.COMPLETE) { + if (cs!=null && (cs.getContent() == CodeSystemContentMode.COMPLETE || cs.getContent() == CodeSystemContentMode.FRAGMENT)) { res = validateCode(code, cs); } else { // it's in the expansion, but we could find it in a code system diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ResourceUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ResourceUtilities.java index 8c5f3077a..0cf3e1fa6 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ResourceUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ResourceUtilities.java @@ -72,19 +72,22 @@ public class ResourceUtilities { } public static String getErrorDescription(OperationOutcome error) { - if (error.hasText() && error.getText().hasDiv()) + if (error.hasText() && error.getText().hasDiv()) { return new XhtmlComposer(XhtmlComposer.XML).composePlainText(error.getText().getDiv()); + } StringBuilder b = new StringBuilder(); - for (OperationOutcomeIssueComponent t : error.getIssue()) - if (t.getSeverity() == IssueSeverity.ERROR) + for (OperationOutcomeIssueComponent t : error.getIssue()) { + if (t.getSeverity() == IssueSeverity.ERROR) { b.append("Error:" +t.getDetails()+"\r\n"); - else if (t.getSeverity() == IssueSeverity.FATAL) + } else if (t.getSeverity() == IssueSeverity.FATAL) { b.append("Fatal:" +t.getDetails()+"\r\n"); - else if (t.getSeverity() == IssueSeverity.WARNING) + } else if (t.getSeverity() == IssueSeverity.WARNING) { b.append("Warning:" +t.getDetails()+"\r\n"); - else if (t.getSeverity() == IssueSeverity.INFORMATION) + } else if (t.getSeverity() == IssueSeverity.INFORMATION) { b.append("Information:" +t.getDetails()+"\r\n"); + } + } return b.toString(); } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/ClientUtils.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/ClientUtils.java index 1148d2018..12517281f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/ClientUtils.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/ClientUtils.java @@ -107,6 +107,7 @@ public class ClientUtils { private String password; private ToolingClientLogger logger; private int retryCount; + private HttpClient httpclient; public HttpHost getProxy() { return proxy; @@ -291,14 +292,11 @@ public class ClientUtils { while (!ok) { try { tryCount++; - HttpClient httpclient = new DefaultHttpClient(); - HttpParams params = httpclient.getParams(); - HttpConnectionParams.setConnectionTimeout(params, TIMEOUT_CONNECT); - HttpConnectionParams.setSoTimeout(params, timeout < 1 ? this.timeout : timeout * 1000); - - if(proxy != null) { - httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + if (httpclient == null) { + makeClient(proxy); } + HttpParams params = httpclient.getParams(); + HttpConnectionParams.setSoTimeout(params, timeout < 1 ? this.timeout : timeout * 1000); request.setEntity(new ByteArrayEntity(payload)); log(request); response = httpclient.execute(request); @@ -313,7 +311,7 @@ public class ClientUtils { } } else { if (tryCount > 1) { - System.out.println("Giving up: "+ioe.getMessage()+" ("+(System.currentTimeMillis()-t)+"ms / "+Utilities.describeSize(payload.length)+" for "+message+")"); + System.out.println("Giving up: "+ioe.getMessage()+" (R5 / "+(System.currentTimeMillis()-t)+"ms / "+Utilities.describeSize(payload.length)+" for "+message+")"); } throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe); } @@ -322,6 +320,18 @@ public class ClientUtils { return response; } + @SuppressWarnings("deprecation") + public void makeClient(HttpHost proxy) { + httpclient = new DefaultHttpClient(); + HttpParams params = httpclient.getParams(); + HttpConnectionParams.setConnectionTimeout(params, TIMEOUT_CONNECT); + HttpConnectionParams.setSoTimeout(params, timeout); + HttpConnectionParams.setSoKeepalive(params, true); + if(proxy != null) { + httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + } + } + /** * * @param request @@ -331,13 +341,8 @@ public class ClientUtils { protected HttpResponse sendRequest(HttpUriRequest request) { HttpResponse response = null; try { - HttpClient httpclient = new DefaultHttpClient(); - log(request); - HttpParams params = httpclient.getParams(); - HttpConnectionParams.setConnectionTimeout(params, timeout); - HttpConnectionParams.setSoTimeout(params, timeout); - if(proxy != null) { - httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); + if (httpclient == null) { + makeClient(proxy); } response = httpclient.execute(request); } catch(IOException ioe) { @@ -583,7 +588,9 @@ public class ClientUtils { HttpResponse response = null; try { log(request); - HttpClient httpclient = new DefaultHttpClient(); + if (httpclient == null) { + makeClient(proxy); + } request.setEntity(new ByteArrayEntity(payload)); response = httpclient.execute(request); log(response); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/FHIRToolingClient.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/FHIRToolingClient.java index f56896d7b..1e9c94af7 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/FHIRToolingClient.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/client/FHIRToolingClient.java @@ -728,8 +728,9 @@ public class FHIRToolingClient { List
headers = null; Parameters p = expParams == null ? new Parameters() : expParams.copy(); p.addParameter().setName("valueSet").setResource(source); - for (String n : params.keySet()) + for (String n : params.keySet()) { p.addParameter().setName(n).setValue(new StringType(params.get(n))); + } ResourceRequest result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params), utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, "ValueSet/$expand?url="+source.getUrl(), TIMEOUT_OPERATION_EXPAND); result.addErrorStatus(410);//gone