Skip to content

Commit 09a8645

Browse files
authored
fix: remove unused method indexOfUnsafeChar (#216)
* fix: remove unused method `indexOfUnsafeChar` * Inline second argument of `indexOfFirstPercentChar`
1 parent a0b712f commit 09a8645

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/main/java/com/github/packageurl/PackageURL.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -589,20 +589,13 @@ private static String toLowerCase(String s) {
589589
return new String(chars);
590590
}
591591

592-
private static int indexOfPercentChar(final byte[] bytes, final int start) {
593-
return IntStream.range(start, bytes.length)
592+
private static int indexOfFirstPercentChar(final byte[] bytes) {
593+
return IntStream.range(0, bytes.length)
594594
.filter(i -> isPercent(bytes[i]))
595595
.findFirst()
596596
.orElse(-1);
597597
}
598598

599-
private static int indexOfUnsafeChar(final byte[] bytes, final int start) {
600-
return IntStream.range(start, bytes.length)
601-
.filter(i -> shouldEncode(bytes[i]))
602-
.findFirst()
603-
.orElse(-1);
604-
}
605-
606599
private static byte percentDecode(final byte[] bytes, final int start) {
607600
if (start + 2 >= bytes.length) {
608601
throw new ValidationException("Incomplete percent encoding at offset " + start + " with value '"
@@ -636,7 +629,7 @@ private static String percentDecode(final String source) {
636629
}
637630

638631
byte[] bytes = source.getBytes(StandardCharsets.UTF_8);
639-
int i = indexOfPercentChar(bytes, 0);
632+
int i = indexOfFirstPercentChar(bytes);
640633

641634
if (i == -1) {
642635
return source;

0 commit comments

Comments
 (0)