Skip to content

Commit 135eedf

Browse files
committed
Do not call deprecated methods
1 parent b006cbd commit 135eedf

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/main/java/io/jenkins/plugins/fontawesome/FontAwesomeIcons.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package io.jenkins.plugins.fontawesome;
22

3+
import org.apache.commons.lang3.Strings;
4+
5+
import edu.umd.cs.findbugs.annotations.CheckForNull;
6+
37
import java.io.IOException;
48
import java.net.URI;
59
import java.net.URISyntaxException;
@@ -17,10 +21,6 @@
1721
import java.util.stream.Collectors;
1822
import java.util.stream.Stream;
1923

20-
import org.apache.commons.lang3.StringUtils;
21-
22-
import edu.umd.cs.findbugs.annotations.CheckForNull;
23-
2424
import io.jenkins.plugins.fontawesome.SvgTag.FontAwesomeStyle;
2525

2626
/**
@@ -75,10 +75,10 @@ private static Map<String, String> getIconsFromClasspath(@CheckForNull final Fon
7575
while (urls.hasMoreElements()) {
7676
URL url = urls.nextElement();
7777

78-
if (StringUtils.contains(url.toExternalForm(), FONT_AWESOME_API_PLUGIN)) {
78+
if (Strings.CS.contains(url.toExternalForm(), FONT_AWESOME_API_PLUGIN)) {
7979
URI uri = url.toURI();
8080

81-
if (StringUtils.equals(uri.getScheme(), "jar")) {
81+
if (Strings.CS.contains(uri.getScheme(), "jar")) {
8282
try (FileSystem fileSystem = FileSystems.newFileSystem(uri, Collections.emptyMap())) {
8383
return filterIcons(fileSystem.getPath(IMAGES_SYMBOLS_PATH), filter);
8484
}
@@ -114,11 +114,11 @@ private static Stream<Path> createIconStream(final Path iconFolder, @CheckForNul
114114

115115
private static String createFileName(final Path icon) {
116116
return icon.getParent().getFileName() + "/"
117-
+ StringUtils.removeEnd(icon.getFileName().toString(), SVG_FILE_ENDING);
117+
+ Strings.CS.removeEnd(icon.getFileName().toString(), SVG_FILE_ENDING);
118118
}
119119

120120
private static boolean isSvgImage(final Path path) {
121-
return StringUtils.endsWith(path.getFileName().toString(), SVG_FILE_ENDING);
121+
return Strings.CS.endsWith(path.getFileName().toString(), SVG_FILE_ENDING);
122122
}
123123

124124
private FontAwesomeIcons() {

src/test/java/io/jenkins/plugins/fontawesome/FontAwesomeIconsTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
package io.jenkins.plugins.fontawesome;
22

3+
import org.apache.commons.lang3.Strings;
4+
import org.junit.jupiter.api.BeforeAll;
5+
import org.junit.jupiter.api.Test;
6+
import org.junit.jupiter.params.ParameterizedTest;
7+
import org.junit.jupiter.params.provider.EnumSource;
8+
import org.junit.jupiter.params.provider.NullSource;
9+
10+
import edu.umd.cs.findbugs.annotations.CheckForNull;
11+
312
import java.nio.file.Files;
413
import java.nio.file.Path;
514
import java.nio.file.Paths;
@@ -10,15 +19,6 @@
1019
import java.util.stream.Collectors;
1120
import java.util.stream.Stream;
1221

13-
import org.apache.commons.lang3.StringUtils;
14-
import org.junit.jupiter.api.BeforeAll;
15-
import org.junit.jupiter.api.Test;
16-
import org.junit.jupiter.params.ParameterizedTest;
17-
import org.junit.jupiter.params.provider.EnumSource;
18-
import org.junit.jupiter.params.provider.NullSource;
19-
20-
import edu.umd.cs.findbugs.annotations.CheckForNull;
21-
2222
import static org.assertj.core.api.Assertions.*;
2323

2424
/**
@@ -51,8 +51,8 @@ void testGetAvailableIconsFiltered(@CheckForNull final SvgTag.FontAwesomeStyle s
5151
try (Stream<Path> stream = Files
5252
.walk(Paths.get("./target/classes/images/symbols/" + (style == null ? "" : style.name().toLowerCase(Locale.ENGLISH))), 2)) {
5353
Set<String> iconNames = stream
54-
.filter(path -> StringUtils.endsWith(path.getFileName().toString(), ".svg"))
55-
.map(path -> path.getParent().getFileName().toString() + "/" + StringUtils.removeEnd(path.getFileName().toString(), ".svg"))
54+
.filter(path -> Strings.CS.endsWith(path.getFileName().toString(), ".svg"))
55+
.map(path -> path.getParent().getFileName().toString() + "/" + Strings.CS.removeEnd(path.getFileName().toString(), ".svg"))
5656
.collect(Collectors.toSet());
5757

5858
assertThat(availableIcons.keySet()).isEqualTo(iconNames);

0 commit comments

Comments
 (0)