improvement to sesame error handling
This commit is contained in:
parent
24eaf20b4b
commit
a3472b4fe8
1 changed files with 7 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue