Skip to content
Permalink
Browse files

Add and apply spotless + ktlint (#1082)

  • Loading branch information...
adrw committed Jun 26, 2019
1 parent ed6fca9 commit 1f1b09a1494cacf0835c47953c7ae56799482280
Showing with 200 additions and 220 deletions.
  1. +9 −2 build.gradle
  2. +2 −0 dependencies.gradle
  3. +0 −1 misk-aws/src/main/kotlin/misk/jobqueue/sqs/AwsSqsJobQueueConfig.kt
  4. +1 −2 misk-aws/src/main/kotlin/misk/jobqueue/sqs/AwsSqsJobQueueModule.kt
  5. +1 −1 misk-aws/src/test/kotlin/misk/jobqueue/sqs/SqsJobQueueTest.kt
  6. +1 −1 misk-aws/src/test/kotlin/misk/jobqueue/sqs/SqsJobQueueTestModule.kt
  7. +6 −2 misk-crypto/src/main/kotlin/misk/crypto/CryptoModule.kt
  8. +1 −2 misk-crypto/src/main/kotlin/misk/crypto/CryptoTestModule.kt
  9. +0 −3 misk-crypto/src/main/kotlin/misk/crypto/KeyProviders.kt
  10. +4 −4 misk-crypto/src/main/kotlin/misk/crypto/KmsClientModule.kt
  11. +2 −2 misk-crypto/src/test/kotlin/misk/crypto/CryptoModuleTest.kt
  12. +1 −1 misk-eventrouter/src/main/kotlin/misk/eventrouter/KubernetesClusterConnector.kt
  13. +1 −2 misk-eventrouter/src/main/kotlin/misk/eventrouter/QueueingExecutorService.kt
  14. +1 −1 misk-grpc-tests/src/main/kotlin/misk/grpc/protocserver/ProtocGrpcService.kt
  15. +2 −1 misk-grpc-tests/src/main/kotlin/misk/grpc/protocserver/RouteGuideProtocService.kt
  16. +1 −1 misk-hibernate-testing/src/main/kotlin/misk/jdbc/VitessScaleSafetyChecks.kt
  17. +9 −12 misk-hibernate/src/main/kotlin/misk/hibernate/HibernateExceptionMappers.kt
  18. +3 −3 misk-hibernate/src/main/kotlin/misk/hibernate/QueryTracingListener.kt
  19. +4 −4 misk-hibernate/src/main/kotlin/misk/hibernate/RealTransacter.kt
  20. +0 −1 misk-hibernate/src/main/kotlin/misk/hibernate/SchemaMigrator.kt
  21. +0 −1 misk-hibernate/src/main/kotlin/misk/hibernate/SecretColumn.kt
  22. +6 −6 misk-hibernate/src/main/kotlin/misk/hibernate/SecretColumnType.kt
  23. +0 −2 misk-hibernate/src/main/kotlin/misk/hibernate/SessionFactoryService.kt
  24. +11 −9 misk-hibernate/src/main/kotlin/misk/hibernate/migrate/BulkShardMigrator.kt
  25. +3 −3 misk-hibernate/src/main/kotlin/misk/jdbc/DataSourceConfig.kt
  26. +1 −2 misk-hibernate/src/main/kotlin/misk/vitess/StartVitessService.kt
  27. +2 −2 misk-hibernate/src/test/kotlin/misk/hibernate/FakeEventListener.kt
  28. +1 −1 misk-hibernate/src/test/kotlin/misk/hibernate/HibernateTest.kt
  29. +4 −3 misk-hibernate/src/test/kotlin/misk/hibernate/MoviesTestModule.kt
  30. +6 −6 misk-hibernate/src/test/kotlin/misk/hibernate/SchemaMigratorTest.kt
  31. +2 −2 misk-hibernate/src/test/kotlin/misk/hibernate/SecretColumnTest.kt
  32. +2 −2 misk-hibernate/src/test/kotlin/misk/hibernate/migrate/BulkShardMigratorTest.kt
  33. +0 −1 misk-jaeger/src/main/kotlin/misk/tracing/backends/jaeger/MDCScopeManager.kt
  34. +3 −3 misk-jobqueue-testing/src/main/kotlin/misk/jobqueue/FakeJobHandlerModule.kt
  35. +1 −1 misk-jobqueue-testing/src/main/kotlin/misk/jobqueue/FakeJobQueue.kt
  36. +3 −3 misk-metrics-digester/src/main/kotlin/misk/metrics/digester/SlidingWindowDigest.kt
  37. +1 −1 misk-redis/src/main/kotlin/misk/redis/FakeRedis.kt
  38. +3 −3 misk-redis/src/main/kotlin/misk/redis/RedisConfig.kt
  39. +12 −5 misk-testing/src/main/kotlin/misk/concurrent/FakeScheduledExecutorService.kt
  40. +3 −3 misk-testing/src/main/kotlin/misk/containers/Containers.kt
  41. +5 −5 misk-testing/src/main/kotlin/misk/random/FakeRandom.kt
  42. +0 −1 misk-testing/src/main/kotlin/misk/testing/ExternalDependency.kt
  43. +1 −1 misk-testing/src/main/kotlin/misk/testing/TemporaryFolder.kt
  44. +2 −2 misk-zookeeper/src/main/kotlin/misk/clustering/zookeeper/ZkLease.kt
  45. +1 −1 misk-zookeeper/src/main/kotlin/misk/clustering/zookeeper/ZkLeaseManager.kt
  46. +1 −2 misk-zookeeper/src/main/kotlin/misk/zookeeper/CuratorFrameworkProvider.kt
  47. +0 −1 misk-zookeeper/src/main/kotlin/misk/zookeeper/ZkClientFactory.kt
  48. +1 −1 misk-zookeeper/src/test/kotlin/misk/clustering/zookeeper/ZkLeaseTest.kt
  49. +0 −3 misk-zookeeper/src/test/kotlin/misk/zookeeper/ZkClientTest.kt
  50. +2 −3 misk/src/main/kotlin/misk/Actions.kt
  51. +2 −4 misk/src/main/kotlin/misk/CoordinatedService.kt
  52. +4 −4 misk/src/main/kotlin/misk/backoff/ExponentialBackoff.kt
  53. +1 −1 misk/src/main/kotlin/misk/client/ClientInvocationHandler.kt
  54. +1 −1 misk/src/main/kotlin/misk/clustering/kubernetes/KubernetesClusterWatcher.kt
  55. +0 −1 misk/src/main/kotlin/misk/clustering/weights/ActiveClusterWeight.kt
  56. +1 −1 misk/src/main/kotlin/misk/clustering/weights/FakeClusterWeight.kt
  57. +0 −1 misk/src/main/kotlin/misk/concurrent/Sleeper.kt
  58. +1 −1 misk/src/main/kotlin/misk/config/AppNameModule.kt
  59. +1 −1 misk/src/main/kotlin/misk/config/MiskConfig.kt
  60. +1 −2 misk/src/main/kotlin/misk/config/Secret.kt
  61. +0 −1 misk/src/main/kotlin/misk/inject/Guice.kt
  62. +0 −1 misk/src/main/kotlin/misk/moshi/wire/FieldBinding.kt
  63. +1 −1 misk/src/main/kotlin/misk/random/Random.kt
  64. +1 −1 misk/src/main/kotlin/misk/resources/FakeFilesModule.kt
  65. +1 −1 misk/src/main/kotlin/misk/resources/ResourceLoader.kt
  66. +3 −2 misk/src/main/kotlin/misk/tasks/RepeatedTaskQueue.kt
  67. +1 −2 misk/src/main/kotlin/misk/web/MiskWebModule.kt
  68. +6 −5 misk/src/main/kotlin/misk/web/RequestTypes.kt
  69. +4 −4 misk/src/main/kotlin/misk/web/WebTab.kt
  70. +1 −1 misk/src/main/kotlin/misk/web/actions/ReadinessCheckAction.kt
  71. +1 −1 misk/src/main/kotlin/misk/web/actions/WebActionFactory.kt
  72. +14 −14 misk/src/main/kotlin/misk/web/actions/WebActionMetadataAction.kt
  73. +2 −2 misk/src/main/kotlin/misk/web/interceptors/RequestLoggingInterceptor.kt
  74. +0 −1 misk/src/main/kotlin/misk/web/jetty/JettyService.kt
  75. +1 −1 misk/src/main/kotlin/misk/web/metadata/AdminDashboardModule.kt
  76. +2 −2 misk/src/test/kotlin/misk/ServiceGraphBuilderTest.kt
  77. +5 −5 misk/src/test/kotlin/misk/client/HttpClientEventListenerTest.kt
  78. +1 −1 misk/src/test/kotlin/misk/client/TestDino.kt
  79. +0 −4 misk/src/test/kotlin/misk/clustering/ClusterHashRingTest.kt
  80. +0 −2 misk/src/test/kotlin/misk/config/MiskConfigTest.kt
  81. +1 −5 misk/src/test/kotlin/misk/config/SecretConfigTest.kt
  82. +0 −1 misk/src/test/kotlin/misk/moshi/BuiltInAdaptersTest.kt
  83. +3 −3 misk/src/test/kotlin/misk/moshi/MoshiModuleTest.kt
  84. +1 −2 misk/src/test/kotlin/misk/resources/FakeFileLoaderTest.kt
  85. +0 −1 misk/src/test/kotlin/misk/web/PathPatternTest.kt
  86. +5 −4 misk/src/test/kotlin/misk/web/actions/ConfigMetadataActionTest.kt
  87. +1 −1 misk/src/test/kotlin/misk/web/exceptions/ExceptionMapperTest.kt
  88. +2 −1 misk/src/test/kotlin/misk/web/extractors/QueryParamFeatureBindingTest.kt
  89. +1 −1 misk/src/test/kotlin/misk/web/formatter/ClassNameFormatterTest.kt
  90. +3 −3 misk/src/test/kotlin/misk/web/interceptors/RequestLoggingInterceptorTest.kt
  91. +0 −1 misk/src/test/kotlin/misk/web/proxy/WebProxyActionTest.kt
  92. +1 −1 misk/src/test/kotlin/misk/web/ssl/JceksSslClientServerTest.kt
  93. +0 −1 samples/exemplar/src/test/kotlin/com/squareup/exemplar/HelloWebActionTest.kt
  94. +0 −1 samples/exemplarchat/src/main/kotlin/com/squareup/chat/actions/ChatWebSocketAction.kt
@@ -15,12 +15,11 @@ buildscript {
classpath dep.junitGradlePlugin
classpath dep.shadowJarPlugin
classpath dep.mavenPublishGradlePlugin
classpath dep.spotlessPlugin
classpath dep.wirePlugin
}
}

