diff --git a/src/main/java/net/fortuna/ical4j/model/Calendar.java b/src/main/java/net/fortuna/ical4j/model/Calendar.java index ddac37f02..48ec500e6 100644 --- a/src/main/java/net/fortuna/ical4j/model/Calendar.java +++ b/src/main/java/net/fortuna/ical4j/model/Calendar.java @@ -43,7 +43,6 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.io.IOException; import java.io.Serializable; import java.net.URISyntaxException; import java.text.ParseException; @@ -180,7 +179,6 @@ public Calendar(PropertyList p, ComponentList c, Validator p.getName().equals(property.getName()) ? property : p); + } } diff --git a/src/main/java/net/fortuna/ical4j/model/TextList.java b/src/main/java/net/fortuna/ical4j/model/TextList.java index 27d8ca8b8..efeb063a8 100644 --- a/src/main/java/net/fortuna/ical4j/model/TextList.java +++ b/src/main/java/net/fortuna/ical4j/model/TextList.java @@ -66,7 +66,7 @@ public TextList() { * @param aValue a string representation of a list of categories */ public TextList(final String aValue) { - texts = new CopyOnWriteArrayList(); + texts = new CopyOnWriteArrayList<>(); final Pattern pattern = Pattern.compile("(?:\\\\.|[^\\\\,]++)+"); @@ -80,7 +80,7 @@ public TextList(final String aValue) { /** * @param textValues an array of text values */ - public TextList(String[] textValues) { + public TextList(String...textValues) { texts = Arrays.asList(textValues); } @@ -88,7 +88,7 @@ public TextList(String[] textValues) { * {@inheritDoc} */ public final String toString() { - return texts.stream().map(t -> Strings.escape(t)).collect(Collectors.joining(",")); + return texts.stream().map(Strings::escape).collect(Collectors.joining(",")); } /** diff --git a/src/main/java/net/fortuna/ical4j/model/component/Observance.java b/src/main/java/net/fortuna/ical4j/model/component/Observance.java index f8ac7d46e..288133680 100644 --- a/src/main/java/net/fortuna/ical4j/model/component/Observance.java +++ b/src/main/java/net/fortuna/ical4j/model/component/Observance.java @@ -124,20 +124,17 @@ public final void validate(final boolean recurse) throws ValidationException { // From "4.8.3.3 Time Zone Offset From": // Conformance: This property MUST be specified in a "VTIMEZONE" // calendar component. - PropertyValidator.assertOne(Property.TZOFFSETFROM, - getProperties()); + PropertyValidator.assertOne(Property.TZOFFSETFROM, getProperties()); // From "4.8.3.4 Time Zone Offset To": // Conformance: This property MUST be specified in a "VTIMEZONE" // calendar component. - PropertyValidator.assertOne(Property.TZOFFSETTO, - getProperties()); + PropertyValidator.assertOne(Property.TZOFFSETTO, getProperties()); /* * ; the following are each REQUIRED, ; but MUST NOT occur more than once dtstart / tzoffsetto / tzoffsetfrom / */ - PropertyValidator.assertOne(Property.DTSTART, - getProperties()); + PropertyValidator.assertOne(Property.DTSTART, getProperties()); /* * ; the following are optional, ; and MAY occur more than once comment / rdate / rrule / tzname / x-prop diff --git a/src/test/java/net/fortuna/ical4j/data/ConcurrencyTest.java b/src/test/java/net/fortuna/ical4j/data/ConcurrencyTest.java index 3459bd613..451dc9123 100644 --- a/src/test/java/net/fortuna/ical4j/data/ConcurrencyTest.java +++ b/src/test/java/net/fortuna/ical4j/data/ConcurrencyTest.java @@ -94,7 +94,7 @@ public void run() { try { Calendar cal = new Calendar(calendar); size.addAndGet(cal.getComponents().size()); - } catch (IOException | ParseException | URISyntaxException e) { + } catch (ParseException | URISyntaxException e) { e.printStackTrace(); } } diff --git a/src/test/java/net/fortuna/ical4j/filter/FilterTest.java b/src/test/java/net/fortuna/ical4j/filter/FilterTest.java index 3825ce1c8..9501e5a37 100644 --- a/src/test/java/net/fortuna/ical4j/filter/FilterTest.java +++ b/src/test/java/net/fortuna/ical4j/filter/FilterTest.java @@ -146,24 +146,24 @@ public static TestSuite suite() throws FileNotFoundException, IOException, Parse TestSuite suite = new TestSuite(); //testFilterMatchAll.. - Filter filter = new Filter(new Predicate[] {organiserRuleMatch, attendee1RuleMatch}, Filter.MATCH_ALL); - suite.addTest(new FilterTest("testFilteredSize", filter, calendar.getComponents(), 2)); + Filter filter = new Filter<>(new Predicate[] {organiserRuleMatch, attendee1RuleMatch}, Filter.MATCH_ALL); + suite.addTest(new FilterTest<>("testFilteredSize", filter, calendar.getComponents(), 2)); - filter = new Filter(new Predicate[] {organiserRuleNoMatch, attendee1RuleMatch}, Filter.MATCH_ALL); - suite.addTest(new FilterTest("testFilteredIsEmpty", filter, calendar.getComponents())); + filter = new Filter<>(new Predicate[] {organiserRuleNoMatch, attendee1RuleMatch}, Filter.MATCH_ALL); + suite.addTest(new FilterTest<>("testFilteredIsEmpty", filter, calendar.getComponents())); - filter = new Filter(new Predicate[] {organiserRuleMatch, attendeeRuleNoMatch}, Filter.MATCH_ALL); - suite.addTest(new FilterTest("testFilteredIsEmpty", filter, calendar.getComponents())); + filter = new Filter<>(new Predicate[] {organiserRuleMatch, attendeeRuleNoMatch}, Filter.MATCH_ALL); + suite.addTest(new FilterTest<>("testFilteredIsEmpty", filter, calendar.getComponents())); //testFilterMatchAny.. - filter = new Filter(new Predicate[] {organiserRuleMatch, attendee1RuleMatch}, Filter.MATCH_ANY); - suite.addTest(new FilterTest("testFilteredSize", filter, calendar.getComponents(), 3)); + filter = new Filter<>(new Predicate[] {organiserRuleMatch, attendee1RuleMatch}, Filter.MATCH_ANY); + suite.addTest(new FilterTest<>("testFilteredSize", filter, calendar.getComponents(), 3)); - filter = new Filter(new Predicate[] {organiserRuleNoMatch, attendee1RuleMatch}, Filter.MATCH_ANY); - suite.addTest(new FilterTest("testFilteredSize", filter, calendar.getComponents(), 2)); + filter = new Filter<>(new Predicate[] {organiserRuleNoMatch, attendee1RuleMatch}, Filter.MATCH_ANY); + suite.addTest(new FilterTest<>("testFilteredSize", filter, calendar.getComponents(), 2)); - filter = new Filter(new Predicate[] {organiserRuleMatch, attendeeRuleNoMatch}, Filter.MATCH_ANY); - suite.addTest(new FilterTest("testFilteredSize", filter, calendar.getComponents(), 3)); + filter = new Filter<>(new Predicate[] {organiserRuleMatch, attendeeRuleNoMatch}, Filter.MATCH_ANY); + suite.addTest(new FilterTest<>("testFilteredSize", filter, calendar.getComponents(), 3)); return suite; } } diff --git a/src/test/java/net/fortuna/ical4j/filter/PeriodRuleTest.java b/src/test/java/net/fortuna/ical4j/filter/PeriodRuleTest.java index 418aee37c..78dfb994d 100644 --- a/src/test/java/net/fortuna/ical4j/filter/PeriodRuleTest.java +++ b/src/test/java/net/fortuna/ical4j/filter/PeriodRuleTest.java @@ -88,7 +88,7 @@ public PeriodRuleTest(String testMethod, Filter filter, /* (non-Javadoc) * @see junit.framework.TestCase#tearDown() */ - protected void tearDown() throws Exception { + protected void tearDown() { CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION); } @@ -128,7 +128,7 @@ public static TestSuite suite() throws FileNotFoundException, IOException, Parse ZonedDateTime apr1 = ZonedDateTime.now().withYear(2004).withMonth(4).withDayOfMonth(1); // period of two weeks.. Period period = new Period<>(apr1, java.time.Period.ofWeeks(2)); - Filter filter = new Filter(new PeriodRule<>(period)); + Filter filter = new Filter<>(new PeriodRule<>(period)); // ComponentList filtered = (ComponentList) filter.filter(calendar.getComponents()); // assertTrue(!filtered.isEmpty()); suite.addTest(new PeriodRuleTest("testFilteredIsNotEmpty", filter, calendar.getComponents())); diff --git a/src/test/java/net/fortuna/ical4j/model/component/VFreeBusyTest.java b/src/test/java/net/fortuna/ical4j/model/component/VFreeBusyTest.java index 030f9a33e..415f94022 100644 --- a/src/test/java/net/fortuna/ical4j/model/component/VFreeBusyTest.java +++ b/src/test/java/net/fortuna/ical4j/model/component/VFreeBusyTest.java @@ -158,7 +158,7 @@ protected void tearDown() throws Exception { * Class under test for void VFreeBusy(ComponentList) */ public final void testVFreeBusyComponentList() { - ComponentList components = new ComponentList(); + ComponentList components = new ComponentList<>(); ZonedDateTime startDate = ZonedDateTime.ofInstant( Instant.ofEpochMilli(0), ZoneId.systemDefault()); @@ -218,8 +218,8 @@ public final void testVFreeBusyComponentList2() throws Exception { } } - public final void testVFreeBusyComponentList3() throws Exception { - ComponentList components = new ComponentList(); + public final void testVFreeBusyComponentList3() { + ComponentList components = new ComponentList<>(); ZonedDateTime eventStart = ZonedDateTime.ofInstant( Instant.ofEpochMilli(0), ZoneId.systemDefault()); @@ -255,7 +255,7 @@ public final void testVFreeBusyComponentList3() throws Exception { } public final void testVFreeBusyComponentList4() { - ComponentList components = new ComponentList(); + ComponentList components = new ComponentList<>(); Instant startDate = Instant.now(); Instant endDate = ZonedDateTime.now().plusDays(3).toInstant(); @@ -402,7 +402,7 @@ public static TestSuite suite() throws ParseException, URISyntaxException, // A test for a request for free time where the VFreeBusy instance doesn't // consume any time in the specified range. Correct behaviour should see the // return of a VFreeBusy specifying the entire range as free. - ComponentList components = new ComponentList(); + ComponentList components = new ComponentList<>(); VEvent event1 = new VEvent(TemporalAdapter.parse("20050101T080000").getTemporal(), java.time.Duration.ofMinutes(15), "Consultation 1"); components.add(event1); @@ -423,7 +423,7 @@ public static TestSuite suite() throws ParseException, URISyntaxException, suite.addTest(new VFreeBusyTest("testFreeBusyPeriods", requestFree, components, periods)); //testBusyTime.. - components = new ComponentList(); + components = new ComponentList<>(); event1 = new VEvent((Temporal) TemporalAdapter.parse("20050103T080000Z").getTemporal(), java.time.Duration.ofHours(5), "Event 1"); Recur rRuleRecur = new Recur("FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR");