Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Aug 7, 2024
1 parent f04c095 commit d3d4fb6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/htmlunit/WebRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ public List<NameValuePair> getParameters() {

if (FormEncodingType.URL_ENCODED == getEncodingType()) {
if (getRequestBody() == null) {
final List<NameValuePair> allParameters = new ArrayList<>();
allParameters.addAll(HttpUtils.parseUrlQuery(getUrl().getQuery(), getCharset()));
final List<NameValuePair> allParameters =
new ArrayList<>(HttpUtils.parseUrlQuery(getUrl().getQuery(), getCharset()));

// for PATCH/DELETE/OPTIONS request browsers are sending the body
// but the servlet API does not get it
Expand All @@ -388,8 +388,8 @@ public List<NameValuePair> getParameters() {
}

// getRequestParameters and getRequestBody are mutually exclusive
final List<NameValuePair> allParameters = new ArrayList<>();
allParameters.addAll(HttpUtils.parseUrlQuery(getUrl().getQuery(), getCharset()));
final List<NameValuePair> allParameters =
new ArrayList<>(HttpUtils.parseUrlQuery(getUrl().getQuery(), getCharset()));

// for PATCH/DELETE/OPTIONS request browsers are sending the body
// but the servlet API does not get it
Expand All @@ -404,8 +404,8 @@ public List<NameValuePair> getParameters() {

if (FormEncodingType.TEXT_PLAIN == getEncodingType()) {
if (getRequestBody() == null) {
final List<NameValuePair> allParameters = new ArrayList<>();
allParameters.addAll(HttpUtils.parseUrlQuery(getUrl().getQuery(), getCharset()));
final List<NameValuePair> allParameters =
new ArrayList<>(HttpUtils.parseUrlQuery(getUrl().getQuery(), getCharset()));

// the servlet api ignores the parameters
// allParameters.addAll(getRequestParameters());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public DownloadingAttachmentHandler(final Path downloadFolder) throws IOExceptio
downloadFolder_ = downloadFolder;
if (Files.notExists(downloadFolder)) {
throw new IOException("The provided download folder '"
+ downloadFolder.toString() + "' does not exist");
+ downloadFolder + "' does not exist");
}
if (!Files.isWritable(downloadFolder)) {
throw new IOException("Can't write to the download folder '"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/htmlunit/css/CssStyleSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public class CssStyleSheet implements Serializable {
private final Map<CSSImportRuleImpl, CssStyleSheet> imports_ = new HashMap<>();

/** cache parsed media strings */
private static final transient Map<String, MediaListImpl> MEDIA = new HashMap<>();
private static final Map<String, MediaListImpl> MEDIA = new HashMap<>();

/** This stylesheet's URI (used to resolved contained @import rules). */
private final String uri_;
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/org/htmlunit/html/HtmlColorInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ private static boolean isValid(final String value) {
Integer.valueOf(value.substring(5, 7), 16));
valid = true;
}
catch (final NumberFormatException ignored) {
// ignore
}
catch (final IllegalArgumentException ignored) {
// ignore
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,11 @@ protected Object getWithPreemption(final String name) {
elements.setElementsSupplier(
(Supplier<List<DomNode>> & Serializable)
() -> {
final List<DomNode> response = new ArrayList<>();
final DomNode domNode = getDomNodeOrNull();
if (domNode == null) {
return new ArrayList<>();
}
response.addAll(((HtmlForm) domNode).getElementsJS());
final List<DomNode> response = new ArrayList<>(((HtmlForm) domNode).getElementsJS());
return response;
});

Expand Down

0 comments on commit d3d4fb6

Please sign in to comment.