Improved excepetions handling.
This commit is contained in:
parent
2ff60e434c
commit
65c736cc23
2 changed files with 11 additions and 10 deletions
|
@ -1,11 +1,9 @@
|
||||||
<?xml version="1.0" ?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<SmellBaseline>
|
<SmellBaseline>
|
||||||
<Blacklist timestamp="1531308331780"></Blacklist>
|
<ManuallySuppressedIssues/>
|
||||||
<Whitelist timestamp="1558928560207">
|
<CurrentIssues>
|
||||||
<ID>ComplexMethod:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: List<Pair<String, String>>): Boolean</ID>
|
|
||||||
<ID>LongParameterList:PinboardPoster.kt$PinboardPoster$( url: String, description: String, extended: String = "", tags: String = "", dt: String = "", replace: Boolean = true, shared: Boolean = true, toRead: Boolean = false )</ID>
|
<ID>LongParameterList:PinboardPoster.kt$PinboardPoster$( url: String, description: String, extended: String = "", tags: String = "", dt: String = "", replace: Boolean = true, shared: Boolean = true, toRead: Boolean = false )</ID>
|
||||||
<ID>NestedBlockDepth:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: List<Pair<String, String>>): Boolean</ID>
|
<ID>NestedBlockDepth:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: List<Pair<String, String>>): Boolean</ID>
|
||||||
<ID>ThrowsCount:PinboardPoster.kt$PinboardPoster$internal fun parseMethodResponse(method: String, response: String)</ID>
|
<ID>ThrowsCount:PinboardPoster.kt$PinboardPoster$@Throws(IOException::class) internal fun parseMethodResponse(method: String, response: String)</ID>
|
||||||
<ID>TooGenericExceptionCaught:PinboardPoster.kt$PinboardPoster$e: Exception</ID>
|
</CurrentIssues>
|
||||||
</Whitelist>
|
|
||||||
</SmellBaseline>
|
</SmellBaseline>
|
|
@ -205,6 +205,7 @@ open class PinboardPoster() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Throws(IOException::class)
|
||||||
internal fun parseMethodResponse(method: String, response: String) {
|
internal fun parseMethodResponse(method: String, response: String) {
|
||||||
val factory = DocumentBuilderFactory.newInstance().apply {
|
val factory = DocumentBuilderFactory.newInstance().apply {
|
||||||
isValidating = false
|
isValidating = false
|
||||||
|
@ -228,8 +229,10 @@ open class PinboardPoster() {
|
||||||
} else {
|
} else {
|
||||||
throw IOException("An error has occurred while executing $method.")
|
throw IOException("An error has occurred while executing $method.")
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: org.xml.sax.SAXException) {
|
||||||
throw IOException("Could not parse $method response.", e)
|
throw IOException("Could not parse $method response.", e)
|
||||||
|
} catch (e: IllegalArgumentException) {
|
||||||
|
throw IOException("Invalid input source for $method response", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue