Skip to content

Commit

Permalink
checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jan 3, 2025
1 parent 9a40459 commit 97938e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.nio.charset.UnsupportedCharsetException;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.htmlunit.util.MimeType;
import org.htmlunit.util.UrlUtils;

Expand Down
16 changes: 10 additions & 6 deletions src/main/java/org/htmlunit/util/UrlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ public static byte[] decodeDataUrl(final byte[] bytes) throws IllegalArgumentExc
return buffer.toByteArray();
}

public static final byte[] decodeUrl(final byte[] bytes) throws IllegalArgumentException {
public static byte[] decodeUrl(final byte[] bytes) throws IllegalArgumentException {
if (bytes == null) {
return null;
}
Expand All @@ -1413,15 +1413,18 @@ public static final byte[] decodeUrl(final byte[] bytes) throws IllegalArgumentE
final int b = bytes[i];
if (b == '+') {
buffer.write(' ');
} else if (b == '%') {
}
else if (b == '%') {
try {
final int u = digit16(bytes[++i]);
final int l = digit16(bytes[++i]);
buffer.write((char) ((u << 4) + l));
} catch (final ArrayIndexOutOfBoundsException e) {
}
catch (final ArrayIndexOutOfBoundsException e) {
throw new IllegalArgumentException("Invalid URL encoding: ", e);
}
} else {
}
else {
buffer.write(b);
}
}
Expand All @@ -1437,7 +1440,7 @@ private static int digit16(final byte b) throws IllegalArgumentException {
}

// adapted from apache commons codec
public static final byte[] encodeUrl(BitSet urlsafe, final byte[] bytes) {
public static byte[] encodeUrl(final BitSet urlsafe, final byte[] bytes) {
if (bytes == null) {
return null;
}
Expand All @@ -1453,7 +1456,8 @@ public static final byte[] encodeUrl(BitSet urlsafe, final byte[] bytes) {
b = '+';
}
buffer.write(b);
} else {
}
else {
buffer.write('%');
final char hex1 = hexDigit(b >> 4);
final char hex2 = hexDigit(b);
Expand Down

0 comments on commit 97938e3

Please sign in to comment.