improvement to sesame error handling

This commit is contained in:
bjl23 2010-10-05 17:36:02 +00:00
parent 24eaf20b4b
commit a3472b4fe8

View file

@ -7,6 +7,8 @@ import java.io.OutputStream;
import java.io.PipedInputStream; import java.io.PipedInputStream;
import java.io.PipedOutputStream; 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.Resource;
import org.openrdf.model.impl.URIImpl; import org.openrdf.model.impl.URIImpl;
import org.openrdf.repository.Repository; import org.openrdf.repository.Repository;
@ -21,6 +23,8 @@ import com.hp.hpl.jena.rdf.model.Model;
public class SesameSyncUtils { public class SesameSyncUtils {
private static final Log log = LogFactory.getLog(SesameSyncUtils.class);
public void writeModelToSesameContext public void writeModelToSesameContext
(Model jenaModel, String serverURI, String repositoryId, String contextId) (Model jenaModel, String serverURI, String repositoryId, String contextId)
throws RepositoryException, IOException, RDFParseException { throws RepositoryException, IOException, RDFParseException {
@ -55,9 +59,11 @@ public class SesameSyncUtils {
myConn.commit(); myConn.commit();
} catch (Exception e) { } catch (Throwable e) {
myConn.rollback(); myConn.rollback();
e.printStackTrace(); e.printStackTrace();
log.error("Error writing to Sesame repository", e);
throw new RuntimeException("Error writing to Sesame repository", e);
} finally { } finally {
myConn.close(); myConn.close();
} }