Commit a54f0ac5 authored by Ricki Hirner's avatar Ricki Hirner

Code cleanup (lint)

parent 41c9f189
......@@ -9,7 +9,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:${dokka_version}"
}
......@@ -60,7 +60,7 @@ dependencies {
compile "com.squareup.okhttp3:okhttp:$okhttp_version"
androidTestCompile "com.squareup.okhttp3:mockwebserver:$okhttp_version"
androidTestCompile 'com.android.support.test:runner:1.0.1'
androidTestCompile 'com.android.support.test:runner:1.0.2'
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testCompile 'junit:junit:4.12'
......
......@@ -81,11 +81,11 @@ class DavCollectionTest {
val members = collection.members.iterator()
val member1 = members.next()
assertEquals(sampleUrl().newBuilder().addPathSegment("test.doc").build(), member1.location)
assertEquals("00001-abcd1", member1.properties.get(GetETag::class.java)!!.eTag)
assertEquals("00001-abcd1", member1.properties[GetETag::class.java]!!.eTag)
val member2 = members.next()
assertEquals(sampleUrl().newBuilder().addPathSegment("vcard.vcf").build(), member2.location)
assertEquals("00002-abcd1", member2.properties.get(GetETag::class.java)!!.eTag)
assertEquals("00002-abcd1", member2.properties[GetETag::class.java]!!.eTag)
assertEquals(1, collection.removedMembers.size)
val removedMember = collection.removedMembers.first()
......
......@@ -36,8 +36,8 @@ class BasicDigestAuthHandler(
): Authenticator, Interceptor {
companion object {
private val HEADER_AUTHENTICATE = "WWW-Authenticate"
private val HEADER_AUTHORIZATION = "Authorization"
private const val HEADER_AUTHENTICATE = "WWW-Authenticate"
private const val HEADER_AUTHORIZATION = "Authorization"
// cached digest parameters
var clientNonce = h(UUID.randomUUID().toString())
......
......@@ -9,9 +9,8 @@
package at.bitfire.dav4android
import okhttp3.Response
import java.util.LinkedList
import java.util.*
import java.util.regex.Pattern
import kotlin.collections.HashMap
object HttpUtils {
......@@ -142,7 +141,7 @@ object HttpUtils {
override fun toString(): String {
val s = StringBuilder()
s.append(name + "(")
s.append("$name(")
for ((name, value) in params)
s.append("$name=[$value],")
s.append(")")
......
......@@ -42,7 +42,7 @@ class PropertyCollection {
}
}
fun getMap(): Map<Property.Name, Property?> =
private fun getMap(): Map<Property.Name, Property?> =
if (!properties.isInitialized())
mapOf()
else
......
......@@ -10,7 +10,6 @@ package at.bitfire.dav4android
import org.xmlpull.v1.XmlPullParser
import org.xmlpull.v1.XmlPullParserException
import java.io.IOException
interface PropertyFactory {
......
......@@ -22,12 +22,12 @@ object UrlUtils {
val uri1 = url1.uri()
val uri2 = url2.uri()
try {
return try {
val decoded1 = URI(uri1.scheme, uri1.schemeSpecificPart, uri1.fragment)
val decoded2 = URI (uri2.scheme, uri2.schemeSpecificPart, uri2.fragment)
return decoded1 == decoded2
decoded1 == decoded2
} catch (e: URISyntaxException) {
return false
false
}
}
......
......@@ -24,7 +24,7 @@ data class CalendarColor(
@JvmField
val NAME = Property.Name(XmlUtils.NS_APPLE_ICAL, "calendar-color")
val PATTERN = Pattern.compile("#?(\\p{XDigit}{6})(\\p{XDigit}{2})?")!!
private val PATTERN = Pattern.compile("#?(\\p{XDigit}{6})(\\p{XDigit}{2})?")!!
/**
* Converts a WebDAV color from one of these formats:
......
......@@ -37,8 +37,8 @@ data class SupportedCalendarComponentSet(
val depth = parser.depth
var eventType = parser.eventType
while (!(eventType == XmlPullParser.END_TAG && parser.getDepth() == depth)) {
if (eventType == XmlPullParser.START_TAG && parser.getDepth() == depth + 1 && parser.namespace == XmlUtils.NS_CALDAV) {
while (!(eventType == XmlPullParser.END_TAG && parser.depth == depth)) {
if (eventType == XmlPullParser.START_TAG && parser.depth == depth + 1 && parser.namespace == XmlUtils.NS_CALDAV) {
when (parser.name) {
"allcomp" -> {
components.supportsEvents = true
......
......@@ -18,7 +18,7 @@ class SupportedReportSet: Property {
companion object {
val NAME = Property.Name(XmlUtils.NS_WEBDAV, "supported-report-set")
val SYNC_COLLECTION = "DAV:sync-collection" // collection synchronization (RFC 6578)
const val SYNC_COLLECTION = "DAV:sync-collection" // collection synchronization (RFC 6578)
}
val reports = mutableSetOf<String>()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment