From eb9bd10da002284cba14fe890da421979d94f102 Mon Sep 17 00:00:00 2001 From: Hristo Gatsinski Date: Wed, 14 Nov 2018 19:50:55 +0200 Subject: [PATCH] [CORDA-2219] Show message if CorDapp already exists (#4236) * [CORDA-2219] Show message if CorDapp already exists * Update definition of `net.corda.core.node.services.Vault$StateMetadata` in `api-current.txt` or else diff tool gets very confused. --- .ci/api-current.txt | 15 +++++++++++++++ .../internal/network/NetworkBootstrapper.kt | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.ci/api-current.txt b/.ci/api-current.txt index 60c75c3c18..0028c8444c 100644 --- a/.ci/api-current.txt +++ b/.ci/api-current.txt @@ -3292,8 +3292,12 @@ public static final class net.corda.core.node.services.Vault$Page extends java.l @CordaSerializable public static final class net.corda.core.node.services.Vault$StateMetadata extends java.lang.Object public (net.corda.core.contracts.StateRef, String, java.time.Instant, java.time.Instant, net.corda.core.node.services.Vault$StateStatus, net.corda.core.identity.AbstractParty, String, java.time.Instant) + public (net.corda.core.contracts.StateRef, String, java.time.Instant, java.time.Instant, net.corda.core.node.services.Vault$StateStatus, net.corda.core.identity.AbstractParty, String, java.time.Instant, net.corda.core.node.services.Vault$RelevancyStatus) + public (net.corda.core.contracts.StateRef, String, java.time.Instant, java.time.Instant, net.corda.core.node.services.Vault$StateStatus, net.corda.core.identity.AbstractParty, String, java.time.Instant, net.corda.core.node.services.Vault$RelevancyStatus, net.corda.core.node.services.Vault$ConstraintInfo) @NotNull public final net.corda.core.contracts.StateRef component1() + @Nullable + public final net.corda.core.node.services.Vault$ConstraintInfo component10() @NotNull public final String component2() @NotNull @@ -3308,10 +3312,18 @@ public static final class net.corda.core.node.services.Vault$StateMetadata exten public final String component7() @Nullable public final java.time.Instant component8() + @Nullable + public final net.corda.core.node.services.Vault$RelevancyStatus component9() @NotNull public final net.corda.core.node.services.Vault$StateMetadata copy(net.corda.core.contracts.StateRef, String, java.time.Instant, java.time.Instant, net.corda.core.node.services.Vault$StateStatus, net.corda.core.identity.AbstractParty, String, java.time.Instant) + @NotNull + public final net.corda.core.node.services.Vault$StateMetadata copy(net.corda.core.contracts.StateRef, String, java.time.Instant, java.time.Instant, net.corda.core.node.services.Vault$StateStatus, net.corda.core.identity.AbstractParty, String, java.time.Instant, net.corda.core.node.services.Vault$RelevancyStatus) + @NotNull + public final net.corda.core.node.services.Vault$StateMetadata copy(net.corda.core.contracts.StateRef, String, java.time.Instant, java.time.Instant, net.corda.core.node.services.Vault$StateStatus, net.corda.core.identity.AbstractParty, String, java.time.Instant, net.corda.core.node.services.Vault$RelevancyStatus, net.corda.core.node.services.Vault$ConstraintInfo) public boolean equals(Object) @Nullable + public final net.corda.core.node.services.Vault$ConstraintInfo getConstraintInfo() + @Nullable public final java.time.Instant getConsumedTime() @NotNull public final String getContractStateClassName() @@ -3325,9 +3337,12 @@ public static final class net.corda.core.node.services.Vault$StateMetadata exten public final java.time.Instant getRecordedTime() @NotNull public final net.corda.core.contracts.StateRef getRef() + @Nullable + public final net.corda.core.node.services.Vault$RelevancyStatus getRelevancyStatus() @NotNull public final net.corda.core.node.services.Vault$StateStatus getStatus() public int hashCode() + @NotNull public String toString() ## @CordaSerializable diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/network/NetworkBootstrapper.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/network/NetworkBootstrapper.kt index c3a7fd71e9..52138854a4 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/network/NetworkBootstrapper.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/network/NetworkBootstrapper.kt @@ -33,6 +33,7 @@ import net.corda.serialization.internal.amqp.AbstractAMQPSerializationScheme import net.corda.serialization.internal.amqp.amqpMagic import java.io.File import java.io.InputStream +import java.nio.file.FileAlreadyExistsException import java.nio.file.Path import java.nio.file.StandardCopyOption.REPLACE_EXISTING import java.security.PublicKey @@ -226,7 +227,13 @@ internal constructor(private val initSerEnv: Boolean, println("Copying CorDapp JARs into node directories") for (nodeDir in nodeDirs) { val cordappsDir = (nodeDir / "cordapps").createDirectories() - cordappJars.forEach { it.copyToDirectory(cordappsDir) } + cordappJars.forEach { + try { + it.copyToDirectory(cordappsDir) + } catch (e: FileAlreadyExistsException) { + println("WARNING: ${it.fileName} already exists in $cordappsDir, ignoring and leaving existing CorDapp untouched") + } + } } } generateServiceIdentitiesForNotaryClusters(configs)