ENT-2040 - Remove dependency on PathUtilsKt in net.corda.core.internal (#1141)

This commit is contained in:
Tommy Lillehagen 2018-06-29 09:58:46 +01:00 committed by Michele Sollecito
parent 2d61c76d9d
commit 374b3d0a41
2 changed files with 18 additions and 3 deletions

View File

@ -99,6 +99,8 @@ The following lists known issues identified in this release. We will endeavour t
* Doorman crashes ungracefully when started with incorrect or no program arguments. Should display a meaningful message instead. [ENT-1661]
* The finance CorDapp from Open Source versions 3.0 and 3.1 cannot be loaded on Enterprise 3.0 GA. Use the Enterprise CorDapp on any Open Source nodes in a mixed network instead, or use contract whitelisting. [ENT-2040]
* Exception when starting a Corda node against a non-H2 database the first time. [ENT-1635]
This means the :ref:`database schema management <database_migration_ref>` process should be performed but the exception is confusing.
@ -137,4 +139,4 @@ and simply requires setting two Gradle build file variables:
Please note this release is distributed under the evaluation license and should not be used in a Production environment yet.
We look forward to hearing your feedback on this release!
We look forward to hearing your feedback on this release!

View File

@ -15,8 +15,6 @@ import com.typesafe.config.ConfigFactory
import net.corda.core.flows.FlowLogic
import net.corda.core.flows.StartableByRPC
import net.corda.core.internal.declaredField
import net.corda.core.internal.div
import net.corda.core.internal.read
import net.corda.core.node.AppServiceHub
import net.corda.core.node.services.CordaService
import net.corda.core.serialization.CordaSerializable
@ -26,7 +24,15 @@ import net.corda.finance.EUR
import net.corda.finance.GBP
import net.corda.finance.USD
import net.corda.finance.flows.ConfigHolder.Companion.supportedCurrencies
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.nio.charset.Charset
import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file.Files
import java.nio.file.OpenOption
import java.nio.file.Path
import java.nio.file.Paths
import java.util.*
// TODO Until apps have access to their own config, we'll hack things by first getting the baseDirectory, read the node.conf
@ -35,6 +41,13 @@ import java.util.*
class ConfigHolder(services: AppServiceHub) : SingletonSerializeAsToken() {
companion object {
val supportedCurrencies = listOf(USD, GBP, CHF, EUR)
// TODO: ENT-2040 - After GA, the Finance app should be fully decoupled from use of internal APIs on both OS and ENT!
private operator fun Path.div(other: String): Path = resolve(other)
private operator fun String.div(other: String): Path = Paths.get(this) / other
private fun Path.inputStream(vararg options: OpenOption): InputStream = Files.newInputStream(this, *options)
private fun Path.reader(charset: Charset = UTF_8): BufferedReader = Files.newBufferedReader(this, charset)
private inline fun <R> Path.read(vararg options: OpenOption, block: (InputStream) -> R): R = inputStream(*options).use(block)
}
val issuableCurrencies: List<Currency>