Commit 7c0ae8a5 authored by Thomas Bernhart's avatar Thomas Bernhart
Browse files

MEMO-733: Remove try-catch blocks from Ingester

parent 5ada2f49
......@@ -76,15 +76,10 @@ class Ingester(
instantiations.forEach { instantiationPair ->
val instantiationOutput = StringWriter()
instantiationPair.second.write(instantiationOutput, "NTRIPLES")
try {
val instantiationData = instantiationOutput.toString()
log.info("Ingesting instantiation ${instantiationPair.first}.")
transaction.createOrUpdateRdfResource(URI(instantiationPair.first), instantiationData, RdfContentTypes.NTRIPLES)
log.info("Ingested instantiation ${instantiationPair.first}.")
} catch (ex: FcrepoOperationFailedException) {
log.error("Ingestion of instantiation ${instantiationPair.first} failed: ${ex.localizedMessage}.")
throw ex
}
val instantiationData = instantiationOutput.toString()
log.info("Ingesting instantiation ${instantiationPair.first}.")
transaction.createOrUpdateRdfResource(URI(instantiationPair.first), instantiationData, RdfContentTypes.NTRIPLES)
log.info("Ingested instantiation ${instantiationPair.first}.")
}
}
......@@ -97,16 +92,11 @@ class Ingester(
if (path != null) {
sftpClient.open(File(path)).use { stream ->
val binaryUri = "${it.first}/binary"
try {
val mimeType = rdfHandler.getMimeType().first { mT ->
mT.first == digitalInstantiationUrl
}.second
log.info("Ingesting binary $binaryUri with mime type $mimeType.")
transaction.createOrUpdateBinaryResource(URI(binaryUri), stream, mimeType)
} catch (ex: FcrepoOperationFailedException) {
log.error("Ingestion of binary $binaryUri failed: ${ex.localizedMessage}.")
throw ex
}
val mimeType = rdfHandler.getMimeType().first { mT ->
mT.first == digitalInstantiationUrl
}.second
log.info("Ingesting binary $binaryUri with mime type $mimeType.")
transaction.createOrUpdateBinaryResource(URI(binaryUri), stream, mimeType)
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment