Commit 2bd0263a authored by Jonas Waeber's avatar Jonas Waeber

Trim whitespace from keys and values

parent d7413844
Pipeline #10461 passed with stages
in 15 minutes and 26 seconds
......@@ -175,16 +175,17 @@ class KafkaTopology(private val settings: SettingsLoader) {
if (count == propertyNamesIndex) {
headerProperties = line
headerProperties.forEachIndexed { index, property ->
if (property.isEmpty()) {
val trimmedProperty = property.trim()
if (trimmedProperty.isEmpty()) {
throw InvalidInputException(
key,
"Missing a property name on row $count in column ${index + 1}!"
)
}
if (property.any { value -> invalidPropertyNameCharacters.contains(value) }) {
if (trimmedProperty.any { value -> invalidPropertyNameCharacters.contains(value) }) {
throw InvalidInputException(
key,
"Invalid property name $property on row $count in column ${index + 1}! You may not use the any of the following characters: + , . "
"Invalid property name $trimmedProperty on row $count in column ${index + 1}! You may not use the any of the following characters: + , . "
)
}
}
......@@ -243,7 +244,7 @@ class KafkaTopology(private val settings: SettingsLoader) {
val result = mutableListOf<Pair<String, String>>()
header.forEachIndexed { index, s ->
if (line[index].isNotEmpty()) {
result.add(Pair(s, line[index]))
result.add(Pair(s, line[index].trim()))
}
}
return result
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment