Skip to content

Commit ddb4418

Browse files
committed
cleanup
1 parent 7016bf4 commit ddb4418

File tree

9 files changed

+24
-64
lines changed

9 files changed

+24
-64
lines changed

src/main/java/org/htmlunit/cyberneko/html/dom/HTMLDocumentImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class HTMLDocumentImpl extends DocumentImpl implements HTMLDocument {
6262

6363
/**
6464
* All valid HTML5 tags without deprecated elements
65-
* https://www.tutorialrepublic.com/html-reference/html5-tags.php
65+
* <a href="https://www.tutorialrepublic.com/html-reference/html5-tags.php">...</a>
6666
*/
6767
private static final String[] HTML5ELEMENTS = {
6868
"A", "ABBR", "ADDRESS", "AREA", "ARTICLE", "ASIDE", "AUDIO",

src/main/java/org/htmlunit/cyberneko/xerces/dom/AttrImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ public boolean isEqualNode(final Node arg) {
833833
* Introduced in DOM Level 3.
834834
* <p>
835835
* Checks if a type is derived from another by restriction. See:
836-
* http://www.w3.org/TR/DOM-Level-3-Core/core.html#TypeInfo-isDerivedFrom
836+
* <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#TypeInfo-isDerivedFrom">...</a>
837837
*
838838
* @param typeNamespaceArg The namspace of the ancestor type declaration
839839
* @param typeNameArg The name of the ancestor type declaration

src/main/java/org/htmlunit/cyberneko/xerces/dom/AttrNSImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public String getLocalName() {
219219
* Introduced in DOM Level 3.
220220
* <p>
221221
* Checks if a type is derived from another by restriction. See:
222-
* http://www.w3.org/TR/DOM-Level-3-Core/core.html#TypeInfo-isDerivedFrom
222+
* <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#TypeInfo-isDerivedFrom">...</a>
223223
*
224224
* @param typeNamespaceArg The namspace of the ancestor type declaration
225225
* @param typeNameArg The name of the ancestor type declaration

src/main/java/org/htmlunit/cyberneko/xerces/util/URI.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -697,12 +697,9 @@ else if (!path_.isEmpty()) {
697697
// 6e - remove all "<segment>/../" where "<segment>" is a complete
698698
// path segment not equal to ".."
699699
index = 1;
700-
int segIndex = -1;
701-
String tempString = null;
702-
703700
while ((index = path.indexOf("/../", index)) > 0) {
704-
tempString = path.substring(0, path.indexOf("/../"));
705-
segIndex = tempString.lastIndexOf('/');
701+
String tempString = path.substring(0, path.indexOf("/../"));
702+
int segIndex = tempString.lastIndexOf('/');
706703
if (segIndex != -1) {
707704
if (!"..".equals(tempString.substring(segIndex))) {
708705
path = path.substring(0, segIndex + 1).concat(path.substring(index + 4));
@@ -720,8 +717,8 @@ else if (!path_.isEmpty()) {
720717
// 6f - remove ending "<segment>/.." where "<segment>" is a
721718
// complete path segment
722719
if (path.endsWith("/..")) {
723-
tempString = path.substring(0, path.length() - 3);
724-
segIndex = tempString.lastIndexOf('/');
720+
String tempString = path.substring(0, path.length() - 3);
721+
int segIndex = tempString.lastIndexOf('/');
725722
if (segIndex != -1) {
726723
path = path.substring(0, segIndex + 1);
727724
}

src/test/java/org/htmlunit/cyberneko/CanonicalCustomSAXParserTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import java.io.BufferedReader;
2222
import java.io.File;
23-
import java.io.FileNotFoundException;
2423
import java.io.FileReader;
2524
import java.io.IOException;
2625
import java.io.PrintWriter;

src/test/java/org/htmlunit/cyberneko/CanonicalDomTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import java.io.BufferedReader;
2222
import java.io.File;
23-
import java.io.FileNotFoundException;
2423
import java.io.FileReader;
2524
import java.io.IOException;
2625
import java.io.PrintWriter;

src/test/java/org/htmlunit/cyberneko/CanonicalSAXTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import java.io.BufferedReader;
2222
import java.io.File;
23-
import java.io.FileNotFoundException;
2423
import java.io.FileReader;
2524
import java.io.IOException;
2625
import java.io.PrintWriter;

src/test/java/org/htmlunit/cyberneko/util/FastHashMapTest.java

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -207,34 +207,22 @@ public void clear() {
207207
@Test
208208
public void collision() {
209209
final FastHashMap<MockKey<String>, String> f = new FastHashMap<>(13, 0.5f);
210-
IntStream.range(0, 15).forEach(i -> {
211-
f.put(new MockKey<>(12, "k" + i), "v" + i);
212-
});
210+
IntStream.range(0, 15).forEach(i -> f.put(new MockKey<>(12, "k" + i), "v" + i));
213211

214212
assertEquals(15, f.size());
215213

216-
IntStream.range(0, 15).forEach(i -> {
217-
assertEquals("v" + i, f.get(new MockKey<>(12, "k" + i)));
218-
});
214+
IntStream.range(0, 15).forEach(i -> assertEquals("v" + i, f.get(new MockKey<>(12, "k" + i))));
219215

220216
// round 2
221-
IntStream.range(0, 20).forEach(i -> {
222-
f.put(new MockKey<>(12, "k" + i), "v" + i);
223-
});
217+
IntStream.range(0, 20).forEach(i -> f.put(new MockKey<>(12, "k" + i), "v" + i));
224218

225219
assertEquals(20, f.size());
226220

227-
IntStream.range(0, 20).forEach(i -> {
228-
assertEquals("v" + i, f.get(new MockKey<>(12, "k" + i)));
229-
});
221+
IntStream.range(0, 20).forEach(i -> assertEquals("v" + i, f.get(new MockKey<>(12, "k" + i))));
230222

231223
// round 3
232-
IntStream.range(0, 10).forEach(i -> {
233-
assertEquals("v" + i, f.remove(new MockKey<>(12, "k" + i)));
234-
});
235-
IntStream.range(10, 20).forEach(i -> {
236-
assertEquals("v" + i, f.get(new MockKey<>(12, "k" + i)));
237-
});
224+
IntStream.range(0, 10).forEach(i -> assertEquals("v" + i, f.remove(new MockKey<>(12, "k" + i))));
225+
IntStream.range(10, 20).forEach(i -> assertEquals("v" + i, f.get(new MockKey<>(12, "k" + i))));
238226
}
239227

240228
/**

src/test/java/org/htmlunit/cyberneko/xerces/xni/XMLStringTest.java

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -519,25 +519,15 @@ public void charAt() {
519519
public void charAt_Errors() {
520520
// empty
521521
final XMLString a1 = new XMLString();
522-
assertThrows(IndexOutOfBoundsException.class, () -> {
523-
a1.charAt(0);
524-
});
522+
assertThrows(IndexOutOfBoundsException.class, () -> a1.charAt(0));
525523

526524
final XMLString a2 = new XMLString("");
527-
assertThrows(IndexOutOfBoundsException.class, () -> {
528-
a2.charAt(0);
529-
});
525+
assertThrows(IndexOutOfBoundsException.class, () -> a2.charAt(0));
530526

531527
final XMLString b = new XMLString("foo");
532-
assertThrows(IndexOutOfBoundsException.class, () -> {
533-
b.charAt(-1);
534-
});
535-
assertThrows(IndexOutOfBoundsException.class, () -> {
536-
b.charAt(3);
537-
});
538-
assertThrows(IndexOutOfBoundsException.class, () -> {
539-
b.charAt(4);
540-
});
528+
assertThrows(IndexOutOfBoundsException.class, () -> b.charAt(-1));
529+
assertThrows(IndexOutOfBoundsException.class, () -> b.charAt(3));
530+
assertThrows(IndexOutOfBoundsException.class, () -> b.charAt(4));
541531
}
542532

543533
@Test
@@ -562,9 +552,7 @@ public void unsafeCharAt_Errors() {
562552
a1.unsafeCharAt(0);
563553

564554
// cannot read outside the array of course
565-
assertThrows(IndexOutOfBoundsException.class, () -> {
566-
a1.unsafeCharAt(XMLString.INITIAL_CAPACITY);
567-
});
555+
assertThrows(IndexOutOfBoundsException.class, () -> a1.unsafeCharAt(XMLString.INITIAL_CAPACITY));
568556
}
569557

570558
@Test
@@ -1057,24 +1045,14 @@ public void subSequence() {
10571045
public void subSequenceErrors() {
10581046
{
10591047
final CharSequence o = new XMLString("");
1060-
assertThrows(IndexOutOfBoundsException.class, () -> {
1061-
o.subSequence(-1, 2);
1062-
});
1063-
assertThrows(IndexOutOfBoundsException.class, () -> {
1064-
o.subSequence(0, 1);
1065-
});
1048+
assertThrows(IndexOutOfBoundsException.class, () -> o.subSequence(-1, 2));
1049+
assertThrows(IndexOutOfBoundsException.class, () -> o.subSequence(0, 1));
10661050
}
10671051
{
10681052
final CharSequence o = new XMLString("12345");
1069-
assertThrows(IndexOutOfBoundsException.class, () -> {
1070-
o.subSequence(-2, 3);
1071-
});
1072-
assertThrows(IndexOutOfBoundsException.class, () -> {
1073-
o.subSequence(0, 6);
1074-
});
1075-
assertThrows(IndexOutOfBoundsException.class, () -> {
1076-
o.subSequence(1, 0);
1077-
});
1053+
assertThrows(IndexOutOfBoundsException.class, () -> o.subSequence(-2, 3));
1054+
assertThrows(IndexOutOfBoundsException.class, () -> o.subSequence(0, 6));
1055+
assertThrows(IndexOutOfBoundsException.class, () -> o.subSequence(1, 0));
10781056
}
10791057
}
10801058

0 commit comments

Comments
 (0)