From c8adab545276d203ad410ba367c7696d179d4b6e Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 23 Dec 2014 09:42:16 -0500 Subject: [PATCH] Better logging in JPA --- hapi-fhir-base/pom.xml | 8 ++--- hapi-fhir-jpaserver-base/.classpath | 10 ------ .../org.eclipse.wst.common.component | 2 -- hapi-fhir-jpaserver-base/pom.xml | 2 +- .../java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java | 21 +++++++++++-- .../uhn/fhir/jpa/entity/BaseHasResource.java | 2 ++ .../fhir/jpa/entity/ResourceHistoryTable.java | 4 +++ .../org.eclipse.wst.common.component | 3 ++ .../org.eclipse.wst.common.component.orig | 31 +++++++++++-------- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 2 +- hapi-tinder-plugin/pom.xml | 8 ++--- pom.xml | 20 +++++++----- restful-server-example/pom.xml | 2 +- src/changes/changes.xml | 10 ++++++ 14 files changed, 79 insertions(+), 46 deletions(-) diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 4c4c88ea089..e22ca1503d5 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -88,12 +88,12 @@ commons-codec commons-codec - 1.9 + ${commons_codec_version} commons-io commons-io - 2.4 + ${commons_io_version} @@ -118,7 +118,7 @@ org.apache.httpcomponents httpclient - 4.3.3 + ${apache_httpclient_version} commons-logging @@ -129,7 +129,7 @@ org.apache.httpcomponents httpcore - 4.3.2 + ${apache_httpcore_version} diff --git a/hapi-fhir-jpaserver-base/.classpath b/hapi-fhir-jpaserver-base/.classpath index 77ae23ab4aa..caa2612fd4f 100644 --- a/hapi-fhir-jpaserver-base/.classpath +++ b/hapi-fhir-jpaserver-base/.classpath @@ -26,15 +26,5 @@ - - - - - - - - - - diff --git a/hapi-fhir-jpaserver-base/.settings/org.eclipse.wst.common.component b/hapi-fhir-jpaserver-base/.settings/org.eclipse.wst.common.component index dc4d46e13ac..4e5bc0108c7 100644 --- a/hapi-fhir-jpaserver-base/.settings/org.eclipse.wst.common.component +++ b/hapi-fhir-jpaserver-base/.settings/org.eclipse.wst.common.component @@ -2,7 +2,5 @@ - - diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 4e2a36abb46..a77b7084d86 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -263,7 +263,7 @@ de.juplo hibernate4-maven-plugin - 1.0.2 + 1.0.5 true SCRIPT diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java index cd3a142e583..400eff15302 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java @@ -743,8 +743,25 @@ public abstract class BaseFhirDao implements IDao { } IParser parser = theEntity.getEncoding().newParser(getContext(theEntity.getFhirVersion())); - T retVal = parser.parseResource(theResourceType, resourceText); - + T retVal; + try { + retVal = parser.parseResource(theResourceType, resourceText); + } catch (Exception e) { + StringBuilder b = new StringBuilder(); + b.append("Failed to parse database resource["); + b.append(theResourceType); + b.append("/"); + b.append(theEntity.getIdDt().getIdPart()); + b.append(" (pid "); + b.append(theEntity.getId()); + b.append(", version "); + b.append(myContext.getVersion().getVersion()); + b.append("): "); + b.append(e.getMessage()); + String msg = b.toString(); + ourLog.error(msg, e); + throw new DataFormatException(msg, e); + } IResource res = (IResource) retVal; res.setId(theEntity.getIdDt()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java index 863fea48820..60e4d1a0d30 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java @@ -107,6 +107,8 @@ public abstract class BaseHasResource { myDeleted = theDate; } + public abstract Long getId(); + public void setEncoding(ResourceEncodingEnum theEncoding) { myEncoding = theEncoding; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceHistoryTable.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceHistoryTable.java index 704e78e0f47..a10b4627c0d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceHistoryTable.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceHistoryTable.java @@ -67,6 +67,10 @@ public class ResourceHistoryTable extends BaseHasResource implements Serializabl return historyTag; } + public Long getId() { + return myId; + } + @Override public IdDt getIdDt() { Object id = getForcedId()==null? getResourceId() : getForcedId().getForcedId(); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/.settings/org.eclipse.wst.common.component b/hapi-fhir-jpaserver-uhnfhirtest/.settings/org.eclipse.wst.common.component index 124f33524d7..7d2c3dbcedf 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/.settings/org.eclipse.wst.common.component +++ b/hapi-fhir-jpaserver-uhnfhirtest/.settings/org.eclipse.wst.common.component @@ -14,6 +14,9 @@ uses + + uses + consumes diff --git a/hapi-fhir-jpaserver-uhnfhirtest/.settings/org.eclipse.wst.common.component.orig b/hapi-fhir-jpaserver-uhnfhirtest/.settings/org.eclipse.wst.common.component.orig index 951bce12d13..f4c72946dd5 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/.settings/org.eclipse.wst.common.component.orig +++ b/hapi-fhir-jpaserver-uhnfhirtest/.settings/org.eclipse.wst.common.component.orig @@ -2,24 +2,29 @@ - - - uses - - - uses - - - uses - <<<<<<< HEAD - + + uses + + + uses + + ======= - ->>>>>>> d22a35788f57e9f7ce64bc8afc2ee7eaf29d94f2 + + uses + + + uses + + + uses + + +>>>>>>> hl7org_structs consumes diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index c898a9bf335..11e6b282c0c 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -109,7 +109,7 @@ com.google.guava guava - 17.0 + ${guava_version} diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index 9ffec4fb7e7..f32293b6a50 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -60,19 +60,19 @@ commons-io commons-io - 2.4 + ${commons_io_version} org.slf4j slf4j-api - 1.7.6 + ${slf4j_version} ch.qos.logback logback-classic - 1.1.1 + ${logback_version} true @@ -93,7 +93,7 @@ org.apache.maven maven-plugin-api - 3.2.1 + 3.2.5 org.apache.maven.plugin-tools diff --git a/pom.xml b/pom.xml index dd9f36e685d..7db64c17575 100644 --- a/pom.xml +++ b/pom.xml @@ -136,15 +136,19 @@ ${user.home}/sites/scm/hapi-fhir + 4.3.6 + 4.4 + 2.4 3.3.2 + 1.10 10.11.1.1 18.0 1.3 - 4.2.12.Final + 4.3.7.Final 5.1.0.Final - 9.2.2.v20140723 + 9.2.6.v20141205 4.3.1 - 4.11 + 4.12 1.1.2 2.4.1 2.10.1 @@ -153,15 +157,15 @@ 3.4 2.3 1.1.8 - 1.9.5 + 1.10.17 2.7.1 - 4.3.3 + 4.3.5 UTF-8 3.1.0 - 1.7.7 - 4.1.0.RELEASE + 1.7.9 + 4.1.3.RELEASE 3.2.4.RELEASE - 2.1.3.RELEASE + 2.1.4.RELEASE 1.0.1 4.4.0 diff --git a/restful-server-example/pom.xml b/restful-server-example/pom.xml index f7aec12b3c7..74994fd5057 100644 --- a/restful-server-example/pom.xml +++ b/restful-server-example/pom.xml @@ -80,7 +80,7 @@ org.thymeleaf thymeleaf - 2.1.3.RELEASE + 2.1.4.RELEASE diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 0e95f8d4fd2..2b9c3fd98e6 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -16,6 +16,16 @@ (e.g. because they don't have a no-argument constructor) in order to avoid failing later + + Bump a few dependency JARs to the latest versions in Maven POM: + +
  • SLF4j (in base module) - Bumped to 1.7.9
  • +
  • Apache HTTPClient (in base module) - Bumped to 4.3.6
  • +
  • Hibernate (in JPA module) - Bumped to 4.3.7
  • + + ]]> +