Skip to content

Commit d96c328

Browse files
Fix compilation warnings from Ktor 3 / Kotlin 2.3.20 upgrade
- ArtifactStoreRead: readBytes() -> readRawBytes() (deprecated rename) - Authentication: suppress Principal deprecation warning - LinkedDataPlatform: suppress Route.intercept deprecation - Protocol: remove redundant 'out' projection on beforeEach - SparqlBuilder: suppress unchecked cast, fix always-true null check on non-nullable userId, remove unnecessary elvis operator Co-Authored-By: doris.t.lam <dlamoris@gmail.com>
1 parent 0c62ee1 commit d96c328

5 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/main/kotlin/org/openmbee/flexo/mms/SparqlBuilder.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ fun serializePairs(node: Resource): String {
101101
abstract class SparqlBuilder<out Instance: SparqlBuilder<Instance>>(private val indentLevel: Int=1) {
102102
protected val sparqlString = StringBuilder()
103103

104+
@Suppress("UNCHECKED_CAST")
104105
fun raw(vararg sparql: String): Instance {
105106
sparqlString.append(sparql.joinToString("\n") { it.trimIndent()+"\n" })
106107

@@ -309,7 +310,7 @@ class InsertBuilder(
309310

310311
fun subtxn(subTxnId: String, extras: Map<String, String>?=null, setup: (TxnBuilder.() -> Unit)?=null): InsertBuilder {
311312
val properties = extras?.toMutableMap()?: mutableMapOf()
312-
if(null != layer1.userId) properties["mms:user"] = "mu:"
313+
properties["mms:user"] = "mu:"
313314
if(null != layer1.orgId) properties["mms:org"] = "mo:"
314315
if(null != layer1.repoId) properties["mms:repo"] = "mor:"
315316
if(null != layer1.branchId) properties["mms:branch"] = "morb:"
@@ -550,7 +551,7 @@ class UpdateBuilder(
550551
// prefixes(mms.prefixes)
551552

552553
literal(
553-
"_userId" to (layer1.userId?: ""),
554+
"_userId" to layer1.userId,
554555
"_orgId" to (layer1.orgId?: ""),
555556
"_repoId" to (layer1.repoId?: ""),
556557
"_branchId" to (layer1.branchId?: ""),

src/main/kotlin/org/openmbee/flexo/mms/routes/store/ArtifactStoreRead.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ suspend fun <TRequestContext: GenericRequest> Layer1Context<TRequestContext, Sto
8686
}
8787
}
8888
}
89-
val bytes = response.readBytes()
89+
val bytes = response.readRawBytes()
9090
DecodedArtifact(contentType, bodyBinary = bytes)
9191
}
9292
else -> {

src/main/kotlin/org/openmbee/flexo/mms/server/Authentication.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ fun Application.configureAuthentication() {
3232
}
3333
}
3434

35+
@Suppress("DEPRECATION")
3536
data class UserDetailsPrincipal(val name: String, val groups: List<String>) : Principal

src/main/kotlin/org/openmbee/flexo/mms/server/LinkedDataPlatform.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ fun Route.linkedDataPlatformResource(
154154
// scope all contained routes to specified (sub)path
155155
route(path) {
156156
// 4.2.1.6: all responses must contain the Link header
157+
@Suppress("DEPRECATION")
157158
intercept(ApplicationCallPipeline.Call) {
158159
// response headers have not yet been sent
159160
if(!call.response.isCommitted) {

src/main/kotlin/org/openmbee/flexo/mms/server/Protocol.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ abstract class GenericProtocolRoute<TRequestContext: GenericRequest>(
103103
/**
104104
* Set a callback to execute before each call handled under given route
105105
*/
106-
var beforeEach: (suspend Layer1Context<TRequestContext, out GenericResponse>.() -> Unit)? = null
106+
var beforeEach: (suspend Layer1Context<TRequestContext, GenericResponse>.() -> Unit)? = null
107107

108108
/**
109109
* Set default regex used to assert the slug is a legal identifier when POST-ing to create new resource

0 commit comments

Comments
 (0)