Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Jakarta EE 9 #167

Merged
merged 5 commits into from
Feb 17, 2025
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
4 changes: 0 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-text-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
Expand Down
49 changes: 22 additions & 27 deletions src/main/java/hudson/plugins/plot/CSVSeries.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.ObjectUtils;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
* Represents a plot data series configuration from an CSV file.
Expand Down Expand Up @@ -113,7 +113,7 @@
}

if (results == 0) {
this.exclusionValuesList = Arrays.asList(PAT_COMMA.split((String) this.exclusionValues));
this.exclusionValuesList = Arrays.asList(PAT_COMMA.split(this.exclusionValues));
}
}
loadExclusionSet();
Expand Down Expand Up @@ -195,7 +195,7 @@
}

// load existing plot file
inputReader = new InputStreamReader(in, Charset.defaultCharset().name());
inputReader = new InputStreamReader(in, Charset.defaultCharset());
reader = new CSVReader(inputReader);
String[] nextLine;

Expand All @@ -206,7 +206,7 @@
int lineNum = 0;
while ((nextLine = reader.readNext()) != null) {
// skip empty lines
if (nextLine.length == 1 && nextLine[0].length() == 0) {
if (nextLine.length == 1 && nextLine[0].isEmpty()) {

Check warning on line 209 in src/main/java/hudson/plugins/plot/CSVSeries.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 209 is only partially covered, 3 branches are missing
continue;
}

Expand All @@ -217,7 +217,7 @@
yvalue = nextLine[index].trim();

// empty value, caused by e.g. trailing comma in CSV
if (yvalue.trim().length() == 0) {
if (yvalue.trim().isEmpty()) {
continue;
}

Expand Down Expand Up @@ -278,27 +278,22 @@
return false;
}

boolean retVal;
switch (inclusionFlag) {
case INCLUDE_BY_STRING:
// if the set contains it, don't exclude it.
retVal = !checkExclusionSet(label);
break;
case EXCLUDE_BY_STRING:
// if the set doesn't contain it, exclude it.
retVal = checkExclusionSet(label);
break;
case INCLUDE_BY_COLUMN:
// if the set contains it, don't exclude it.
retVal = !(colExclusionSet.contains(Integer.valueOf(index)));
break;
case EXCLUDE_BY_COLUMN:
// if the set doesn't contain it, don't exclude it.
retVal = colExclusionSet.contains(Integer.valueOf(index));
break;
default:
retVal = false;
}
boolean retVal =
switch (inclusionFlag) {
case INCLUDE_BY_STRING ->
// if the set contains it, don't exclude it.
!checkExclusionSet(label);
case EXCLUDE_BY_STRING ->
// if the set doesn't contain it, exclude it.
checkExclusionSet(label);
case INCLUDE_BY_COLUMN ->
// if the set contains it, don't exclude it.
!(colExclusionSet.contains(index));
case EXCLUDE_BY_COLUMN ->
// if the set doesn't contain it, don't exclude it.
colExclusionSet.contains(index);

Check warning on line 294 in src/main/java/hudson/plugins/plot/CSVSeries.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 291-294 are not covered by tests
default -> false;
};

if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest(((retVal) ? "excluded" : "included") + " CSV Column: " + index + " : " + label);
Expand Down Expand Up @@ -405,7 +400,7 @@
}

@Override
public Series newInstance(StaplerRequest req, @NonNull JSONObject formData) throws FormException {
public Series newInstance(StaplerRequest2 req, @NonNull JSONObject formData) throws FormException {
return SeriesFactory.createSeries(formData, req);
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/hudson/plugins/plot/MatrixPlotPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.commons.lang.ObjectUtils;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
* @author lucinka
Expand All @@ -33,12 +33,12 @@

private transient Map<MatrixConfiguration, List<Plot>> plotsOfConfigurations = new HashMap<>();

private transient Map<String, List<Plot>> groupMap = new HashMap<String, List<Plot>>();
private transient Map<String, List<Plot>> groupMap = new HashMap<>();

/**
* Configured plots.
*/
private List<Plot> plots = new ArrayList<Plot>();
private List<Plot> plots = new ArrayList<>();

public String urlGroupToOriginalGroup(String urlGroup, MatrixConfiguration c) {
if (urlGroup == null || "nogroup".equals(urlGroup)) {
Expand All @@ -51,7 +51,7 @@
plotList.add(plot);
}
}
if (plotList.size() > 0) {
if (!plotList.isEmpty()) {

Check warning on line 54 in src/main/java/hudson/plugins/plot/MatrixPlotPublisher.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 54 is only partially covered, one branch is missing
return plotList.get(0).group;
}
}
Expand Down Expand Up @@ -110,7 +110,7 @@
*/
public List<Plot> getPlots(MatrixConfiguration configuration) {
List<Plot> p = plotsOfConfigurations.get(configuration);
return (p != null) ? p : new ArrayList<Plot>();
return (p != null) ? p : new ArrayList<>();

Check warning on line 113 in src/main/java/hudson/plugins/plot/MatrixPlotPublisher.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 113 is not covered by tests
}

public List<Plot> getPlots() {
Expand Down Expand Up @@ -164,7 +164,7 @@
p.yaxisMaximum,
p.description);
plot.series = p.series;
plot.setProject((MatrixConfiguration) build.getProject());
plot.setProject(build.getProject());
addPlot(plot);
}
}
Expand Down Expand Up @@ -226,17 +226,17 @@
* Called when the user saves the project configuration.
*/
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) throws FormException {
public Publisher newInstance(StaplerRequest2 req, JSONObject formData) throws FormException {
MatrixPlotPublisher publisher = new MatrixPlotPublisher();
List<Plot> plots = new ArrayList<Plot>();
List<Plot> plots = new ArrayList<>();

Check warning on line 231 in src/main/java/hudson/plugins/plot/MatrixPlotPublisher.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 231 is not covered by tests
for (Object data : SeriesFactory.getArray(formData.get("plots"))) {
plots.add(bindPlot((JSONObject) data, req));
}
publisher.setPlots(plots);
return publisher;
}

private static Plot bindPlot(JSONObject data, StaplerRequest req) {
private static Plot bindPlot(JSONObject data, StaplerRequest2 req) {
Plot p = req.bindJSON(Plot.class, data);
p.series = SeriesFactory.createSeriesList(data.get("series"), req);
return p;
Expand Down
Loading
Loading