diff --git a/src/main/java/io/jenkins/plugins/view/calendar/event/CalendarEventFactory.java b/src/main/java/io/jenkins/plugins/view/calendar/event/CalendarEventFactory.java index effbf91..1734d7b 100644 --- a/src/main/java/io/jenkins/plugins/view/calendar/event/CalendarEventFactory.java +++ b/src/main/java/io/jenkins/plugins/view/calendar/event/CalendarEventFactory.java @@ -69,13 +69,13 @@ private abstract class CalendarEventImpl implements CalendarEvent { protected long duration; private transient List lastEvents; - protected String initId(final String url, final long startTimeInMillis) { + /* default */ final String initId(final String url, final long startTimeInMillis) { return StringUtils.defaultString(url, "") .replace("/", "-") .toLowerCase(Locale.ENGLISH) + startTimeInMillis; } - protected Moment initEnd(final long timeInMillis, final long duration) { + /* default */ final Moment initEnd(final long timeInMillis, final long duration) { // duration needs to be at least 1sec otherwise // fullcalendar will not properly display the event final long dur = (duration < 1000) ? 1000 : duration; diff --git a/src/main/java/io/jenkins/plugins/view/calendar/service/CalendarEventService.java b/src/main/java/io/jenkins/plugins/view/calendar/service/CalendarEventService.java index d248bd4..dd6b59c 100644 --- a/src/main/java/io/jenkins/plugins/view/calendar/service/CalendarEventService.java +++ b/src/main/java/io/jenkins/plugins/view/calendar/service/CalendarEventService.java @@ -38,7 +38,6 @@ import hudson.model.Result; import hudson.model.Run; import hudson.scheduler.CronTab; -import hudson.util.RunList; import io.jenkins.plugins.view.calendar.CalendarView.CalendarViewEventsType; import io.jenkins.plugins.view.calendar.event.CalendarEvent; import io.jenkins.plugins.view.calendar.event.CalendarEventComparator; @@ -222,7 +221,7 @@ public List getStartedEvents(final List job if (state == CalendarEventState.RUNNING && !job.isBuilding()) { continue; } - final RunList builds = job.getBuilds(); + final List builds = job.getBuilds(); for (final Run build : builds) { if (state == CalendarEventState.RUNNING && !build.isBuilding()) { continue; diff --git a/src/main/java/io/jenkins/plugins/view/calendar/service/CronJobService.java b/src/main/java/io/jenkins/plugins/view/calendar/service/CronJobService.java index 67cf90c..9dca765 100644 --- a/src/main/java/io/jenkins/plugins/view/calendar/service/CronJobService.java +++ b/src/main/java/io/jenkins/plugins/view/calendar/service/CronJobService.java @@ -103,7 +103,7 @@ public List getCronTabs(final Trigger trigger, final Hash hash) { @SuppressWarnings("PMD.CyclomaticComplexity") public List getCronTriggers(final Job job, final CalendarViewEventsType eventsType) { - Collection> jobTriggers; + final Collection> jobTriggers; if (job instanceof AbstractProject) { jobTriggers = ((AbstractProject)job).getTriggers().values(); } else if (PluginUtil.hasWorkflowJobPluginInstalled() && job instanceof WorkflowJob) { diff --git a/src/main/java/io/jenkins/plugins/view/calendar/time/Moment.java b/src/main/java/io/jenkins/plugins/view/calendar/time/Moment.java index 9b80267..93b0276 100644 --- a/src/main/java/io/jenkins/plugins/view/calendar/time/Moment.java +++ b/src/main/java/io/jenkins/plugins/view/calendar/time/Moment.java @@ -75,10 +75,7 @@ public int hashCode() { @Override public boolean equals(final Object o) { - if (!(o instanceof Moment)) { - return false; - } - return calendar.equals(((Moment)o).calendar); + return (o instanceof Moment) && calendar.equals(((Moment)o).calendar); } @Override