Skip to content

Commit 988eb29

Browse files
committed
cleanup
1 parent 1c9de6a commit 988eb29

7 files changed

Lines changed: 15 additions & 42 deletions

File tree

src/main/java/org/htmlunit/HttpWebConnection.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,11 @@ private HttpUriRequest makeHttpMethod(final WebRequest webRequest, final HttpCli
299299
// this has to be in sync with org.htmlunit.WebRequest.getRequestParameters()
300300

301301
// POST, PUT, PATCH, DELETE, OPTIONS
302-
if ((httpMethod instanceof HttpEntityEnclosingRequest)
303-
&& (httpMethod instanceof HttpPost
304-
|| httpMethod instanceof HttpPut
305-
|| httpMethod instanceof HttpPatch
306-
|| httpMethod instanceof org.htmlunit.httpclient.HttpDelete
307-
|| httpMethod instanceof org.htmlunit.httpclient.HttpOptions)) {
302+
if (httpMethod instanceof HttpPost
303+
|| httpMethod instanceof HttpPut
304+
|| httpMethod instanceof HttpPatch
305+
|| httpMethod instanceof org.htmlunit.httpclient.HttpDelete
306+
|| httpMethod instanceof org.htmlunit.httpclient.HttpOptions) {
308307

309308
final HttpEntityEnclosingRequest method = (HttpEntityEnclosingRequest) httpMethod;
310309

src/main/java/org/htmlunit/attachment/AttachmentHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ default boolean isAttachment(final WebResponse response) {
8888
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#applicationoctet-stream
8989
// They treat it as if the Content-Disposition header was set to attachment, and propose a "Save As" dialog.
9090
final String contentType = response.getResponseHeaderValue(HttpHeader.CONTENT_TYPE);
91-
return contentType != null
92-
&& MimeType.APPLICATION_OCTET_STREAM.equalsIgnoreCase(contentType);
91+
return MimeType.APPLICATION_OCTET_STREAM.equalsIgnoreCase(contentType);
9392
}
9493
return StringUtils.startsWithIgnoreCase(disp, "attachment");
9594
}

src/main/java/org/htmlunit/html/DomElement.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.io.StringWriter;
2525
import java.util.ArrayList;
2626
import java.util.Collection;
27-
import java.util.Collections;
2827
import java.util.Comparator;
2928
import java.util.Iterator;
3029
import java.util.LinkedHashMap;
@@ -111,12 +110,8 @@ public class DomElement extends DomNamespaceNode implements Element {
111110
private String styleString_;
112111
private LinkedHashMap<String, StyleElement> styleMap_;
113112

114-
private static final Comparator<StyleElement> STYLE_ELEMENT_COMPARATOR = new Comparator<StyleElement>() {
115-
@Override
116-
public int compare(final StyleElement first, final StyleElement second) {
117-
return StyleElement.compareToByImportanceAndSpecificity(first, second);
118-
}
119-
};
113+
private static final Comparator<StyleElement> STYLE_ELEMENT_COMPARATOR =
114+
(first, second) -> StyleElement.compareToByImportanceAndSpecificity(first, second);
120115

121116
/**
122117
* Whether the Mouse is currently over this element or not.
@@ -625,7 +620,7 @@ public void writeStyleToElement(final Map<String, StyleElement> styleMap) {
625620

626621
final StringBuilder builder = new StringBuilder();
627622
final List<StyleElement> styleElements = new ArrayList<>(styleMap.values());
628-
Collections.sort(styleElements, STYLE_ELEMENT_COMPARATOR);
623+
styleElements.sort(STYLE_ELEMENT_COMPARATOR);
629624
for (final StyleElement e : styleElements) {
630625
if (builder.length() != 0) {
631626
builder.append(' ');

src/main/java/org/htmlunit/html/HtmlPage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ public void deregisterFramesIfNeeded() {
15281528
*/
15291529
public List<FrameWindow> getFrames() {
15301530
final List<BaseFrameElement> frameElements = new ArrayList<>(frameElements_);
1531-
Collections.sort(frameElements, DOCUMENT_POSITION_COMPERATOR);
1531+
frameElements.sort(DOCUMENT_POSITION_COMPERATOR);
15321532

15331533
final List<FrameWindow> list = new ArrayList<>(frameElements.size());
15341534
for (final BaseFrameElement frameElement : frameElements) {
@@ -2934,7 +2934,7 @@ DomElement first() {
29342934
return elements_.get(0);
29352935
}
29362936

2937-
Collections.sort(elements_, DOCUMENT_POSITION_COMPERATOR);
2937+
elements_.sort(DOCUMENT_POSITION_COMPERATOR);
29382938
sorted_ = true;
29392939

29402940
return elements_.get(0);
@@ -2945,7 +2945,7 @@ List<DomElement> elements() {
29452945
return elements_;
29462946
}
29472947

2948-
Collections.sort(elements_, DOCUMENT_POSITION_COMPERATOR);
2948+
elements_.sort(DOCUMENT_POSITION_COMPERATOR);
29492949
sorted_ = true;
29502950

29512951
return elements_;

src/main/java/org/htmlunit/html/impl/SelectableTextInput.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public interface SelectableTextInput {
4444
void select();
4545

4646
/**
47-
* Returns all of the text in this element.
48-
* @return all of the text in this element
47+
* @return all the text in this element
4948
*/
5049
String getText();
5150

src/main/java/org/htmlunit/javascript/host/event/Event.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,9 @@ public class Event extends HtmlUnitScriptable {
186186
/** The auxclick event type, triggered by {@code auxclick} event handlers. */
187187
public static final String TYPE_AUXCLICK = "auxclick";
188188

189-
// /** The mspointerleave event type, triggered by {@code mspointerleave} event handlers. */
190-
// public static final String TYPE_MSPOINTERLEAVE = "mspointerleave";
191-
//
192189
/** The webkitanimationstart event type, triggered by {@code webkitanimationstart} event handlers. */
193190
public static final String TYPE_WEBANIMATIONSTART = "webkitanimationstart";
194191

195-
// /** The msgesturestart event type, triggered by {@code msgesturestart} event handlers. */
196-
// public static final String TYPE_MSGESTURESTART = "msgesturestart";
197-
198192
/** The drag event type, triggered by {@code drag} event handlers. */
199193
public static final String TYPE_DRAG = "drag";
200194

@@ -255,9 +249,6 @@ public class Event extends HtmlUnitScriptable {
255249
/** The pageshow event type, triggered by {@code pageshow} event handlers. */
256250
public static final String TYPE_PAGESHOW = "pageshow";
257251

258-
// /** The mspointerenter event type, triggered by {@code mspointerenter} event handlers. */
259-
// public static final String TYPE_MSPOINTENTER = "mspointerenter";
260-
261252
/** The mozfullscreenchange event type, triggered by {@code mozfullscreenchange} event handlers. */
262253
public static final String TYPE_MOZFULLSCREENCHANGE = "mozfullscreenchange";
263254

@@ -372,9 +363,6 @@ public class Event extends HtmlUnitScriptable {
372363
/** The transitionend event type, triggered by {@code transitionend} event handlers. */
373364
public static final String TYPE_TRANSITIONEND = "transitionend";
374365

375-
// /** The msgesturehold event type, triggered by {@code msgesturehold} event handlers. */
376-
// public static final String TYPE_MSGESTUREHOLD = "msgesturehold";
377-
378366
/** The deviceorientationabsolute event type, triggered by {@code deviceorientationabsolute} event handlers. */
379367
public static final String TYPE_DEVICEORIENTATIONABSOLUTE = "deviceorientationabsolute";
380368

@@ -441,12 +429,6 @@ public class Event extends HtmlUnitScriptable {
441429
/** The ongamepaddisconnected event type, triggered by {@code ongamepaddisconnected} event handlers. */
442430
public static final String TYPE_GAMEPAD_DISCONNECTED = "ongamepaddisconnected";
443431

444-
/**
445-
* The mssitemodejumplistitemremoved event type, triggered
446-
* by {@code mssitemodejumplistitemremoved} event handlers.
447-
*/
448-
public static final String TYPE_MSSITEMODEJUMPLISTITEMREMOVED = "mssitemodejumplistitemremoved";
449-
450432
/** No event phase. */
451433
@JsxConstant
452434
public static final int NONE = 0;

src/main/java/org/htmlunit/javascript/host/worker/DedicatedWorkerGlobalScope.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,8 @@ void loadAndExecute(final WebClient webClient, final String url,
366366
final AbstractJavaScriptEngine<?> javaScriptEngine = webClient.getJavaScriptEngine();
367367

368368
final DedicatedWorkerGlobalScope thisScope = this;
369-
final ContextAction<Object> action = cx -> {
370-
return javaScriptEngine.execute(page, thisScope, scriptCode, fullUrl.toExternalForm(), 1);
371-
};
369+
final ContextAction<Object> action =
370+
cx -> javaScriptEngine.execute(page, thisScope, scriptCode, fullUrl.toExternalForm(), 1);
372371

373372
final HtmlUnitContextFactory cf = javaScriptEngine.getContextFactory();
374373

0 commit comments

Comments
 (0)