Checkstyle cleanup (#4501)

* cleaning up checkstyle files

* added exlusions for files at base project level so checkstyle doesn't error out

* duplicate error code from merge

* One more fix for #4467

* changing lifecycle goal for all module checkstyle check

* moving checkstyle to base pom file, changing exectution phase on base check, cleaning dependency, resolving duplicate error code

* wip

* trying to figure out why pipeline cannot copy files

* removing modules that don't actually need to be built.

* I messed up the version

* missing model

---------

Co-authored-by: James Agnew <jamesagnew@gmail.com>
This commit is contained in:
Mark Iantorno 2023-02-03 09:40:32 -05:00 committed by GitHub
parent 9665476c00
commit 64d776ac0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 366 additions and 532 deletions

View File

@ -80,16 +80,12 @@ stages:
module: hapi-fhir-server-mdm
- name: hapi_fhir_server_openapi
module: hapi-fhir-server-openapi
- name: hapi_fhir_serviceloaders
module: hapi-fhir-serviceloaders
- name: hapi_fhir_caching_api
module: hapi-fhir-serviceloaders/hapi-fhir-caching-api
- name: hapi_fhir_caching_caffeine
module: hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine
- name: hapi_fhir_caching_guava
module: hapi-fhir-serviceloaders/hapi-fhir-caching-guava
- name: hapi_fhir_caching_testing
module: hapi-fhir-serviceloaders/hapi-fhir-caching-testing
- name: hapi_fhir_spring_boot_autoconfigure
module: hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure
- name: hapi_fhir_spring_boot_sample_server_jersey

View File

@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@ -13,9 +14,6 @@
<name>HAPI FHIR - Deployable Artifact Parent POM</name>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
@ -120,27 +118,6 @@
</ignoredResourcePatterns>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<logViolationsToConsole>true</logViolationsToConsole>
<failsOnError>true</failsOnError>
<suppressionsLocation>${maven.multiModuleProjectDirectory}/src/checkstyle/checkstyle_suppressions.xml</suppressionsLocation>
<enableRulesSummary>true</enableRulesSummary>
<enableSeveritySummary>true</enableSeveritySummary>
<consoleOutput>true</consoleOutput>
<configLocation>${maven.multiModuleProjectDirectory}/src/checkstyle/checkstyle.xml</configLocation>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@ -208,7 +185,6 @@
<execution>
<phase>package</phase>
<goals>
<!--<goal>aggregate-jar</goal>-->
<goal>jar</goal>
</goals>
</execution>
@ -252,5 +228,4 @@
</build>
</profile>
</profiles>
</project>

View File

@ -196,6 +196,62 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<configuration>
<target>
<!--suppress UnresolvedMavenProperty -->
<delete dir="${pom.basedir}/target/" includes="checkstyle*"/>
</target>
</configuration>
<inherited>true</inherited>
<executions>
<execution>
<id>delete-module-cache-file</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven_checkstyle_version}</version>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<configLocation>${maven.multiModuleProjectDirectory}/hapi-fhir-checkstyle/src/checkstyle/hapi-base-checkstyle.xml</configLocation>
<!--suppress UnresolvedMavenProperty -->
<suppressionsLocation>${maven.multiModuleProjectDirectory}/hapi-fhir-checkstyle/src/checkstyle/hapi-base-checkstyle-suppression.xml</suppressionsLocation>
<inputEncoding>UTF-8</inputEncoding>
<consoleOutput>true</consoleOutput>
</configuration>
<inherited>true</inherited>
<executions>
<execution>
<id>hapi-single-module-checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-checkstyle</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle_version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<resources>
<resource>

View File

@ -333,7 +333,7 @@ public class FhirValidator {
retval.addAll(messages);
}
} catch (InterruptedException | ExecutionException exp) {
throw new InternalErrorException(Msg.code(1975) + exp);
throw new InternalErrorException(Msg.code(2246) + exp);
}
return retval;
}

View File

