Loading build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -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}" } Loading @@ -25,7 +25,7 @@ apply plugin: 'kotlin-android' apply plugin: 'org.jetbrains.dokka-android' ext { ical4j_version = "2.2.0" ical4j_version = '2.2.0' } android { Loading lombok.configdeleted 100644 → 0 +0 −1 Original line number Diff line number Diff line lombok.addGeneratedAnnotation = false src/main/java/at/bitfire/ical4android/BatchOperation.kt +12 −9 Original line number Diff line number Diff line Loading @@ -29,9 +29,9 @@ class BatchOperation( var affected = 0 if (!queue.isEmpty()) try { Constants.log.fine("Committing ${queue.size} operations …") Constants.log.fine("Committing ${queue.size} operations") results = Array(queue.size, { null }) results = arrayOfNulls(queue.size) runBatch(0, queue.size) for (result in results.filterNotNull()) Loading @@ -40,6 +40,7 @@ class BatchOperation( result.uri != null -> affected += 1 } Constants.log.fine("… $affected record(s) affected") } catch(e: Exception) { throw CalendarStorageException("Couldn't apply batch operation", e) } Loading @@ -58,21 +59,22 @@ class BatchOperation( * @param end index of last operation which will be run (exclusive!) * @throws RemoteException on calendar provider errors * @throws OperationApplicationException when the batch can't be processed * @throws CalendarStorageException if the transaction is too large or if the batch operation failed partially * @throws CalendarStorageException if the transaction is too large */ private fun runBatch(start: Int, end: Int) { if (end == start) return // nothing to do try { Constants.log.fine("Running operations $start to ${end-1}") val partResults = providerClient.applyBatch(toCPO(start, end)) val ops = toCPO(start, end) Constants.log.fine("Running {${ops.size}} operations ($start .. ${end-1})") val partResults = providerClient.applyBatch(ops) val n = end - start if (partResults.size != n) throw CalendarStorageException("Batch operation failed partially (only ${partResults.size} of $n operations done)") Constants.log.warning("Batch operation returned only ${partResults.size} instead of $n results") System.arraycopy(partResults, 0, results, start, n) System.arraycopy(partResults, 0, results, start, partResults.size) } catch(e: TransactionTooLargeException) { if (end <= start + 1) // only one operation, can't be split Loading @@ -87,6 +89,7 @@ class BatchOperation( private fun toCPO(start: Int, end: Int): ArrayList<ContentProviderOperation> { val cpo = ArrayList<ContentProviderOperation>(end - start) for ((i, op) in queue.subList(start, end).withIndex()) { val builder = op.builder op.backrefKey?.let { key -> Loading Loading
build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -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}" } Loading @@ -25,7 +25,7 @@ apply plugin: 'kotlin-android' apply plugin: 'org.jetbrains.dokka-android' ext { ical4j_version = "2.2.0" ical4j_version = '2.2.0' } android { Loading
lombok.configdeleted 100644 → 0 +0 −1 Original line number Diff line number Diff line lombok.addGeneratedAnnotation = false
src/main/java/at/bitfire/ical4android/BatchOperation.kt +12 −9 Original line number Diff line number Diff line Loading @@ -29,9 +29,9 @@ class BatchOperation( var affected = 0 if (!queue.isEmpty()) try { Constants.log.fine("Committing ${queue.size} operations …") Constants.log.fine("Committing ${queue.size} operations") results = Array(queue.size, { null }) results = arrayOfNulls(queue.size) runBatch(0, queue.size) for (result in results.filterNotNull()) Loading @@ -40,6 +40,7 @@ class BatchOperation( result.uri != null -> affected += 1 } Constants.log.fine("… $affected record(s) affected") } catch(e: Exception) { throw CalendarStorageException("Couldn't apply batch operation", e) } Loading @@ -58,21 +59,22 @@ class BatchOperation( * @param end index of last operation which will be run (exclusive!) * @throws RemoteException on calendar provider errors * @throws OperationApplicationException when the batch can't be processed * @throws CalendarStorageException if the transaction is too large or if the batch operation failed partially * @throws CalendarStorageException if the transaction is too large */ private fun runBatch(start: Int, end: Int) { if (end == start) return // nothing to do try { Constants.log.fine("Running operations $start to ${end-1}") val partResults = providerClient.applyBatch(toCPO(start, end)) val ops = toCPO(start, end) Constants.log.fine("Running {${ops.size}} operations ($start .. ${end-1})") val partResults = providerClient.applyBatch(ops) val n = end - start if (partResults.size != n) throw CalendarStorageException("Batch operation failed partially (only ${partResults.size} of $n operations done)") Constants.log.warning("Batch operation returned only ${partResults.size} instead of $n results") System.arraycopy(partResults, 0, results, start, n) System.arraycopy(partResults, 0, results, start, partResults.size) } catch(e: TransactionTooLargeException) { if (end <= start + 1) // only one operation, can't be split Loading @@ -87,6 +89,7 @@ class BatchOperation( private fun toCPO(start: Int, end: Int): ArrayList<ContentProviderOperation> { val cpo = ArrayList<ContentProviderOperation>(end - start) for ((i, op) in queue.subList(start, end).withIndex()) { val builder = op.builder op.backrefKey?.let { key -> Loading