Fixed size error when cleaning the stack trace
This commit is contained in:
parent
305e3bb085
commit
cd42f6b85d
@ -32,7 +32,9 @@ internal class ListenerManager<CONNECTION: Connection>(private val logger: KLogg
|
|||||||
fun cleanStackTrace(throwable: Throwable) {
|
fun cleanStackTrace(throwable: Throwable) {
|
||||||
// NOTE: when we remove stuff, we ONLY want to remove the "tail" of the stacktrace, not ALL parts of the stacktrace
|
// NOTE: when we remove stuff, we ONLY want to remove the "tail" of the stacktrace, not ALL parts of the stacktrace
|
||||||
val stackTrace = throwable.stackTrace
|
val stackTrace = throwable.stackTrace
|
||||||
var newEndIndex = stackTrace.size - 1
|
var newEndIndex = Math.max(0, stackTrace.size - 1)
|
||||||
|
|
||||||
|
if (newEndIndex > 0) {
|
||||||
for (i in newEndIndex downTo 0) {
|
for (i in newEndIndex downTo 0) {
|
||||||
val stackName = stackTrace[i].className
|
val stackName = stackTrace[i].className
|
||||||
if (i == newEndIndex) {
|
if (i == newEndIndex) {
|
||||||
@ -51,6 +53,7 @@ internal class ListenerManager<CONNECTION: Connection>(private val logger: KLogg
|
|||||||
throwable.stackTrace = stackTrace.copyOfRange(0, newEndIndex)
|
throwable.stackTrace = stackTrace.copyOfRange(0, newEndIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// initialize a emtpy arrays
|
// initialize a emtpy arrays
|
||||||
private val onConnectIpFilterList = atomic(Array<IpFilterRule>(0) { IpSubnetFilterRule.fake })
|
private val onConnectIpFilterList = atomic(Array<IpFilterRule>(0) { IpSubnetFilterRule.fake })
|
||||||
@ -237,10 +240,10 @@ internal class ListenerManager<CONNECTION: Connection>(private val logger: KLogg
|
|||||||
|
|
||||||
// first run through the IP connection filters, THEN run through the "custom" filters
|
// first run through the IP connection filters, THEN run through the "custom" filters
|
||||||
|
|
||||||
val address = connection.remoteAddressInt
|
// val address = connection.remoteAddressInt
|
||||||
|
|
||||||
// it's possible for a remote address to match MORE than 1 rule.
|
// it's possible for a remote address to match MORE than 1 rule.
|
||||||
var isAllowed = false
|
// var isAllowed = false
|
||||||
|
|
||||||
// these are the IP filters (optimized checking based on simple IP rules)
|
// these are the IP filters (optimized checking based on simple IP rules)
|
||||||
onConnectIpFilterList.value.forEach {
|
onConnectIpFilterList.value.forEach {
|
||||||
|
Loading…
Reference in New Issue
Block a user