diff --git a/build.gradle b/build.gradle index 89325d4..176e6a2 100644 --- a/build.gradle +++ b/build.gradle @@ -8,11 +8,10 @@ buildscript { } } plugins { - id 'com.github.ben-manes.versions' version '0.14.0' + id 'com.github.ben-manes.versions' version '0.15.0' } subprojects { - apply plugin: 'java' apply plugin: 'kotlin' apply plugin: 'maven' apply plugin: 'signing' @@ -21,6 +20,7 @@ subprojects { apply plugin: 'com.github.ben-manes.versions' sourceCompatibility = 1.7 + targetCompatibility = 1.7 group = 'ch.dissem.jabit' repositories { @@ -28,7 +28,7 @@ subprojects { maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" } diff --git a/core/build.gradle b/core/build.gradle index f43c541..ef0c51a 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -28,6 +28,6 @@ dependencies { compile 'ch.dissem.msgpack:msgpack:1.0.0' testCompile 'junit:junit:4.12' testCompile 'org.hamcrest:hamcrest-library:1.3' - testCompile 'com.nhaarman:mockito-kotlin:1.4.0' + testCompile 'com.nhaarman:mockito-kotlin:1.5.0' testCompile project(':cryptography-bc') } diff --git a/core/src/main/kotlin/ch/dissem/bitmessage/entity/NetworkMessage.kt b/core/src/main/kotlin/ch/dissem/bitmessage/entity/NetworkMessage.kt index d0c427a..c1a251d 100644 --- a/core/src/main/kotlin/ch/dissem/bitmessage/entity/NetworkMessage.kt +++ b/core/src/main/kotlin/ch/dissem/bitmessage/entity/NetworkMessage.kt @@ -40,7 +40,6 @@ data class NetworkMessage( return byteArrayOf(d[0], d[1], d[2], d[3]) } - @Throws(IOException::class) override fun write(out: OutputStream) { // magic Encode.int32(MAGIC, out) diff --git a/core/src/main/kotlin/ch/dissem/bitmessage/entity/Plaintext.kt b/core/src/main/kotlin/ch/dissem/bitmessage/entity/Plaintext.kt index 3dcf0dc..9a8c90e 100644 --- a/core/src/main/kotlin/ch/dissem/bitmessage/entity/Plaintext.kt +++ b/core/src/main/kotlin/ch/dissem/bitmessage/entity/Plaintext.kt @@ -36,14 +36,14 @@ import java.util.* import java.util.Collections import kotlin.collections.HashSet -internal fun message(encoding: Plaintext.Encoding, subject: String, body: String): ByteArray = when (encoding) { +private fun message(encoding: Plaintext.Encoding, subject: String, body: String): ByteArray = when (encoding) { SIMPLE -> "Subject:$subject\nBody:$body".toByteArray() EXTENDED -> Message.Builder().subject(subject).body(body).build().zip() TRIVIAL -> (subject + body).toByteArray() IGNORE -> ByteArray(0) } -internal fun ackData(type: Plaintext.Type, ackData: ByteArray?): ByteArray? { +private fun ackData(type: Plaintext.Type, ackData: ByteArray?): ByteArray? { if (ackData != null) { return ackData } else if (type == MSG) { @@ -54,7 +54,7 @@ internal fun ackData(type: Plaintext.Type, ackData: ByteArray?): ByteArray? { } /** - * The unencrypted message to be sent by 'msg' or 'broadcast'. + * A plaintext message before encryption or after decryption. */ class Plaintext private constructor( val type: Type, @@ -464,7 +464,7 @@ class Plaintext private constructor( } fun removeLabel(type: Label.Type) { - labels.removeIf { it.type == type } + labels.removeAll { it.type == type } } fun isUnread(): Boolean { diff --git a/core/src/main/kotlin/ch/dissem/bitmessage/entity/valueobject/Label.kt b/core/src/main/kotlin/ch/dissem/bitmessage/entity/valueobject/Label.kt index 7b221df..6fd4fd6 100644 --- a/core/src/main/kotlin/ch/dissem/bitmessage/entity/valueobject/Label.kt +++ b/core/src/main/kotlin/ch/dissem/bitmessage/entity/valueobject/Label.kt @@ -21,11 +21,11 @@ import java.util.* data class Label( private val label: String, - val type: Label.Type?, + val type: Label.Type? = null, /** * RGBA representation for the color. */ - var color: Int + var color: Int = 0 ) : Serializable { var id: Any? = null diff --git a/core/src/main/kotlin/ch/dissem/bitmessage/ports/AbstractCryptography.kt b/core/src/main/kotlin/ch/dissem/bitmessage/ports/AbstractCryptography.kt index b655bd1..f6b779b 100644 --- a/core/src/main/kotlin/ch/dissem/bitmessage/ports/AbstractCryptography.kt +++ b/core/src/main/kotlin/ch/dissem/bitmessage/ports/AbstractCryptography.kt @@ -111,7 +111,6 @@ abstract class AbstractCryptography protected constructor(@JvmField protected va } } - @Throws(GeneralSecurityException::class) protected fun doSign(data: ByteArray, privKey: java.security.PrivateKey): ByteArray { // TODO: change this to ALGORITHM_EVP_SHA256 once it's generally used in the network val sig = Signature.getInstance(ALGORITHM_ECDSA_SHA1, provider) @@ -121,7 +120,6 @@ abstract class AbstractCryptography protected constructor(@JvmField protected va } - @Throws(GeneralSecurityException::class) protected fun doCheckSignature(data: ByteArray, signature: ByteArray, publicKey: PublicKey): Boolean { for (algorithm in arrayOf(ALGORITHM_ECDSA_SHA1, ALGORITHM_EVP_SHA256)) { val sig = Signature.getInstance(algorithm, provider) diff --git a/cryptography-bc/build.gradle b/cryptography-bc/build.gradle index 9adb0b5..a1b7dff 100644 --- a/cryptography-bc/build.gradle +++ b/cryptography-bc/build.gradle @@ -12,8 +12,8 @@ uploadArchives { dependencies { compile project(':core') - compile 'org.bouncycastle:bcprov-jdk15on:1.56' + compile 'org.bouncycastle:bcprov-jdk15on:1.57' testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:2.7.21' + testCompile 'com.nhaarman:mockito-kotlin:1.5.0' testCompile project(path: ':core', configuration: 'testArtifacts') } diff --git a/cryptography-sc/build.gradle b/cryptography-sc/build.gradle index d69b841..b335a7c 100644 --- a/cryptography-sc/build.gradle +++ b/cryptography-sc/build.gradle @@ -12,8 +12,8 @@ uploadArchives { dependencies { compile project(':core') - compile 'com.madgag.spongycastle:prov:1.54.0.0' + compile 'com.madgag.spongycastle:prov:1.56.0.0' testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:2.7.21' + testCompile 'com.nhaarman:mockito-kotlin:1.5.0' testCompile project(path: ':core', configuration: 'testArtifacts') } diff --git a/demo/build.gradle b/demo/build.gradle index a00dcf4..3cda8ca 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -15,6 +15,7 @@ uploadArchives { } sourceCompatibility = 1.8 +targetCompatibility = 1.8 test.enabled = Boolean.valueOf(systemTestsEnabled) @@ -30,8 +31,8 @@ dependencies { compile project(':wif') compile 'org.slf4j:slf4j-simple:1.7.25' compile 'args4j:args4j:2.33' - compile 'com.h2database:h2:1.4.194' - compile 'org.apache.commons:commons-lang3:3.5' + compile 'com.h2database:h2:1.4.196' + compile 'org.apache.commons:commons-lang3:3.6' testCompile 'junit:junit:4.12' - testCompile 'com.nhaarman:mockito-kotlin:1.4.0' + testCompile 'com.nhaarman:mockito-kotlin:1.5.0' } diff --git a/extensions/build.gradle b/extensions/build.gradle index 1b3cc8b..188c581 100644 --- a/extensions/build.gradle +++ b/extensions/build.gradle @@ -30,7 +30,7 @@ dependencies { compile project(':core') testCompile 'junit:junit:4.12' testCompile 'org.slf4j:slf4j-simple:1.7.25' - testCompile 'org.mockito:mockito-core:2.7.21' + testCompile 'com.nhaarman:mockito-kotlin:1.5.0' testCompile project(path: ':core', configuration: 'testArtifacts') testCompile project(':cryptography-bc') } diff --git a/networking/build.gradle b/networking/build.gradle index 6ec5920..212ff46 100644 --- a/networking/build.gradle +++ b/networking/build.gradle @@ -14,7 +14,7 @@ dependencies { compile project(':core') testCompile 'junit:junit:4.12' testCompile 'org.slf4j:slf4j-simple:1.7.25' - testCompile 'com.nhaarman:mockito-kotlin:1.4.0' + testCompile 'com.nhaarman:mockito-kotlin:1.5.0' testCompile project(path: ':core', configuration: 'testArtifacts') testCompile project(':cryptography-bc') } diff --git a/repositories/build.gradle b/repositories/build.gradle index 1be3306..dfeb9ad 100644 --- a/repositories/build.gradle +++ b/repositories/build.gradle @@ -10,14 +10,12 @@ uploadArchives { } } -sourceCompatibility = 1.8 - dependencies { compile project(':core') - compile 'org.flywaydb:flyway-core:4.1.2' + compile 'org.flywaydb:flyway-core:4.2.0' testCompile 'junit:junit:4.12' - testCompile 'com.h2database:h2:1.4.194' - testCompile 'com.nhaarman:mockito-kotlin:1.4.0' + testCompile 'com.h2database:h2:1.4.196' + testCompile 'com.nhaarman:mockito-kotlin:1.5.0' testCompile project(path: ':core', configuration: 'testArtifacts') testCompile project(':cryptography-bc') } diff --git a/repositories/src/main/kotlin/ch/dissem/bitmessage/repository/JdbcInventory.kt b/repositories/src/main/kotlin/ch/dissem/bitmessage/repository/JdbcInventory.kt index 637c5dd..07d8efc 100644 --- a/repositories/src/main/kotlin/ch/dissem/bitmessage/repository/JdbcInventory.kt +++ b/repositories/src/main/kotlin/ch/dissem/bitmessage/repository/JdbcInventory.kt @@ -156,7 +156,7 @@ class JdbcInventory(config: JdbcConfig) : JdbcHelper(config), Inventory { } for (c in cache.values) { - c.entries.removeIf { e -> e.value < now - 5 * MINUTE } + c.entries.removeAll { e -> e.value < now - 5 * MINUTE } } } diff --git a/repositories/src/main/kotlin/ch/dissem/bitmessage/repository/JdbcMessageRepository.kt b/repositories/src/main/kotlin/ch/dissem/bitmessage/repository/JdbcMessageRepository.kt index ad5e834..0717e8e 100644 --- a/repositories/src/main/kotlin/ch/dissem/bitmessage/repository/JdbcMessageRepository.kt +++ b/repositories/src/main/kotlin/ch/dissem/bitmessage/repository/JdbcMessageRepository.kt @@ -235,7 +235,6 @@ class JdbcMessageRepository(private val config: JdbcConfig) : AbstractMessageRep } } - @Throws(SQLException::class, IOException::class) private fun update(connection: Connection, message: Plaintext) { connection.prepareStatement( "UPDATE Message SET iv=?, type=?, sender=?, recipient=?, data=?, ack_data=?, sent=?, received=?, " + diff --git a/wif/build.gradle b/wif/build.gradle index cf317e5..0f2bb35 100644 --- a/wif/build.gradle +++ b/wif/build.gradle @@ -14,7 +14,6 @@ dependencies { compile project(':core') compile 'org.ini4j:ini4j:0.5.4' testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:2.7.21' - testCompile 'com.nhaarman:mockito-kotlin:1.4.0' + testCompile 'com.nhaarman:mockito-kotlin:1.5.0' testCompile project(':cryptography-bc') }