apply plugin: 'kotlin'
apply plugin: 'com.vanniktech.maven.publish'
apply plugin: 'com.gradle.build-scan'

buildScan {
@@ -43,6 +42,7 @@ tasks.register("testShardHibernate") {
subprojects {
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'com.diffplug.gradle.spotless'

buildscript {
repositories {
@@ -74,6 +74,13 @@ subprojects {
main.java.srcDirs += 'src/main/kotlin/'
test.java.srcDirs += 'src/test/kotlin/'
}
spotless {
kotlin {
target "**/*.kt"
ktlint(dep.ktlintVersion).userData(['indent_size': '2', 'continuation_indent_size' : '2'])
}
}
compileKotlin.dependsOn 'spotlessKotlinApply'

dependencies {
testImplementation dep.junitApi
@@ -49,6 +49,7 @@ ext.dep = [
"kotlinStdLib": "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.21",
"kotlinTest": "org.jetbrains.kotlin:kotlin-test:1.3.21",
"kotlinxCoroutines": "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1",
"ktlintVersion": "0.33.0",
"kubernetesClient": "io.kubernetes:client-java:1.0.0",
"logbackClassic": "ch.qos.logback:logback-classic:1.2.3",
"logbackJsonCore": "ch.qos.logback.contrib:logback-json-core:0.1.5",
@@ -77,6 +78,7 @@ ext.dep = [
"servletApi": "javax.servlet:javax.servlet-api:3.1.0",
"shadowJarPlugin": "com.github.jengelman.gradle.plugins:shadow:4.0.4",
"slf4jApi": "org.slf4j:slf4j-api:1.7.25",
"spotlessPlugin": "com.diffplug.spotless:spotless-plugin-gradle:3.23.0",
"tink": "com.google.crypto.tink:tink:1.2.0",
"tracingJaeger": "com.uber.jaeger:jaeger-core:0.24.0",
"tracingZipkin": "io.opentracing.brave:brave-opentracing:0.29.0",
@@ -27,4 +27,3 @@ class AwsSqsJobQueueConfig(

val task_queue: RepeatedTaskQueueConfig = RepeatedTaskQueueConfig()
) : Config

@@ -18,7 +18,6 @@ import misk.jobqueue.QueueName
import misk.jobqueue.TransactionalJobQueue
import misk.tasks.RepeatedTaskQueue
import java.time.Clock
import java.time.Duration
import java.util.concurrent.Executors
import javax.inject.Inject

@@ -69,7 +68,7 @@ class AwsSqsJobQueueModule(
}

@Provides @ForSqsConsumer @Singleton
fun consumerRepeatedTaskQueue(clock: Clock, config : AwsSqsJobQueueConfig): RepeatedTaskQueue {
fun consumerRepeatedTaskQueue(clock: Clock, config: AwsSqsJobQueueConfig): RepeatedTaskQueue {
return RepeatedTaskQueue(
"sqs-consumer-poller",
clock,
@@ -30,7 +30,7 @@ internal class SqsJobQueueTest {
@Inject private lateinit var queue: JobQueue
@Inject private lateinit var consumer: JobConsumer
@Inject private lateinit var sqsMetrics: SqsMetrics
@Inject @ForSqsConsumer lateinit var taskQueue : RepeatedTaskQueue
@Inject @ForSqsConsumer lateinit var taskQueue: RepeatedTaskQueue

private lateinit var queueName: QueueName
private lateinit var deadLetterQueueName: QueueName
@@ -10,7 +10,7 @@ import misk.inject.KAbstractModule
import misk.tasks.RepeatedTaskQueueConfig
import misk.testing.MockTracingBackendModule

class SqsJobQueueTestModule (
class SqsJobQueueTestModule(
private val credentials: AWSCredentialsProvider,
private val client: AmazonSQS
) : KAbstractModule() {
@@ -101,7 +101,9 @@ fun Aead.decrypt(ciphertext: ByteString, aad: ByteArray? = null): ByteString {
* Extension function for convenient encryption of [ByteString]s.
* This function also makes sure that no extra copies of the plaintext data are kept in memory.
*/
fun DeterministicAead.encryptDeterministically(plaintext: ByteString, aad: ByteArray? = null
fun DeterministicAead.encryptDeterministically(
plaintext: ByteString,
aad: ByteArray? = null
): ByteString {
val plaintextBytes = plaintext.toByteArray()
val encrypted = this.encryptDeterministically(plaintextBytes, aad ?: byteArrayOf())
@@ -113,7 +115,9 @@ fun DeterministicAead.encryptDeterministically(plaintext: ByteString, aad: ByteA
* Extension function for convenient decryption of [ByteString]s.
* This function also makes sure that no extra copies of the plaintext data are kept in memory.
*/
fun DeterministicAead.decryptDeterministically(ciphertext: ByteString, aad: ByteArray? = null
fun DeterministicAead.decryptDeterministically(
ciphertext: ByteString,
aad: ByteArray? = null
): ByteString {
val decryptedBytes = this.decryptDeterministically(ciphertext.toByteArray(), aad)
val decrypted = decryptedBytes.toByteString()
@@ -40,7 +40,7 @@ class CryptoTestModule(
KeyType.AEAD -> {
bind<Aead>()
.annotatedWith(Names.named(key.key_name))
.toProvider(AeadEnvelopeProvider(key,null))
.toProvider(AeadEnvelopeProvider(key, null))
.asEagerSingleton()
}
KeyType.DAEAD -> {
@@ -69,4 +69,3 @@ class CryptoTestModule(
}
}
}

@@ -20,9 +20,7 @@ import com.google.crypto.tink.aead.KmsEnvelopeAead
import com.google.crypto.tink.daead.DeterministicAeadFactory
import com.google.inject.Inject
import com.google.inject.Provider
import misk.environment.Environment
import misk.logging.getLogger
import java.security.GeneralSecurityException

val logger by lazy { getLogger<CryptoModule>() }

@@ -128,4 +126,3 @@ internal class DigitalSignatureVerifierProvider(
return verifier
}
}

@@ -17,8 +17,8 @@ class AwsKmsClientModule(private val credentialsPath: String? = null) : KAbstrac
// TODO: Allow initializing an AWS KMS client with a credentials provider
// once tink supports it: https://github.com/google/tink/pull/184
@Provides @Singleton
fun getKmsClient(): KmsClient = credentialsPath?.let { AwsKmsClient().withCredentials(it) } ?:
AwsKmsClient().withDefaultCredentials()
fun getKmsClient(): KmsClient = credentialsPath?.let { AwsKmsClient().withCredentials(it) }
?: AwsKmsClient().withDefaultCredentials()
}

/**
@@ -29,6 +29,6 @@ class AwsKmsClientModule(private val credentialsPath: String? = null) : KAbstrac
*/
class GcpKmsClientModule(private val credentialsPath: String? = null) : KAbstractModule() {
@Provides @Singleton
fun getKmsClient(): KmsClient = credentialsPath?.let { GcpKmsClient().withCredentials(it) } ?:
GcpKmsClient().withDefaultCredentials()
fun getKmsClient(): KmsClient = credentialsPath?.let { GcpKmsClient().withCredentials(it) }
?: GcpKmsClient().withDefaultCredentials()
}
@@ -94,7 +94,7 @@ class CryptoModuleTest {
val injector = getInjector(listOf())
assertThatThrownBy { injector.getInstance(MacKeyManager::class.java)["not there"] }
.isInstanceOf(KeyNotFoundException::class.java)
assertThatThrownBy { injector.getInstance(AeadKeyManager::class.java)["not there either"]}
assertThatThrownBy { injector.getInstance(AeadKeyManager::class.java)["not there either"] }
.isInstanceOf(KeyNotFoundException::class.java)
}

@@ -116,7 +116,7 @@ class CryptoModuleTest {
}.isInstanceOf(GeneralSecurityException::class.java)
}

private fun getInjector(keyMap: List<Pair<String, KeysetHandle>>): Injector{
private fun getInjector(keyMap: List<Pair<String, KeysetHandle>>): Injector {
val keys = keyMap.map {
var keyType = KeyType.AEAD
val keyTypeUrl = it.second.keysetInfo.getKeyInfo(0).typeUrl
@@ -63,7 +63,7 @@ internal class KubernetesClusterConnector @Inject constructor() : ClusterConnect
null, // timeoutSeconds
true, // watch
null, // progressListener
null // progressRequestListener
null // progressRequestListener
),
object : TypeToken<Watch.Response<V1Pod>>() {}.type)

@@ -3,13 +3,12 @@ package misk.eventrouter
import java.util.concurrent.AbstractExecutorService
import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.TimeUnit
import javax.inject.Inject

/**
* An executor service that holds enqueued work until explicitly executed. Useful for making tests
* deterministic.
*/
internal class QueueingExecutorService: AbstractExecutorService() {
internal class QueueingExecutorService : AbstractExecutorService() {
private val queue = LinkedBlockingQueue<Runnable>()
private var processing = false

@@ -17,7 +17,7 @@ import javax.inject.Singleton
class ProtocGrpcService @Inject constructor(
private val services: List<BindableService>,
private val resourceLoader: ResourceLoader
): AbstractIdleService() {
) : AbstractIdleService() {

lateinit var server: Server

@@ -19,7 +19,8 @@ internal class RouteGuideProtocService @Inject constructor() : RouteGuideImplBas
}

override fun routeChat(
responseObserver: StreamObserver<RouteGuideProto.RouteNote>):
responseObserver: StreamObserver<RouteGuideProto.RouteNote>
):
StreamObserver<RouteGuideProto.RouteNote> {
return object : StreamObserver<RouteGuideProto.RouteNote> {
override fun onNext(value: RouteGuideProto.RouteNote) {
@@ -658,7 +658,7 @@ class VitessScaleSafetyChecks(

private val EMPTY_LINE = "\n\n".encodeUtf8()

internal fun parseQueryPlans(moshi : Moshi, data: BufferedSource): Sequence<QueryPlan> {
internal fun parseQueryPlans(moshi: Moshi, data: BufferedSource): Sequence<QueryPlan> {
// Read (and discard) the "Length" line
data.readUtf8Line()

@@ -15,11 +15,10 @@ import java.sql.SQLIntegrityConstraintViolationException
import javax.inject.Inject
import javax.persistence.OptimisticLockException

internal class RetryTransactionExceptionMapper @Inject internal constructor(
) : ExceptionMapper<RetryTransactionException> {
internal class RetryTransactionExceptionMapper @Inject internal constructor() : ExceptionMapper<RetryTransactionException> {

override fun toResponse(th: RetryTransactionException): Response<ResponseBody>
= ConflictExceptionResponder.toResponse()
override fun toResponse(th: RetryTransactionException): Response<ResponseBody> =
ConflictExceptionResponder.toResponse()

override fun canHandle(th: Throwable): Boolean {
val rootCause = Throwables.getRootCause(th)
@@ -31,20 +30,18 @@ internal class RetryTransactionExceptionMapper @Inject internal constructor(
override fun loggingLevel(th: RetryTransactionException) = Level.WARN
}

internal class ConstraintViolationExceptionMapper @Inject internal constructor(
) : ExceptionMapper<ConstraintViolationException> {
override fun toResponse(th: ConstraintViolationException): Response<ResponseBody>
= ConflictExceptionResponder.toResponse()
internal class ConstraintViolationExceptionMapper @Inject internal constructor() : ExceptionMapper<ConstraintViolationException> {
override fun toResponse(th: ConstraintViolationException): Response<ResponseBody> =
ConflictExceptionResponder.toResponse()

override fun canHandle(th: Throwable): Boolean = th is ConstraintViolationException

override fun loggingLevel(th: ConstraintViolationException) = Level.WARN
}

internal class OptimisticLockExceptionMapper @Inject internal constructor(
) : ExceptionMapper<OptimisticLockException> {
override fun toResponse(th: OptimisticLockException): Response<ResponseBody>
= ConflictExceptionResponder.toResponse()
internal class OptimisticLockExceptionMapper @Inject internal constructor() : ExceptionMapper<OptimisticLockException> {
override fun toResponse(th: OptimisticLockException): Response<ResponseBody> =
ConflictExceptionResponder.toResponse()

override fun canHandle(th: Throwable): Boolean = th is OptimisticLockException

@@ -33,8 +33,8 @@ private val logger = getLogger<QueryTracingListener>()
* {@see misk.hibernate.ReflectionQuery}.
*/
@Singleton
internal class QueryTracingListener @Inject constructor()
: PreInsertEventListener,
internal class QueryTracingListener @Inject constructor() :
PreInsertEventListener,
PostInsertEventListener,
PreUpdateEventListener,
PostUpdateEventListener,
@@ -83,7 +83,7 @@ internal class QueryTracingListener @Inject constructor()

val lastScope = lastScopeInThread.get()
lastScope?.let {
logger.info{ "lastScope wasn't closed" }
logger.info { "lastScope wasn't closed" }
endLastSpan()
}

@@ -362,17 +362,17 @@ internal class RealTransacter private constructor(
}

override fun <T> withoutChecks(vararg checks: Check, body: () -> T): T {
val previous = disabledChecks;
val previous = disabledChecks
val actualChecks = if (checks.isEmpty()) {
EnumSet.allOf(Check::class.java)
} else {
EnumSet.of(checks[0], *checks)
}
disabledChecks = actualChecks;
disabledChecks = actualChecks
return try {
body();
body()
} finally {
disabledChecks = previous;
disabledChecks = previous
}
}

@@ -4,7 +4,6 @@ import com.google.common.annotations.VisibleForTesting
import com.google.common.base.Stopwatch
import com.google.common.collect.ImmutableList
import misk.jdbc.DataSourceConfig
import misk.jdbc.DataSourceType
import misk.logging.getLogger
import misk.resources.ResourceLoader
import org.hibernate.query.Query
@@ -42,4 +42,3 @@ package misk.hibernate
*/
@Target(AnnotationTarget.FIELD)
annotation class SecretColumn(val keyName: String, val indexable: Boolean = true)

@@ -121,17 +121,17 @@ internal class AeadAdapter(typeConfig: TypeConfiguration, keyName: String) : Enc
}
}

override fun encrypt(plaintext: ByteArray, associatedData: ByteArray?) : ByteArray {
override fun encrypt(plaintext: ByteArray, associatedData: ByteArray?): ByteArray {
return aead.encrypt(plaintext, associatedData)
}

override fun decrypt(ciphertext: ByteArray, associatedData: ByteArray?) : ByteArray {
override fun decrypt(ciphertext: ByteArray, associatedData: ByteArray?): ByteArray {
return aead.decrypt(ciphertext, associatedData)
}
}

internal class DeterministicAeadAdapter(typeConfig: TypeConfiguration, keyName: String)
: EncryptionAdapter {
internal class DeterministicAeadAdapter(typeConfig: TypeConfiguration, keyName: String) :
EncryptionAdapter {

val daead: DeterministicAead

@@ -145,12 +145,12 @@ internal class DeterministicAeadAdapter(typeConfig: TypeConfiguration, keyName:
}
}

override fun encrypt(plaintext: ByteArray, associatedData: ByteArray?) : ByteArray {
override fun encrypt(plaintext: ByteArray, associatedData: ByteArray?): ByteArray {
// DeterministicAEAD throws if associatedData is null, so we pass an empty array if it is.
return daead.encryptDeterministically(plaintext, associatedData ?: byteArrayOf())
}

override fun decrypt(ciphertext: ByteArray, associatedData: ByteArray?) : ByteArray {
override fun decrypt(ciphertext: ByteArray, associatedData: ByteArray?): ByteArray {
return daead.decryptDeterministically(ciphertext, associatedData ?: byteArrayOf())
}
}
@@ -68,7 +68,6 @@ internal class SessionFactoryService(
serviceRegistry: SessionFactoryServiceRegistry
) {
}

}
val bootstrapRegistryBuilder = BootstrapServiceRegistryBuilder()
.applyIntegrator(integrator)
@@ -101,7 +100,6 @@ internal class SessionFactoryService(
// See: Component#createIdentifierGenerator
val metadataDraft = metadataDraftBuilder.build() as MetadataImplementor


// Loop over all of the properties in all of the entities so we can set up UserTypes.
val allPropertyTypes = mutableSetOf<KClass<*>>()
for ((persistentClass, property) in metadataDraft.allProperties.entries()) {

0 comments on commit 1f1b09a

Please sign in to comment.
You can’t perform that action at this time.