Fix issues reported by errorprone

This commit is contained in:
jamesagnew 2018-05-15 08:44:15 -04:00
parent 8d6940a70e
commit 4d62120a18
5 changed files with 2773 additions and 2761 deletions

View File

@ -113,6 +113,7 @@ public class LoincHandler implements IRecordHandler {
ourLog.warn("Unable to find part code with TYPE[{}] and NAME[{}]", key.getPartType(), key.getPartName()); ourLog.warn("Unable to find part code with TYPE[{}] and NAME[{}]", key.getPartType(), key.getPartName());
} }
break; break;
case DECIMAL:
case CODE: case CODE:
case INTEGER: case INTEGER:
case BOOLEAN: case BOOLEAN:

View File

@ -87,8 +87,8 @@ public class FhirTesterConfig {
.addServer() .addServer()
.withId("spark2") .withId("spark2")
.withFhirVersion(FhirVersionEnum.DSTU2) .withFhirVersion(FhirVersionEnum.DSTU2)
.withBaseUrl("http://spark-dstu2.furore.com/fhir") .withBaseUrl("http://vonk.furore.com/")
.withName("Spark - Furore (DSTU2 FHIR)"); .withName("Vonk - Furore (STU3 FHIR)");
return retVal; return retVal;
} }

View File

@ -366,9 +366,15 @@ public class StructureMapUtilities {
private static void renderGroup(StringBuilder b, StructureMapGroupComponent g) { private static void renderGroup(StringBuilder b, StructureMapGroupComponent g) {
b.append("group "); b.append("group ");
switch (g.getTypeMode()) { switch (g.getTypeMode()) {
case TYPES: b.append("for types"); case TYPES:
case TYPEANDTYPES: b.append("for type+types "); b.append("for types");
default: // NONE, NULL break;
case TYPEANDTYPES:
b.append("for type+types ");
break;
case NONE:
case NULL:
break;
} }
b.append("for types "); b.append("for types ");
b.append(g.getName()); b.append(g.getName());

View File

@ -6,13 +6,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.codec.Charsets; import org.apache.commons.codec.Charsets;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -250,7 +244,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
return laterVersion(newParts[i], oldParts[i]); return laterVersion(newParts[i], oldParts[i]);
} }
// This should never happen // This should never happen
throw new Error("Delimited versions have exact match for delimiter '"+delimiter+"' : "+newParts+" vs "+oldParts); throw new Error("Delimited versions have exact match for delimiter '"+delimiter+"' : "+ Arrays.asList(newParts)+" vs "+Arrays.asList(oldParts));
} }
protected <T extends MetadataResource> void seeMetadataResource(T r, Map<String, T> map, boolean addId) throws FHIRException { protected <T extends MetadataResource> void seeMetadataResource(T r, Map<String, T> map, boolean addId) throws FHIRException {
@ -1045,6 +1039,8 @@ public abstract class BaseWorkerContext implements IWorkerContext {
return (T) maps.get(uri); return (T) maps.get(uri);
if (transforms.containsKey(uri)) if (transforms.containsKey(uri))
return (T) transforms.get(uri); return (T) transforms.get(uri);
if (questionnaires.containsKey(uri))
return (T) questionnaires.get(uri);
return null; return null;
} else if (class_ == StructureDefinition.class) { } else if (class_ == StructureDefinition.class) {
return (T) structures.get(uri); return (T) structures.get(uri);
@ -1052,6 +1048,8 @@ public abstract class BaseWorkerContext implements IWorkerContext {
return (T) valueSets.get(uri); return (T) valueSets.get(uri);
} else if (class_ == CodeSystem.class) { } else if (class_ == CodeSystem.class) {
return (T) codeSystems.get(uri); return (T) codeSystems.get(uri);
} else if (class_ == ConceptMap.class) {
return (T) maps.get(uri);
} else if (class_ == OperationDefinition.class) { } else if (class_ == OperationDefinition.class) {
OperationDefinition od = operations.get(uri); OperationDefinition od = operations.get(uri);
return (T) od; return (T) od;
@ -1069,7 +1067,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
} }
} }
if (class_ == Questionnaire.class) if (class_ == Questionnaire.class)
return null; return (T) questionnaires.get(uri);
if (class_ == null) { if (class_ == null) {
if (uri.matches(Constants.URI_REGEX) && !uri.contains("ValueSet")) if (uri.matches(Constants.URI_REGEX) && !uri.contains("ValueSet"))
return null; return null;

View File

@ -1,10 +1,11 @@
package org.hl7.fhir.r4.utils; package org.hl7.fhir.r4.utils;
//import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum; import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.util.ElementUtil; import ca.uhn.fhir.util.ElementUtil;
import org.apache.commons.lang3.NotImplementedException; import org.apache.commons.lang3.NotImplementedException;
import org.apache.http.protocol.ExecutionContext;
import org.fhir.ucum.Decimal; import org.fhir.ucum.Decimal;
import org.fhir.ucum.Pair; import org.fhir.ucum.Pair;
import org.fhir.ucum.UcumException; import org.fhir.ucum.UcumException;
@ -24,8 +25,13 @@ import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import static org.apache.commons.lang3.StringUtils.length;
/** /**
* *
* @author Grahame Grieve * @author Grahame Grieve
@ -731,7 +737,7 @@ public class FHIRPathEngine {
String s = lexer.take(); String s = lexer.take();
if (s.equals("year") || s.equals("years")) if (s.equals("year") || s.equals("years"))
ucum = "a"; ucum = "a";
else if (s.equals("month") || s.equals("month")) else if (s.equals("month") || s.equals("months"))
ucum = "mo"; ucum = "mo";
else if (s.equals("week") || s.equals("weeks")) else if (s.equals("week") || s.equals("weeks"))
ucum = "wk"; ucum = "wk";
@ -2072,8 +2078,9 @@ public class FHIRPathEngine {
result.add(item); result.add(item);
} else } else
getChildrenByName(item, exp.getName(), result); getChildrenByName(item, exp.getName(), result);
// todo: GG 1st April 201 - why do this?
if (result.size() == 0 && atEntry && context.appInfo != null) { if (result.size() == 0 && atEntry && context.appInfo != null) {
// well, we didn't get a match on the name - we'll see if the name matches a constant known by the context.
// (if the name does match, and the user wants to get the constant value, they'll have to try harder...
Base temp = hostServices.resolveConstant(context.appInfo, exp.getName()); Base temp = hostServices.resolveConstant(context.appInfo, exp.getName());
if (temp != null) { if (temp != null) {
result.add(temp); result.add(temp);
@ -3280,7 +3287,7 @@ public class FHIRPathEngine {
return Quantity.fromUcum(v, s.substring(1, s.length()-1)); return Quantity.fromUcum(v, s.substring(1, s.length()-1));
if (s.equals("year") || s.equals("years")) if (s.equals("year") || s.equals("years"))
return Quantity.fromUcum(v, "a"); return Quantity.fromUcum(v, "a");
else if (s.equals("month") || s.equals("month")) else if (s.equals("month") || s.equals("months"))
return Quantity.fromUcum(v, "mo"); return Quantity.fromUcum(v, "mo");
else if (s.equals("week") || s.equals("weeks")) else if (s.equals("week") || s.equals("weeks"))
return Quantity.fromUcum(v, "wk"); return Quantity.fromUcum(v, "wk");