Provide useful error message if db iterator is left on stack during checkpointing

AutoCloseables in general are also forbidden as restoring them across node restarts is not supported.
This commit is contained in:
Shams Asari
2017-04-18 12:13:31 +01:00
parent 66890d845a
commit 8e0a0ba8fb
3 changed files with 43 additions and 5 deletions

View File

@ -14,11 +14,11 @@ import net.corda.core.utilities.Emoji
import net.corda.core.utilities.ProgressTracker
import net.corda.core.utilities.unwrap
import net.corda.flows.TwoPartyTradeFlow
import java.nio.file.Path
import java.nio.file.Paths
import java.util.*
class BuyerFlow(val otherParty: Party,
private val attachmentsPath: Path,
private val attachmentsDirectory: String,
override val progressTracker: ProgressTracker = ProgressTracker(STARTING_BUY)) : FlowLogic<Unit>() {
object STARTING_BUY : ProgressTracker.Step("Seller connected, purchasing commercial paper asset")
@ -31,7 +31,7 @@ class BuyerFlow(val otherParty: Party,
it.automaticallyExtractAttachments = true
it.storePath
}
services.registerFlowInitiator(SellerFlow::class.java) { BuyerFlow(it, attachmentsPath) }
services.registerFlowInitiator(SellerFlow::class.java) { BuyerFlow(it, attachmentsPath.toString()) }
}
}
@ -73,7 +73,7 @@ class BuyerFlow(val otherParty: Party,
val cpIssuance = search.call().single()
cpIssuance.attachments.first().let {
val p = attachmentsPath.toAbsolutePath().resolve("$it.jar")
val p = Paths.get(attachmentsDirectory, "$it.jar")
println("""
The issuance of the commercial paper came with an attachment. You can find it expanded in this directory: