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
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Map;
import java.util.Objects;
import java.util.WeakHashMap;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.model.TransientActionFactory;
import org.apache.commons.lang.StringUtils;

/**
* Provides a way for a {@link ComputedFolder} to break the association between the directory names on disk
Expand Down Expand Up @@ -293,7 +293,7 @@ public final String readItemName(@NonNull File directory) {
File nameFile = new File(directory, CHILD_NAME_FILE);
if (nameFile.isFile()) {
try {
childName = StringUtils.defaultString(StringUtils.trimToNull(Files.readString(nameFile.toPath(), StandardCharsets.UTF_8)), directory.getName());
childName = Objects.toString(Util.fixEmptyAndTrim(Files.readString(nameFile.toPath(), StandardCharsets.UTF_8)), directory.getName());
} catch (IOException e) {
LOGGER.log(Level.WARNING, () -> "Could not read "+ nameFile + ", assuming child name is " + directory.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;

/**
Expand Down Expand Up @@ -107,19 +106,19 @@
interval = interval.toLowerCase();
if (interval.endsWith("h")) {
units = TimeUnit.HOURS;
interval = StringUtils.removeEnd(interval, "h");
interval = interval.substring(0, interval.length() - 1);
}
if (interval.endsWith("m")) {
interval = StringUtils.removeEnd(interval, "m");
interval = interval.substring(0, interval.length() - 1);
} else if (interval.endsWith("d")) {
units = TimeUnit.DAYS;
interval = StringUtils.removeEnd(interval, "d");
interval = interval.substring(0, interval.length() - 1);
} else if (interval.endsWith("ms")) {
units = TimeUnit.SECONDS;
interval = StringUtils.removeEnd(interval, "ms");
interval = interval.substring(0, interval.length() - 1);
Copy link

@szjozsef szjozsef May 29, 2025

Choose a reason for hiding this comment

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

Here should not be: interval = interval.substring(0, interval.length() - 2); ?

Copy link
Member

Choose a reason for hiding this comment

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

} else if (interval.endsWith("s")) {
units = TimeUnit.SECONDS;
interval = StringUtils.removeEnd(interval, "s");
interval = interval.substring(0, interval.length() - 1);

Check warning on line 121 in src/main/java/com/cloudbees/hudson/plugins/folder/computed/PeriodicFolderTrigger.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 118-121 are not covered by tests
}
long value = 0;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
*/
@NonNull
public String getTimestampString2() {
return Util.XS_DATETIME_FORMATTER.format(computation.getTimestamp());
return Util.XS_DATETIME_FORMATTER2.format(computation.getTimestamp().toInstant());

Check warning on line 74 in src/main/java/com/cloudbees/hudson/plugins/folder/computed/PseudoRun.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 74 is not covered by tests
}

@CheckForNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import java.util.TreeSet;
import edu.umd.cs.findbugs.annotations.NonNull;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsSessionRule;
Expand Down Expand Up @@ -623,7 +622,7 @@ static CharSequence asJavaString(String rawString) {
if (c >= 32 && c < 128) {
b.append(c);
} else {
b.append("\\u").append(StringUtils.leftPad(Integer.toHexString(c & 0xffff), 4, '0'));
b.append(String.format("\\u%04x", (int) c));
}
}
return b;
Expand Down