Avoid using keyword for variable names

This commit is contained in:
Benoit Marty 2019-09-05 15:36:20 +02:00
parent fe931b5361
commit ed39b02924
2 changed files with 10 additions and 10 deletions

View File

@ -21,14 +21,14 @@ import timber.log.Timber


private val regex = Regex("^(==|<=|>=|<|>)?(\\d*)$") private val regex = Regex("^(==|<=|>=|<|>)?(\\d*)$")


class RoomMemberCountCondition(val `is`: String) : Condition(Kind.room_member_count) { class RoomMemberCountCondition(val iz: String) : Condition(Kind.room_member_count) {


override fun isSatisfied(conditionResolver: ConditionResolver): Boolean { override fun isSatisfied(conditionResolver: ConditionResolver): Boolean {
return conditionResolver.resolveRoomMemberCountCondition(this) return conditionResolver.resolveRoomMemberCountCondition(this)
} }


override fun technicalDescription(): String { override fun technicalDescription(): String {
return "Room member count is $`is`" return "Room member count is $iz"
} }


fun isSatisfied(event: Event, session: RoomService?): Boolean { fun isSatisfied(event: Event, session: RoomService?): Boolean {
@ -55,7 +55,7 @@ class RoomMemberCountCondition(val `is`: String) : Condition(Kind.room_member_co
*/ */
private fun parseIsField(): Pair<String?, Int>? { private fun parseIsField(): Pair<String?, Int>? {
try { try {
val match = regex.find(`is`) ?: return null val match = regex.find(iz) ?: return null
val (prefix, count) = match.destructured val (prefix, count) = match.destructured
return prefix to count.toInt() return prefix to count.toInt()
} catch (t: Throwable) { } catch (t: Throwable) {

View File

@ -349,20 +349,20 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
} else if (null == response || null == response.body()) { } else if (null == response || null == response.body()) {
serverError = "Failed with error $responseCode" serverError = "Failed with error $responseCode"
} else { } else {
var `is`: InputStream? = null var inputStream: InputStream? = null


try { try {
`is` = response.body()!!.byteStream() inputStream = response.body()!!.byteStream()


if (null != `is`) { if (null != inputStream) {
var ch = `is`.read() var ch = inputStream.read()
val b = StringBuilder() val b = StringBuilder()
while (ch != -1) { while (ch != -1) {
b.append(ch.toChar()) b.append(ch.toChar())
ch = `is`.read() ch = inputStream.read()
} }
serverError = b.toString() serverError = b.toString()
`is`.close() inputStream.close()


// check if the error message // check if the error message
try { try {
@ -381,7 +381,7 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
Timber.e(e, "## sendBugReport() : failed to parse error " + e.message) Timber.e(e, "## sendBugReport() : failed to parse error " + e.message)
} finally { } finally {
try { try {
`is`?.close() inputStream?.close()
} catch (e: Exception) { } catch (e: Exception) {
Timber.e(e, "## sendBugReport() : failed to close the error stream " + e.message) Timber.e(e, "## sendBugReport() : failed to close the error stream " + e.message)
} }