Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>5.2102.v5f5fe09fccf1</version>
<version>6.2122.v70b_7b_f659d72</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
Expand All @@ -21,6 +21,7 @@
<ban-junit4-imports.skip>false</ban-junit4-imports.skip>
<node.version>24.12.0</node.version>
<npm.version>11.6.2</npm.version>
<ban-commons-lang-2.skip>false</ban-commons-lang-2.skip>
</properties>
<name>Calendar View Plugin</name>
<developers>
Expand Down Expand Up @@ -68,9 +69,25 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they are now on bom right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but not in the bom version used by the plugin. I didn't want to enforce a core and bom bump for this pull request.

<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>parameterized-scheduler</artifactId>
<!-- TODO Until https://github.com/jenkinsci/bom/commit/72bb85360ded90bce299adc93e385795764fc8c2 in BOM used here -->
<version>378.va_234d1c44456</version>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>extended-timer-trigger</artifactId>
<!-- TODO Until BOM updated with plugin in it -->
<version>48.vf99b_c63a_685b_</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-text-api</artifactId>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>jquery3-api</artifactId>
Expand All @@ -88,13 +105,11 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>parameterized-scheduler</artifactId>
<version>374.v531b_4f4d99b_3</version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved it to <dependencyManagement/>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugins was added in BOM 2 years ago. I generally find it a better approach to set the version in the dependencyManagement.

<optional>true</optional>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>extended-timer-trigger</artifactId>
<version>48.vf99b_c63a_685b_</version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved it to <dependencyManagement/>

<optional>true</optional>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import io.jenkins.plugins.view.calendar.service.CronJobService;
import io.jenkins.plugins.view.calendar.time.Moment;
import io.jenkins.plugins.view.calendar.util.RequestUtil;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.DataBoundConstructor;
Expand Down Expand Up @@ -423,7 +423,7 @@ public List<CalendarEvent> getEvents() throws ParseException {
}

public String jsonEscape(final String text) {
return StringEscapeUtils.escapeJavaScript(text);
return StringEscapeUtils.escapeEcmaScript(text);
}

@Extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
import io.jenkins.plugins.view.calendar.time.MomentRange;
import io.jenkins.plugins.view.calendar.util.DateUtil;

import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Objects;

@Restricted(NoExternalUse.class)
public class CalendarEventFactory {
Expand Down Expand Up @@ -70,7 +70,7 @@ private abstract class CalendarEventImpl implements CalendarEvent {
private transient List<StartedCalendarEvent> lastEvents;

/* default */ final String initId(final String url, final long startTimeInMillis) {
return StringUtils.defaultString(url, "")
return Objects.requireNonNullElse(url, "")
.replace("/", "-")
.toLowerCase(Locale.ENGLISH) + startTimeInMillis;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import io.jenkins.plugins.view.calendar.util.PluginUtil;

import jenkins.triggers.TriggeredItem;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.jenkinsci.plugins.parameterizedscheduler.ParameterizedTimerTrigger;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -119,15 +118,17 @@
for (final Trigger<?> jobTrigger: jobTriggers) {
if (eventsType == CalendarViewEventsType.ALL ||
(eventsType == CalendarViewEventsType.BUILDS ^ jobTrigger instanceof SCMTrigger)) {
if (StringUtils.isNotBlank(jobTrigger.getSpec())) {
if (jobTrigger.getSpec() != null && !jobTrigger.getSpec().isBlank()) {
cronTriggers.add(jobTrigger);
} else if (PluginUtil.hasParameterizedSchedulerPluginInstalled()
&& jobTrigger instanceof ParameterizedTimerTrigger
&& StringUtils.isNotBlank(((ParameterizedTimerTrigger) jobTrigger).getParameterizedSpecification())) {
&& jobTrigger instanceof ParameterizedTimerTrigger ptt
&& ptt.getParameterizedSpecification() != null

Check warning on line 125 in src/main/java/io/jenkins/plugins/view/calendar/service/CronJobService.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 125 is only partially covered, one branch is missing
&& !ptt.getParameterizedSpecification().isBlank()) {

Check warning on line 126 in src/main/java/io/jenkins/plugins/view/calendar/service/CronJobService.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 126 is only partially covered, one branch is missing
cronTriggers.add(jobTrigger);
} else if (PluginUtil.hasExtendedTimerTriggerPluginInstalled() &&
jobTrigger instanceof ExtendedTimerTrigger
&& StringUtils.isNotBlank(((ExtendedTimerTrigger) jobTrigger).getCronSpec())) {
} else if (PluginUtil.hasExtendedTimerTriggerPluginInstalled()

Check warning on line 128 in src/main/java/io/jenkins/plugins/view/calendar/service/CronJobService.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 128 is only partially covered, one branch is missing
&& jobTrigger instanceof ExtendedTimerTrigger ett
&& ett.getCronSpec() != null

Check warning on line 130 in src/main/java/io/jenkins/plugins/view/calendar/service/CronJobService.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 130 is only partially covered, one branch is missing
&& !ett.getCronSpec().isBlank()) {

Check warning on line 131 in src/main/java/io/jenkins/plugins/view/calendar/service/CronJobService.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 131 is only partially covered, one branch is missing
cronTriggers.add(jobTrigger);
}
}
Expand Down
Loading