Minor: run code cleanup inspections

This commit is contained in:
Mike Hearn
2017-04-11 13:09:58 +02:00
parent e62250ff7b
commit c097229935
41 changed files with 69 additions and 80 deletions

View File

@ -202,12 +202,12 @@ abstract class MQSecurityTest : NodeBasedTest() {
fun assertSendAttackFails(address: String) {
val message = attacker.createMessage()
assertEquals(true, attacker.producer.isBlockOnNonDurableSend())
assertEquals(true, attacker.producer.isBlockOnNonDurableSend)
assertAttackFails(address, "SEND") {
attacker.producer.send(address, message)
}
assertEquals(0, message.getDeliveryCount())
assertEquals(0, message.getBodySize())
assertEquals(0, message.deliveryCount)
assertEquals(0, message.bodySize)
}
fun assertConsumeAttackFails(queue: String) {

View File

@ -16,7 +16,7 @@ import javax.annotation.concurrent.ThreadSafe
* Simple identity service which caches parties and provides functionality for efficient lookup.
*/
@ThreadSafe
class InMemoryIdentityService() : SingletonSerializeAsToken(), IdentityService {
class InMemoryIdentityService : SingletonSerializeAsToken(), IdentityService {
companion object {
private val log = loggerFor<InMemoryIdentityService>()
}

View File

@ -153,7 +153,7 @@ class NodeMessagingClient(override val config: NodeConfiguration,
// TODO Add broker CN to config for host verification in case the embedded broker isn't used
val tcpTransport = ArtemisTcpTransport.tcpTransport(ConnectionDirection.Outbound(), serverHostPort, config)
val locator = ActiveMQClient.createServerLocatorWithoutHA(tcpTransport)
locator.setMinLargeMessageSize(ArtemisMessagingServer.MAX_FILE_SIZE)
locator.minLargeMessageSize = ArtemisMessagingServer.MAX_FILE_SIZE
clientFactory = locator.createSessionFactory()
// Login using the node username. The broker will authentiate us as its node (as opposed to another peer)

View File

@ -52,7 +52,7 @@ abstract class RPCDispatcher(val ops: RPCOps, val userService: RPCUserService, v
//
// When the observables are deserialised on the client side, the handle is read from the byte stream and
// the queue is filtered to extract just those observations.
class ObservableSerializer() : Serializer<Observable<Any>>() {
class ObservableSerializer : Serializer<Observable<Any>>() {
private fun toQName(kryo: Kryo): String = kryo.context[RPCKryoQNameKey] as String
private fun toDispatcher(kryo: Kryo): RPCDispatcher = kryo.context[RPCKryoDispatcherKey] as RPCDispatcher

View File

@ -11,7 +11,7 @@ import javax.annotation.concurrent.ThreadSafe
/** A dummy Uniqueness provider that stores the whole history of consumed states in memory */
@ThreadSafe
class InMemoryUniquenessProvider() : UniquenessProvider {
class InMemoryUniquenessProvider : UniquenessProvider {
/** For each input state store the consuming transaction information */
private val committedStates = ThreadBox(HashMap<StateRef, UniquenessProvider.ConsumingTx>())

View File

@ -16,7 +16,7 @@ import javax.annotation.concurrent.ThreadSafe
/** A RDBMS backed Uniqueness provider */
@ThreadSafe
class PersistentUniquenessProvider() : UniquenessProvider, SingletonSerializeAsToken() {
class PersistentUniquenessProvider : UniquenessProvider, SingletonSerializeAsToken() {
companion object {
private val TABLE_NAME = "${NODE_DATABASE_PREFIX}notary_commit_log"
private val log = loggerFor<PersistentUniquenessProvider>()
@ -66,7 +66,7 @@ class PersistentUniquenessProvider() : UniquenessProvider, SingletonSerializeAsT
if (consumingTx != null) conflictingStates[inputState] = consumingTx
}
if (conflictingStates.isNotEmpty()) {
log.debug("Failure, input states already committed: ${conflictingStates.keys.toString()}")
log.debug("Failure, input states already committed: ${conflictingStates.keys}")
UniquenessProvider.Conflict(conflictingStates)
} else {
states.forEachIndexed { i, stateRef ->

View File

@ -61,7 +61,7 @@ class HTTPNetworkRegistrationService(val server: URL) : NetworkRegistrationServi
throw IOException("Unexpected response code ${connection.responseCode} - ${connection.errorMessage}")
}
private val HttpURLConnection.charset: String get() = MediaType.parse(getContentType()).charset().or(Charsets.UTF_8).name()
private val HttpURLConnection.charset: String get() = MediaType.parse(contentType).charset().or(Charsets.UTF_8).name()
private val HttpURLConnection.errorMessage: String get() = IOUtils.toString(errorStream, charset)
}

View File

@ -165,7 +165,7 @@ class TwoPartyTradeFlowTests {
val bobTransactionsBeforeCrash = databaseTransaction(bobNode.database) {
(storage as DBTransactionStorage).transactions
}
assertThat(bobTransactionsBeforeCrash).isNotEmpty()
assertThat(bobTransactionsBeforeCrash).isNotEmpty
// .. and let's imagine that Bob's computer has a power cut. He now has nothing now beyond what was on disk.
bobNode.stop()

View File

@ -106,7 +106,7 @@ class NodeAttachmentStorageTest {
val id = testJar.read { storage.importAttachment(it) }
// Corrupt the file in the store.
val bytes = testJar.readAll();
val bytes = testJar.readAll()
val corruptBytes = "arggghhhh".toByteArray()
System.arraycopy(corruptBytes, 0, bytes, 0, corruptBytes.size)
val corruptAttachment = AttachmentEntity()