@ -18,6 +18,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle_version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
@ -34,6 +35,31 @@
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle_version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-checkstyle</artifactId>
<!-- Remember to bump this when you upgrade the version -->
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<!-- For releases, we need to generate javadoc and sources JAR -->
<profile>
@ -75,5 +101,44 @@
</plugins>
</build>
</profile>
<profile>
<id>CI</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven_checkstyle_version}</version>
<configuration>
<excludes>**/osgi/**/*, **/.mvn/**/*, **/.mvn_/**/*</excludes>
<sourceDirectories>
<!--scan base project directory to include all modules-->
<!--suppress UnresolvedMavenProperty -->
<directory>${maven.multiModuleProjectDirectory}/</directory>
</sourceDirectories>
<!--suppress UnresolvedMavenProperty -->
<configLocation>${maven.multiModuleProjectDirectory}/hapi-fhir-checkstyle/src/checkstyle/hapi-base-checkstyle.xml</configLocation>
<!--suppress UnresolvedMavenProperty -->
<suppressionsLocation>${maven.multiModuleProjectDirectory}/hapi-fhir-checkstyle/src/checkstyle/hapi-base-checkstyle-suppression.xml</suppressionsLocation>
<inputEncoding>UTF-8</inputEncoding>
<consoleOutput>true</consoleOutput>
</configuration>
<executions>
<execution>
<id>checkstyle-across-all-modules</id>
<phase>install</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
<execution>
<id>hapi-single-module-checkstyle</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -1,10 +1,18 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files="[/\\]test[/\\]" checks="[a-zA-Z0-9]*" />
<suppress files="[/\\]resources[/\\]" checks="[a-zA-Z0-9]*" />
<suppress files="[\\/]target[\\/]" checks="[a-zA-Z0-9]*" />
<suppress files="[\\/]hapi-fhir-docs[\\/]" checks="[a-zA-Z0-9]*" />
<suppress files="[\\/]hapi-fhir-checkstyle[\\/]" checks="[a-zA-Z0-9]*" />
<suppress files="[\\/]hapi-fhir-jpaserver-test-utilities[\\/]" checks="[a-zA-Z0-9]*" />
<suppress files="[\\/]hapi-tinder-plugin[\\/]" checks="[a-zA-Z0-9]*" />
<suppress files="[\\/]osgi[\\/]" checks="[a-zA-Z0-9]*"/>
<!-- Name suppressions -->
<suppress files="Base64BinaryDt\.java" checks="AbstractClassName"/>
<!-- TODO KHS cdr instantiates these. Remove them once cdr has been fixed. -->
@ -16,4 +24,6 @@
<suppress files="RequestDetails\.java" checks="AbstractClassName"/>
<suppress files="RestfulClientFactory\.java" checks="AbstractClassName"/>
<suppress files="MatchUrlService\.java" checks="AbstractClassName"/>
<suppress files="BaseController\.java" checks="AbstractClassName"/>
</suppressions>

