Skip to content

Commit d2ebf19

Browse files
committed
removed extra new lines, reformatted getSessionId method in Client.kt and removed changes in JsonMessageSerializer.kt
1 parent 9394247 commit d2ebf19

File tree

2 files changed

+2
-12
lines changed
  • kwamp-client-core/src/main/kotlin/com/laurencegarmstrong/kwamp/client/core
  • kwamp-core/src/main/kotlin/com/laurencegarmstrong/kwamp/core/serialization/json

2 files changed

+2
-12
lines changed

kwamp-client-core/src/main/kotlin/com/laurencegarmstrong/kwamp/client/core/Client.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class ClientImpl(
4747
onClose: suspend (message: String) -> Unit = {},
4848
private val exceptionCatcher: ExceptionCatcher = ExceptionSwallower()
4949
) : Client, CoroutineScope by CoroutineScope(Executors.newSingleThreadExecutor().asCoroutineDispatcher()) {
50-
51-
5250
private val log = LoggerFactory.getLogger(ClientImpl::class.java)!!
5351
private val connection = Connection(incoming, outgoing, onClose, getSerializer(protocol))
5452

@@ -87,7 +85,6 @@ class ClientImpl(
8785
}
8886
}
8987

90-
9188
private fun handleMessage(message: Message) {
9289
messageListenersHandler.notifyListeners(message)
9390

@@ -122,7 +119,6 @@ class ClientImpl(
122119
connection.withNextMessage { message: Welcome ->
123120
log.info("Session established. ID: ${message.session}")
124121
sessionId = message.session
125-
126122
}.join()
127123
}
128124

@@ -158,10 +154,7 @@ class ClientImpl(
158154
eventHandler: EventHandler
159155
) = subscriber.subscribe(topicPattern, eventHandler)
160156

161-
162-
fun getID(): Long? {
163-
return sessionId
164-
}
157+
fun getSessionId() = sessionId
165158
}
166159

167160
// Can be overridden to handle exceptions

kwamp-core/src/main/kotlin/com/laurencegarmstrong/kwamp/core/serialization/json/JsonMessageSerializer.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ internal fun Klaxon.convertJsonObject(jo: Any?): Any? = when {
5757
val converter = findConverterFromClass(Any::class.java, null)
5858
converter.fromJson(JsonValue(jo, null, null, this))
5959
}
60-
//this helps prevent crashing when null value is received for any key
61-
else -> {
62-
log("Couldn't convert $jo")
63-
}
60+
else -> throw KlaxonException("Couldn't convert $jo")
6461
}
6562

6663
private val MAP_CONVERTER = object : Converter {

0 commit comments

Comments
 (0)