Skip to content

Commit 445018d

Browse files
committed
remove buggy workaround for 'state messages'
1 parent c21eb1b commit 445018d

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/main/kotlin/de/gmuth/ipp/client/IppPrinter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ open class IppPrinter(
169169
val stateReasons: List<String>
170170
get() = attributes.getValues("printer-state-reasons")
171171

172-
val stateMessage: IppString?
173-
get() = attributes.getValueOrNull("printer-state-message")
172+
val stateMessage: IppString
173+
get() = attributes.getValue("printer-state-message")
174174

175175
val documentFormatSupported: List<String>
176176
get() = attributes.getValues("document-format-supported")

src/main/kotlin/de/gmuth/ipp/core/IppAttributesGroup.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,12 @@ class IppAttributesGroup(val tag: IppTag) : LinkedHashMap<String, IppAttribute<*
5656

5757
@Suppress("UNCHECKED_CAST")
5858
fun <T> getValueOrNull(name: String): T? = get(name)?.run {
59-
if (tag.isValueTagAndIsNotOutOfBandTag()) {
60-
if (values.size == 1) value as T?
61-
else {
62-
logger.warning { "For '$name' one value was expected but found ${values.size} values: $values (ignoring all)" }
63-
null // workaround for https://github.com/gmuth/ipp-client-kotlin/issues/36
64-
}
65-
} else null
59+
if (tag.isValueTagAndIsNotOutOfBandTag()) value as T else null
6660
}
6761

6862
@Suppress("UNCHECKED_CAST")
6963
fun <T> getValuesOrNull(name: String): T? = get(name)?.run {
70-
if (tag.isValueTagAndIsNotOutOfBandTag()) values as T?
71-
else null
64+
if (tag.isValueTagAndIsNotOutOfBandTag()) values as T else null
7265
}
7366

7467
@Suppress("UNCHECKED_CAST")

0 commit comments

Comments
 (0)