Commit ce388590 authored by Ricki Hirner's avatar Ricki Hirner 🐑

Don't reuse ical4j parameter/property factories in possibly different threads;...

Don't reuse ical4j parameter/property factories in possibly different threads; update Android dependencies
parent 13e85f0b
Pipeline #67592531 failed with stages
in 4 minutes and 10 seconds
buildscript {
ext.versions = [
kotlin: '1.3.31',
dokka: '0.9.17',
kotlin: '1.3.40',
dokka: '0.9.18',
ical4j: '2.2.4'
]
......@@ -60,9 +60,9 @@ dependencies {
implementation 'org.slf4j:slf4j-jdk14:1.7.25'
implementation 'androidx.core:core-ktx:1.0.2'
androidTestImplementation 'androidx.test:core:1.1.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
testImplementation 'junit:junit:4.12'
}
......@@ -753,6 +753,9 @@ abstract class AndroidEvent(
*/
object UnknownProperty {
private val parameterFactory = ParameterFactoryRegistry()
private val propertyFactory = PropertyFactoryRegistry()
/**
* Deserializes a JSON string from an ExtendedProperty value to an ical4j property.
*
......@@ -768,13 +771,13 @@ abstract class AndroidEvent(
val params = ParameterList()
json.optJSONObject(2)?.let { jsonParams ->
for (paramName in jsonParams.keys())
params.add(ICalendar.parameterFactoryRegistry.createParameter(
params.add(parameterFactory.createParameter(
paramName,
jsonParams.getString(paramName)
))
}
return ICalendar.propertyFactoryRegistry.createProperty(name, params, value)
return propertyFactory.createProperty(name, params, value)
}
/**
......
......@@ -8,6 +8,7 @@
package at.bitfire.ical4android
import net.fortuna.ical4j.data.CalendarBuilder
import net.fortuna.ical4j.data.CalendarOutputter
import net.fortuna.ical4j.data.ParserException
import net.fortuna.ical4j.model.Calendar
......@@ -75,7 +76,7 @@ class Event: ICalendar() {
// parse stream
val ical: Calendar
try {
ical = calendarBuilder().build(reader)
ical = CalendarBuilder().build(reader)
} catch(e: ParserException) {
throw InvalidCalendarException("Couldn't parse iCalendar object", e)
} catch(e: IllegalArgumentException) {
......
......@@ -38,14 +38,6 @@ open class ICalendar {
}
var prodId = ProdId("+//IDN bitfire.at//ical4android")
val propertyFactoryRegistry = PropertyFactoryRegistry()
val parameterFactoryRegistry = ParameterFactoryRegistry()
@JvmStatic
protected fun calendarBuilder() = CalendarBuilder(
CalendarParserFactory.getInstance().createParser(),
propertyFactoryRegistry, parameterFactoryRegistry,
TimeZoneRegistryFactory.getInstance().createRegistry())
// time zone helpers
......
......@@ -8,6 +8,7 @@
package at.bitfire.ical4android
import net.fortuna.ical4j.data.CalendarBuilder
import net.fortuna.ical4j.data.CalendarOutputter
import net.fortuna.ical4j.data.ParserException
import net.fortuna.ical4j.model.*
......@@ -64,7 +65,7 @@ class Task: ICalendar() {
fun fromReader(reader: Reader): List<Task> {
val ical: Calendar
try {
ical = calendarBuilder().build(reader)
ical = CalendarBuilder().build(reader)
} catch(e: ParserException) {
throw InvalidCalendarException("Couldn't parse iCalendar object", e)
} catch(e: IllegalArgumentException) {
......
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