Re-throwing handled exception as configuration exceptions

This commit is contained in:
Sean McIlvenna
2019-02-06 22:38:59 -08:00
parent 7a96e96996
commit 19c22e0a0d
2 changed files with 6 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory;
import ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect;
@@ -82,16 +83,8 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
try {
retVal.setDataSource(dataSource());
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (Exception e) {
throw new ConfigurationException("Could not set the data source due to a configuration issue", e);
}
retVal.setJpaProperties(jpaProperties());

View File

@@ -1,5 +1,6 @@
package ca.uhn.fhir.jpa.demo;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.server.ETagSupportEnum;
@@ -45,10 +46,8 @@ public class HapiProperties {
HapiProperties.properties = new Properties();
HapiProperties.properties.load(in);
in.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
throw new ConfigurationException("Could not load HAPI properties", e);
}
}