View File

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="severity" value="error"/>
<property name="charset" value="UTF-8"/>
<property name="fileExtensions" value="java, properties, xml, js, json"/>
<module name="TreeWalker">
<!-- Run custom HapiErrorCodeCheck to find duplicate error codes -->
<module name="ca.uhn.fhir.checks.HapiErrorCodeCheck"/>
<!-- Throw error if any FIX ME is left in the code -->
<module name="TodoComment">
<!-- The (?i) below means Case Insensitive -->
<property name="format" value="(?i)FIXME"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="System\.out\.println"/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="org\.jetbrains\.annotations\.NotNull"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="org\.jetbrains\.annotations\.Nullable"/>
</module>
<!-- Should always use the Spring transactional interface, per: https://stackoverflow.com/questions/26387399/javax-transaction-transactional-vs-org-springframework-transaction-annotation-tr -->
<module name="RegexpSinglelineJava">
<property name="format" value="javax\.transaction\.Transactional"/>
<property name="message"
value="Wrong @Transactional annotation used, use instead: org.springframework.transaction.annotation.Transactional"/>
</module>
<module name="AbstractClassName">
<property name="format" value="^(Base|Abstract).+$"/>
</module>
</module>
</module>

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.checks;
import com.puppycrawl.tools.checkstyle.StatelessCheck;
import com.puppycrawl.tools.checkstyle.FileStatefulCheck;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
@ -9,15 +9,13 @@ import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* mvn -P CI checkstyle:check
*/
@StatelessCheck
@FileStatefulCheck
public final class HapiErrorCodeCheck extends AbstractCheck {
private static final Logger ourLog = LoggerFactory.getLogger(HapiErrorCodeCheck.class);
private static final Map<Integer, String> ourCodesUsed = new HashMap<>();
private static final ErrorCodeCache ourCache = ErrorCodeCache.INSTANCE;
@Override
public int[] getDefaultTokens() {
@ -42,10 +40,6 @@ public final class HapiErrorCodeCheck extends AbstractCheck {
}
private void validateMessageCode(DetailAST theAst) {
// TODO KHS this should be done in the checkstyle plugin pom config, not here
if (getFileContents().getFileName().contains("/generated-sources/")) {
return;
}
DetailAST instantiation = theAst.getFirstChild().getFirstChild();
// We only expect message codes on new exception instantiations
if (TokenTypes.LITERAL_NEW != instantiation.getType()) {
@ -68,14 +62,13 @@ public final class HapiErrorCodeCheck extends AbstractCheck {
DetailAST numberNode = msgNode.getParent().getNextSibling().getFirstChild().getFirstChild();
if (TokenTypes.NUM_INT == numberNode.getType()) {
Integer code = Integer.valueOf(numberNode.getText());
if (ourCodesUsed.containsKey(code)) {
if (ourCache.containsKey(code)) {
log(theAst.getLineNo(), "Two different exception messages call Msg.code(" +
code +
"). Each thrown exception throw call Msg.code() with a different code. " +
"Previously found at: " + ourCodesUsed.get(code));
code + "). \nEach thrown exception must call Msg.code() with a different code. " +
"\nPreviously found at: " + ourCache.get(code));
} else {
String location = getFileContents().getFileName() + ":" + instantiation.getLineNo() + ":" + instantiation.getColumnNo() + "(" + code + ")";
ourCodesUsed.put(code, location);
String location = getFilePath() + ":" + instantiation.getLineNo() + ":" + instantiation.getColumnNo() + "(" + code + ")";
ourCache.put(code, location);
}
} else {
log(theAst.getLineNo(), "Called Msg.code() with a non-integer argument");
@ -110,5 +103,30 @@ public final class HapiErrorCodeCheck extends AbstractCheck {
}
return null;
}
public enum ErrorCodeCache {
INSTANCE;
private static final Map<Integer, String> ourCodesUsed = new HashMap<>();
ErrorCodeCache() {
}
public boolean containsKey(Integer s) {
return ourCodesUsed.containsKey(s);
}
public String get(Integer i) {
return ourCodesUsed.get(i);
}
public String put(Integer code, String location) {
return ourCodesUsed.put(code, location);
}
public Set<Integer> keySet() {
return ourCodesUsed.keySet();
}
}
}

View File

@ -44,12 +44,13 @@ class HapiErrorCodeCheckTest {
// validate
String[] errorLines = errors.toString().split("\r?\n");
Arrays.stream(errorLines).forEach(ourLog::info);
assertEquals(2, errorLines.length);
assertEquals(4, errorLines.length);
assertThat(errorLines[0], startsWith("[ERROR] "));
assertThat(errorLines[0], endsWith("BadClass.java:7: Exception thrown that does not call Msg.code() [HapiErrorCode]"));
assertThat(errorLines[1], startsWith("[ERROR] "));
assertThat(errorLines[1], containsString("BadClass.java:11: Two different exception messages call Msg.code(2). Each thrown exception throw call Msg.code() with a different code."));
assertThat(errorLines[1], containsString("BadClass.java:9:9"));
assertThat(errorLines[1], containsString("Two different exception messages call Msg.code(2258)."));
assertThat(errorLines[2], containsString("Each thrown exception must call Msg.code() with a different code."));
assertThat(errorLines[3], containsString("Previously found at:"));
}
private Checker buildChecker() throws CheckstyleException {

View File

@ -2,16 +2,15 @@ public class BadClass {
public void init() throws Exception {
int i = 1;
if (i == 0) {
throw new MessagingException(theMessage, Msg.code(6) + "Failure handling subscription payload", e);
throw new MessagingException(theMessage, Msg.code(2259) + "Failure handling subscription payload", e);
} else if (i == 1) {
throw new RuntimeException("nocode");
} else if (i == 2) {
throw new RuntimeException(Msg.code(2) + "duplicate code");
throw new RuntimeException(Msg.code(2258) + "duplicate code");
} else if (i == 3) {
throw new RuntimeException(Msg.code(2) + "duplicate code");
} else if (i == 4) {
throw new RuntimeException(Msg.code(1) + "good");
throw new RuntimeException(Msg.code(2258) + "duplicate code");
}
ClassCastException e = new ClassCastException();
throwException(i, e);
}

View File

@ -531,7 +531,7 @@ public abstract class BaseCommand implements Comparable<BaseCommand> {
return Optional.of(new TlsAuthentication(keyStoreInfo, trustStoreInfo));
}
catch(Exception e){
throw new RuntimeException(Msg.code(2115)+"Could not create TLS configuration options", e);
throw new RuntimeException(Msg.code(2253)+"Could not create TLS configuration options", e);
}
}

View File

@ -48,7 +48,7 @@ public class ValidationSupportChainCreator {
chain.addValidationSupport(localFileValidationSupport);
chain.addValidationSupport(new SnapshotGeneratingValidationSupport(ctx));
} catch (IOException e) {
throw new RuntimeException(Msg.code(2207) + "Failed to load local profile.", e);
throw new RuntimeException(Msg.code(2254) + "Failed to load local profile.", e);
}
}
if (commandLine.hasOption("r")) {

View File

@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.util;
* #L%
*/
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.util.StopWatch;
import com.google.common.collect.Queues;
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;

View File

@ -549,7 +549,7 @@ public class JpaBulkExportProcessor implements IBulkExportProcessor<JpaPid> {
Optional<RuntimeSearchParam> oPatientSearchParam = SearchParameterUtil.getOnlyPatientSearchParamForResourceType(myContext, theResource.fhirType());
if (!oPatientSearchParam.isPresent()) {
String errorMessage = String.format("[%s] has no search parameters that are for patients, so it is invalid for Group Bulk Export!", theResource.fhirType());
throw new IllegalArgumentException(Msg.code(2103) + errorMessage);
throw new IllegalArgumentException(Msg.code(2242) + errorMessage);
} else {
return oPatientSearchParam.get();
}

View File

@ -452,7 +452,7 @@ public class ExtendedHSearchClauseBuilder {
booleanStep.minimumShouldMatchNumber(1);
return booleanStep;
}
throw new IllegalArgumentException(Msg.code(2025) + "Date search param does not support prefix of type: " + prefix);
throw new IllegalArgumentException(Msg.code(2255) + "Date search param does not support prefix of type: " + prefix);
}
private PredicateFinalStep generateDateInstantSearchTerms(DateParam theDateParam, PathContext theSpContext) {
@ -496,7 +496,7 @@ public class ExtendedHSearchClauseBuilder {
return ((SearchPredicateFactory) theSpContext).range().field(lowerInstantField).atMost(upperBoundAsInstant);
}
throw new IllegalArgumentException(Msg.code(2026) + "Date search param does not support prefix of type: " + prefix);
throw new IllegalArgumentException(Msg.code(2256) + "Date search param does not support prefix of type: " + prefix);
}

View File

@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.util;
* #L%
*/
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.subscription.SocketImplementation;
import ca.uhn.fhir.rest.api.EncodingEnum;

View File

@ -35,7 +35,7 @@ public class NicknameMatcher implements IMdmStringMatcher {
try {
myNicknameSvc = new NicknameSvc();
} catch (IOException e) {
throw new ConfigurationException(Msg.code(2078) + "Unable to load nicknames", e);
throw new ConfigurationException(Msg.code(2234) + "Unable to load nicknames", e);
}
}

View File

@ -173,7 +173,7 @@ public class HashMapResourceProvider<T extends IBaseResource> implements IResour
TreeMap<Long, T> versions = myIdToVersionToResourceMap.get(theId.getIdPart());
if (versions == null || versions.isEmpty()) {
throw new ResourceNotFoundException(Msg.code(1979) + theId);
throw new ResourceNotFoundException(Msg.code(2250) + theId);
}
T deletedInstance = (T) myFhirContext.getResourceDefinition(myResourceType).newInstance();
@ -240,7 +240,7 @@ public class HashMapResourceProvider<T extends IBaseResource> implements IResour
public synchronized List<IBaseResource> historyInstance(@IdParam IIdType theId, RequestDetails theRequestDetails) {
LinkedList<T> retVal = myIdToHistory.get(theId.getIdPart());
if (retVal == null) {
throw new ResourceNotFoundException(Msg.code(1980) + theId);
throw new ResourceNotFoundException(Msg.code(2248) + theId);
}
return fireInterceptorsAndFilterAsNeeded(retVal, theRequestDetails);
@ -255,7 +255,7 @@ public class HashMapResourceProvider<T extends IBaseResource> implements IResour
public synchronized T read(@IdParam IIdType theId, RequestDetails theRequestDetails) {
TreeMap<Long, T> versions = myIdToVersionToResourceMap.get(theId.getIdPart());
if (versions == null || versions.isEmpty()) {
throw new ResourceNotFoundException(Msg.code(1981) + theId);
throw new ResourceNotFoundException(Msg.code(2247) + theId);
}
T retVal;
@ -271,14 +271,14 @@ public class HashMapResourceProvider<T extends IBaseResource> implements IResour
}
if (retVal == null || ResourceMetadataKeyEnum.DELETED_AT.get(retVal) != null) {
throw new ResourceGoneException(Msg.code(1983) + theId);
throw new ResourceGoneException(Msg.code(2244) + theId);
}
myReadCount.incrementAndGet();
retVal = fireInterceptorsAndFilterAsNeeded(retVal, theRequestDetails);
if (retVal == null) {
throw new ResourceNotFoundException(Msg.code(1984) + theId);
throw new ResourceNotFoundException(Msg.code(2243) + theId);
}
return retVal;
}

View File

@ -636,7 +636,7 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
@Read(typeName = "OperationDefinition")
public IBaseResource readOperationDefinition(@IdParam IIdType theId, RequestDetails theRequestDetails) {
if (theId == null || theId.hasIdPart() == false) {
throw new ResourceNotFoundException(Msg.code(1977) + theId);
throw new ResourceNotFoundException(Msg.code(2245) + theId);
}
RestfulServerConfiguration configuration = getServerConfiguration();
Bindings bindings = configuration.provideBindings();
@ -650,7 +650,7 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
if (searchBindings != null && !searchBindings.isEmpty()) {
return readOperationDefinitionForNamedSearch(searchBindings);
}
throw new ResourceNotFoundException(Msg.code(1978) + theId);
throw new ResourceNotFoundException(Msg.code(2249) + theId);
}
private String getOperationId(IIdType theId) {

View File

@ -122,7 +122,7 @@ public class FetchResourceIdsStep implements IFirstJobStepWorker<BulkExportJobPa
theDataSink.recoveredError(ex.getMessage());
throw new JobExecutionFailedException(Msg.code(2104) + " : " + ex.getMessage());
throw new JobExecutionFailedException(Msg.code(2239) + " : " + ex.getMessage());
}
ourLog.info("Submitted {} groups of ids for processing", submissionCount);

View File

@ -98,7 +98,7 @@ public class WriteBinaryStep implements IJobStepWorker<BulkExportJobParameters,
ex.getMessage());
ourLog.error(errorMsg);
throw new JobExecutionFailedException(Msg.code(2105) + errorMsg);
throw new JobExecutionFailedException(Msg.code(2238) + errorMsg);
}
DaoMethodOutcome outcome = binaryDao.create(binary,

View File

@ -72,7 +72,7 @@ public class Batch2JobRunnerImpl implements IBatch2JobRunner {
public Batch2JobInfo getJobInfo(String theJobId) {
JobInstance instance = myJobCoordinator.getInstance(theJobId);
if (instance == null) {
throw new ResourceNotFoundException(Msg.code(2102) + " : " + theJobId);
throw new ResourceNotFoundException(Msg.code(2240) + " : " + theJobId);
}
return fromJobInstanceToBatch2JobInfo(instance);
}

View File

@ -475,7 +475,7 @@ public class ServerCapabilityStatementProvider extends BaseServerCapabilityState
if (searchBindings != null && !searchBindings.isEmpty()) {
return readOperationDefinitionForNamedSearch(searchBindings);
}
throw new ResourceNotFoundException(Msg.code(1985) + theId);
throw new ResourceNotFoundException(Msg.code(2257) + theId);
}
private OperationDefinition readOperationDefinitionForNamedSearch(List<SearchMethodBinding> bindings) {

View File

@ -106,7 +106,7 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
@Override
public Map<String, NamingSystem> getNSUrlMap() {
throw new UnsupportedOperationException(Msg.code(2107));
throw new UnsupportedOperationException(Msg.code(2241));
}
@Override

View File

@ -66,7 +66,7 @@ public class RestServerDstu3Helper extends BaseRestServerHelper implements IPoin
try {
myRestServer.initialize();
} catch (ServletException e) {
throw new RuntimeException(Msg.code(2112)+"Failed to initialize server", e);
throw new RuntimeException(Msg.code(2252)+"Failed to initialize server", e);
}
}
}
@ -294,7 +294,7 @@ public class RestServerDstu3Helper extends BaseRestServerHelper implements IPoin
@Override
public MethodOutcome update(T theResource, String theConditional, RequestDetails theRequestDetails) {
if (myFailNextPut) {
throw new PreconditionFailedException(Msg.code(2113)+"Failed update operation");
throw new PreconditionFailedException(Msg.code(2251)+"Failed update operation");
}
return super.update(theResource, theConditional, theRequestDetails);
}

View File

@ -162,18 +162,18 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
@Override
public IWorkerContextManager.IPackageLoadingTracker getPackageTracker() {
throw new UnsupportedOperationException(Msg.code(2108));
throw new UnsupportedOperationException(Msg.code(2235));
}
@Override
public IWorkerContext setPackageTracker(
IWorkerContextManager.IPackageLoadingTracker packageTracker) {
throw new UnsupportedOperationException(Msg.code(2114));
throw new UnsupportedOperationException(Msg.code(2266));
}
@Override
public PackageInformation getPackageForUrl(String s) {
throw new UnsupportedOperationException(Msg.code(2109));
throw new UnsupportedOperationException(Msg.code(2236));
}
@Override
@ -410,7 +410,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
@Override
public Map<String, NamingSystem> getNSUrlMap() {
throw new UnsupportedOperationException(Msg.code(2111));
throw new UnsupportedOperationException(Msg.code(2265));
}
@Override

View File

@ -62,12 +62,6 @@
<build>
<plugins>
<!-- <plugin> <groupId>ca.uhn.hapi.fhir</groupId> <artifactId>hapi-tinder-plugin</artifactId> <version>1.0-SNAPSHOT</version> <executions> <execution> <id>structs</id> <goals> <goal>generate-structures</goal>
</goals> <configuration> <package>ca.uhn.tindertest</package> <baseResourceNames> <baseResourceName>patient</baseResourceName> <baseResourceName>valueset</baseResourceName> <baseResourceName>organization</baseResourceName>
<baseResourceName>device</baseResourceName> <baseResourceName>location</baseResourceName> <baseResourceName>practitioner</baseResourceName> </baseResourceNames> </configuration> </execution> <execution>
<id>client</id> <goals> <goal>generate-client</goal> </goals> <configuration> <clientClassName>ca.uhn.hitest.HiTest</clientClassName> <serverBaseHref>http://fhir.healthintersections.com.au/open</serverBaseHref>
<generateSearchForAllParams>true</generateSearchForAllParams> </configuration> </execution> </executions> </plugin> -->
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
@ -136,37 +130,6 @@
</dependency>
</dependencies>
<executions>
<!--
<execution>
<id>custom-structs</id>
<goals>
<goal>generate-structures</goal>
</goals>
<configuration>
<package>ca.uhn.test.customstructs</package>
<profileHttpBase>http://foo</profileHttpBase>
<version>dstu</version>
<resourceProfileFiles>
<resourceProfileFile>
<profileFile>${project.basedir}/src/test/resources/profile/patient.xml</profileFile>
<profileSourceUrl>http://foo1</profileSourceUrl>
</resourceProfileFile>
<resourceProfileFile>
<profileFile>${project.basedir}/src/test/resources/profile/organization.xml</profileFile>
<profileSourceUrl>http://foo1</profileSourceUrl>
</resourceProfileFile>
</resourceProfileFiles>
<resourceValueSetFiles>
<resourceValueSetFile>
<valueSetFile>${project.basedir}/src/test/resources/valueset/valueset-cgta-patientidpool.xml</valueSetFile>
</resourceValueSetFile>
<resourceValueSetFile>
<valueSetFile>${project.basedir}/src/test/resources/valueset/valueset-cgta-provideridpool.xml</valueSetFile>
</resourceValueSetFile>
</resourceValueSetFiles>
</configuration>
</execution>
-->
<execution>
<id>generalstructs</id>
<goals>
@ -383,8 +346,6 @@
</includeResources>
</configuration>
</execution>
<!-- <execution> <id>client</id> <goals> <goal>generate-client</goal> </goals> <configuration> <clientClassName>ca.uhn.hitest.HiTest</clientClassName> <serverBaseHref>http://fhir.healthintersections.com.au/open</serverBaseHref>
<generateSearchForAllParams>true</generateSearchForAllParams> </configuration> </execution> -->
</executions>
</plugin>
<plugin>
@ -420,7 +381,6 @@
targetPackage="ca.uhn.test.ant.multi.r5" filenameSuffix="ResourceTest.java" projectHome="${project.basedir}/.."
version="r5" includeResources="patient,organization" />
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm"
generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
targetFile="TestConfigDstu2.java" targetPackage="ca.uhn.test.ant.single" packageBase="ca.uhn.test.ant.multi"

126
pom.xml
View File

@ -865,15 +865,12 @@
</licenses>
<properties>
<fhir_core_version>5.6.84</fhir_core_version>
<ucum_version>1.0.3</ucum_version>
<surefire_jvm_args>-Dfile.encoding=UTF-8 -Xmx2048m</surefire_jvm_args>
<!-- configure timestamp in MANIFEST.MF for maven-war-provider -->
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- For site-deploy -->
@ -885,7 +882,9 @@
<apache_karaf_version>4.2.5</apache_karaf_version>
<aries_spifly_version>1.2</aries_spifly_version>
<caffeine_version>3.1.1</caffeine_version>
<checkstyle_version>10.4</checkstyle_version>
<checkstyle_version>10.6.0</checkstyle_version>
<maven_checkstyle_version>3.2.0</maven_checkstyle_version>
<maven_changes_version>2.12.1</maven_changes_version>
<commons_codec_version>1.15</commons_codec_version>
<commons_compress_version>1.21</commons_compress_version>
<commons_text_version>1.10.0</commons_text_version>
@ -893,7 +892,6 @@
<commons_lang3_version>3.12.0</commons_lang3_version>
<com_jamesmurty_utils_version>1.2</com_jamesmurty_utils_version>
<derby_version>10.14.2.0</derby_version>
<!--<derby_version>10.15.1.3</derby_version>-->
<error_prone_core_version>2.10.0</error_prone_core_version>
<mockito_version>4.8.1</mockito_version>
<nullaway_version>0.7.9</nullaway_version>
@ -2126,24 +2124,6 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle_version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-checkstyle</artifactId>
<!-- Remember to bump this when you upgrade the version -->
<version>6.5.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@ -2195,8 +2175,6 @@
<meminitial>500m</meminitial>
<maxmem>2000m</maxmem>
</configuration>
<dependencies>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -2309,6 +2287,11 @@
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty_version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>${maven_changes_version}</version>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
@ -2381,47 +2364,6 @@
<ignore></ignore>
</action>
</pluginExecution>
<!--
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
build-helper-maven-plugin
</artifactId>
<versionRange>
[1.9.1,)
</versionRange>
<goals>
<goal>add-source</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<versionRange>
[3.3,)
</versionRange>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
-->
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
@ -2483,6 +2425,7 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<inherited>false</inherited>
<executions>
@ -2770,7 +2713,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.12.1</version>
<version>${maven_changes_version}</version>
<inherited>false</inherited>
<reportSets>
<reportSet>
@ -2815,20 +2758,7 @@
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
<inherited>false</inherited>
<!--
<reportSets>
<reportSet>
<reports>
<report>team</report>
<report>issue-management</report>
<report>license</report>
<report>scm</report>
</reports>
</reportSet>
</reportSets>
-->
</plugin>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-linkcheck-plugin</artifactId> <version>1.1</version> </plugin> -->
</plugins>
</reporting>
@ -2903,22 +2833,23 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>validate</id>
<phase>generate-sources</phase>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<configLocation>${maven.multiModuleProjectDirectory}/src/checkstyle/checkstyle_config_nofixmes.xml</configLocation>
<inputEncoding>UTF-8</inputEncoding>
<consoleOutput>true</consoleOutput>
<failOnViolation>true</failOnViolation>
<failsOnError>false</failsOnError>
</configuration>
<goals>
<goal>check</goal>
</goals>
<id>delete-module-cache-file</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven_checkstyle_version}</version>
<executions>
<execution>
<id>hapi-single-module-checkstyle</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
@ -3011,13 +2942,6 @@
<execution><id>integration-test</id><phase>none</phase></execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution><id>validate</id><phase>none</phase></execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

View File

@ -1,192 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="cacheFile" value="target/cache_non_main_files"/>
<!-- <module name="SuppressionFilter">-->
<!-- <property name="file" value="${basedir}/src/checkstyle/checkstyle_suppressions.xml" />-->
<!-- </module> TODO GGG propagate this to master -->
<module name="TreeWalker">
<module name="RegexpSinglelineJava">
<property name="format" value="System\.out\.println"/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="org\.jetbrains\.annotations\.NotNull"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="org\.jetbrains\.annotations\.Nullable"/>
</module>
<!-- Should always use the Spring transactional interface, per: https://stackoverflow.com/questions/26387399/javax-transaction-transactional-vs-org-springframework-transaction-annotation-tr -->
<module name="RegexpSinglelineJava">
<property name="format" value="javax\.transaction\.Transactional"/>
<property name="message"
value="Wrong @Transactional annotation used, use instead: org.springframework.transaction.annotation.Transactional"/>
</module>
<module name="AbstractClassName">
<property name="format" value="^(Base|Abstract).+$"/>
</module>
</module>
<!--
<module name="TreeWalker">
<property name="tabWidth" value="3"/>
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Avoid using corresponding octal or Unicode escape."/>
</module>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="LineLength">
<property name="max" value="300"/>
<property name="ignorePattern"
value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="org.jetbrains.annotations.NotNull"/>
<property name="message" value="Incorrect NotNull annotation used: The &quot;javax.annotation.Nonnull&quot; annotation should be used for non-null things"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="org.jetbrains.annotations.Nullable"/>
<property name="message" value="Incorrect Nullable annotation used: The &quot;javax.annotation.Nullable&quot; annotation should be used for nullable things"/>
</module>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="RightCurly">
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
</module>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="FallThrough"/>
<module name="UpperEll"/>
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<message key="name.invalidPattern" value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="UncommentedMain"/>
<module name="Indentation">
<property name="basicOffset" value="3"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="0"/>
<property name="throwsIndent" value="6"/>
<property name="lineWrappingIndentation" value="6"/>
<property name="arrayInitIndent" value="3"/>
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
<module name="MethodParamPad"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
</module>
<module name="AnnotationLocation">
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="SummaryJavadocCheck">
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc"/>
</module>
-->
</module>

View File

@ -1,21 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name = "Checker">
<property name="severity" value="error"/>
<property name="charset" value="UTF-8"/>
<property name="fileExtensions" value="java, properties, xml, js, json"/>
<module name="TreeWalker">
<module name="TodoComment">
<!-- The (?i) below means Case Insensitive -->
<property name="format" value="(?i)FIXME"/>
</module>
<module name="ca.uhn.fhir.checks.HapiErrorCodeCheck"/>
</module>
</module>