experimental: Fix compile errors

This commit is contained in:
Andras Slemmer 2016-09-12 14:34:11 +01:00
parent 9f6415efab
commit 836933d223
2 changed files with 7 additions and 8 deletions

View File

@ -4,7 +4,6 @@ import com.r3corda.core.contracts.*
import com.r3corda.core.crypto.Party
import com.r3corda.core.crypto.SecureHash
import com.r3corda.core.transactions.TransactionBuilder
import com.sun.tools.corba.se.idl.InvalidArgument
import java.math.BigDecimal
import java.security.PublicKey
import java.time.Instant
@ -174,7 +173,7 @@ class UniversalContract : Contract {
val arr = when (inState.details) {
is Actions -> inState.details
is RollOut -> reduceRollOut(inState.details)
else -> throw InvalidArgument("Unexpected arrangement, " + tx.inputs.single())
else -> throw IllegalArgumentException("Unexpected arrangement, " + tx.inputs.single())
}
val actions = actions(arr)
@ -238,7 +237,7 @@ class UniversalContract : Contract {
val arr = when (inState.details) {
is Actions -> inState.details
is RollOut -> reduceRollOut(inState.details)
else -> throw InvalidArgument("Unexpected arrangement, " + tx.inputs.single())
else -> throw IllegalArgumentException("Unexpected arrangement, " + tx.inputs.single())
}
val outState = tx.outputs.single() as State

View File

@ -5,10 +5,7 @@ import com.google.common.collect.Sets
import com.r3corda.core.contracts.Amount
import com.r3corda.core.contracts.Frequency
import com.r3corda.core.crypto.Party
import com.sun.javaws.exceptions.InvalidArgumentException
import com.sun.org.apache.xpath.internal.operations.Bool
import com.sun.tools.corba.se.idl.InvalidArgument
import com.sun.tools.javadoc.Start
import java.math.BigDecimal
import java.security.PublicKey
import java.time.Instant
@ -96,7 +93,10 @@ fun actions(arrangement: Arrangement): Map<String, Action> = when (arrangement)
is Transfer -> mapOf()
is Actions -> arrangement.actions.map { it.name to it }.toMap()
is And -> arrangement.arrangements.map { actions(it) }.fold(mutableMapOf()) { m, x ->
x.forEach { s, action -> m[s] = action }
x.forEach { entry ->
val (s, action) = entry
m[s] = action
}
m
}
is RollOut -> mapOf()
@ -208,4 +208,4 @@ fun debugCompare(arrLeft: Arrangement, arrRight: Arrangement) {
}
assert( false)
}
}