aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-04-03 22:40:43 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-04-03 22:40:43 -0700
commita523c86bed9b046d3c6164c8d94632cf3b64a8e9 (patch)
treed44ca2ac856a5b3669a770b68d29ec664def28bf
parent8ecc4af154ec67a8818a21b96a9f10a74bfc919c (diff)
downloadtrackermap-server-a523c86bed9b046d3c6164c8d94632cf3b64a8e9.tar.gz
trackermap-server-a523c86bed9b046d3c6164c8d94632cf3b64a8e9.tar.bz2
trackermap-server-a523c86bed9b046d3c6164c8d94632cf3b64a8e9.zip
Upgrade calendar library
-rw-r--r--build.gradle2
-rw-r--r--pom.xml13
-rw-r--r--src/main/java/org/traccar/model/Calendar.java15
-rw-r--r--src/main/resources/ical4j.properties1
4 files changed, 14 insertions, 17 deletions
diff --git a/build.gradle b/build.gradle
index cf0113290..93871b36d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -67,7 +67,7 @@ dependencies {
implementation "org.apache.velocity:velocity:1.7"
implementation "org.apache.velocity:velocity-tools:2.0"
implementation "org.apache.commons:commons-collections4:4.4"
- implementation "org.mnode.ical4j:ical4j:2.0.5" // needs upgrade
+ implementation "org.mnode.ical4j:ical4j:3.0.22"
implementation "org.locationtech.spatial4j:spatial4j:0.8"
implementation "org.locationtech.jts:jts-core:1.18.0"
implementation "net.java.dev.jna:jna-platform:5.6.0"
diff --git a/pom.xml b/pom.xml
index c90bdc96e..7c4846e7c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -184,7 +184,7 @@
<dependency>
<groupId>org.mnode.ical4j</groupId>
<artifactId>ical4j</artifactId>
- <version>2.0.5</version> <!-- TODO UPGRADE -->
+ <version>3.0.22</version>
</dependency>
<dependency>
<groupId>org.locationtech.spatial4j</groupId>
@@ -231,6 +231,11 @@
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
+ <dependency>
+ <groupId>com.amazonaws</groupId>
+ <artifactId>aws-java-sdk</artifactId>
+ <version>1.11.967</version>
+ </dependency>
<!-- override dependencies to match gradle -->
<dependency>
@@ -263,12 +268,6 @@
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.12.1</version>
</dependency>
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.11.967</version>
- </dependency>
-
</dependencies>
<build>
diff --git a/src/main/java/org/traccar/model/Calendar.java b/src/main/java/org/traccar/model/Calendar.java
index 56d3eb74c..2476efa0a 100644
--- a/src/main/java/org/traccar/model/Calendar.java
+++ b/src/main/java/org/traccar/model/Calendar.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,6 +18,7 @@ package org.traccar.model;
import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.time.Duration;
import java.util.Collection;
import java.util.Date;
@@ -28,10 +29,9 @@ import net.fortuna.ical4j.data.ParserException;
import net.fortuna.ical4j.filter.Filter;
import net.fortuna.ical4j.filter.PeriodRule;
import net.fortuna.ical4j.model.DateTime;
-import net.fortuna.ical4j.model.Dur;
import net.fortuna.ical4j.model.Period;
+import net.fortuna.ical4j.model.TimeZoneRegistryImpl;
import net.fortuna.ical4j.model.component.CalendarComponent;
-import org.apache.commons.collections4.Predicate;
import org.traccar.database.QueryIgnore;
public class Calendar extends ExtendedModel {
@@ -68,13 +68,10 @@ public class Calendar extends ExtendedModel {
public boolean checkMoment(Date date) {
if (calendar != null) {
- Period period = new Period(new DateTime(date), new Dur(0, 0, 0, 0));
- Predicate<CalendarComponent> periodRule = new PeriodRule<>(period);
- Filter<CalendarComponent> filter = new Filter<>(new Predicate[] {periodRule}, Filter.MATCH_ANY);
+ Period period = new Period(new DateTime(date), Duration.ZERO);
+ Filter<CalendarComponent> filter = new Filter<>(new PeriodRule<>(period));
Collection<CalendarComponent> events = filter.filter(calendar.getComponents(CalendarComponent.VEVENT));
- if (events != null && !events.isEmpty()) {
- return true;
- }
+ return events != null && !events.isEmpty();
}
return false;
}
diff --git a/src/main/resources/ical4j.properties b/src/main/resources/ical4j.properties
new file mode 100644
index 000000000..a08674709
--- /dev/null
+++ b/src/main/resources/ical4j.properties
@@ -0,0 +1 @@
+net.fortuna.ical4j.timezone.cache.impl=net.fortuna.ical4j.util.MapTimeZoneCache