From a3472b4fe8a0f467153fa792c82a189b9b07650d Mon Sep 17 00:00:00 2001 From: bjl23 Date: Tue, 5 Oct 2010 17:36:02 +0000 Subject: [PATCH] improvement to sesame error handling --- .../mannlib/vitro/webapp/utils/jena/SesameSyncUtils.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/jena/SesameSyncUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/jena/SesameSyncUtils.java index 28c56e374..f5b166f69 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/jena/SesameSyncUtils.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/jena/SesameSyncUtils.java @@ -7,6 +7,8 @@ import java.io.OutputStream; import java.io.PipedInputStream; import java.io.PipedOutputStream; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.openrdf.model.Resource; import org.openrdf.model.impl.URIImpl; import org.openrdf.repository.Repository; @@ -21,6 +23,8 @@ import com.hp.hpl.jena.rdf.model.Model; public class SesameSyncUtils { + private static final Log log = LogFactory.getLog(SesameSyncUtils.class); + public void writeModelToSesameContext (Model jenaModel, String serverURI, String repositoryId, String contextId) throws RepositoryException, IOException, RDFParseException { @@ -55,9 +59,11 @@ public class SesameSyncUtils { myConn.commit(); - } catch (Exception e) { + } catch (Throwable e) { myConn.rollback(); e.printStackTrace(); + log.error("Error writing to Sesame repository", e); + throw new RuntimeException("Error writing to Sesame repository", e); } finally { myConn.close(); }