From a47b570d167869e508e224e17a56deeafa71e7d8 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 10 May 2017 09:52:24 -0700 Subject: [PATCH] Fix the bogus default value for getProperty(). --- .../src/main/kotlin/com/beust/kobalt/misc/GithubApi2.kt | 4 ++-- .../src/main/kotlin/com/beust/kobalt/misc/LocalProperties.kt | 4 ++-- .../kotlin/com/beust/kobalt/plugin/publish/PublishPlugin.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/GithubApi2.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/GithubApi2.kt index 9f89a01d..0c235181 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/GithubApi2.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/GithubApi2.kt @@ -120,8 +120,8 @@ class GithubApi2 @Inject constructor( Duration.between(VersionCheckTimestampFile.timestamp, Instant.now())) { kobaltLog(2, "Skipping GitHub latest release check, too soon.") } else { - val username = localProperties.getNoThrows(PROPERTY_USERNAME, DOC_URL) - val accessToken = localProperties.getNoThrows(PROPERTY_ACCESS_TOKEN, DOC_URL) + val username = localProperties.getNoThrows(PROPERTY_USERNAME) + val accessToken = localProperties.getNoThrows(PROPERTY_ACCESS_TOKEN) try { val req = if (username != null && accessToken != null) { diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/LocalProperties.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/LocalProperties.kt index 64cecbb4..2cf0775e 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/LocalProperties.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/LocalProperties.kt @@ -25,10 +25,10 @@ class LocalProperties { result } - fun getNoThrows(name: String, docUrl: String? = null): String? = localProperties.getProperty(name, docUrl) + fun getNoThrows(name: String): String? = localProperties.getProperty(name) fun get(name: String, docUrl: String? = null) : String { - val result = getNoThrows(name, docUrl) + val result = getNoThrows(name) ?: throw KobaltException("Couldn't find $name in local.properties", docUrl = docUrl) return result } diff --git a/src/main/kotlin/com/beust/kobalt/plugin/publish/PublishPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/publish/PublishPlugin.kt index bcbaab10..3af3b402 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/publish/PublishPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/publish/PublishPlugin.kt @@ -117,7 +117,7 @@ class PublishPlugin @Inject constructor(val files: KFiles, val factory: PomGener val docUrl = DocUrl.PUBLISH_PLUGIN_URL val user = localProperties.get(PROPERTY_BINTRAY_USER, docUrl) val password = localProperties.get(PROPERTY_BINTRAY_PASSWORD, docUrl) - val org = localProperties.getNoThrows(PROPERTY_BINTRAY_ORG, docUrl) + val org = localProperties.getNoThrows(PROPERTY_BINTRAY_ORG) val jcenter = bintrayFactory.create(user, password, org) var success = false