remove unsafe-operator

This commit is contained in:
az 2023-02-16 18:04:49 +01:00
parent a1192f4382
commit 05e648abe6

View file

@ -1,8 +1,5 @@
package org.domaindrivenarchitecture.provs.server.domain.k3s package org.domaindrivenarchitecture.provs.server.domain.k3s
import org.domaindrivenarchitecture.provs.framework.core.getLocalFileContent
import java.io.File
data class ApplicationFile(val id: ApplicationFileName, val fileContent: String) { data class ApplicationFile(val id: ApplicationFileName, val fileContent: String) {
fun validate() : List<String> { fun validate() : List<String> {
@ -13,13 +10,14 @@ data class ApplicationFile(val id: ApplicationFileName, val fileContent: String)
if(fileContent.isEmpty()) { if(fileContent.isEmpty()) {
output.add("fileContent is empty.") output.add("fileContent is empty.")
} }
if (fileContent.contains(specRegex)) { val specMatch = specRegex.find(fileContent)
output.add(specRegex.find(fileContent)!!.value) if (specMatch != null) {
output.add(specMatch.value)
} }
if (fileContent.contains(javaRegex)) { val javaMatch = javaRegex.find(fileContent)
output.add(javaRegex.find(fileContent)!!.value) if (javaMatch != null) {
output.add(javaMatch.value)
} }
return output return output
} }
fun isValid() : Boolean { fun isValid() : Boolean {