Skip to content

Commit c7247a0

Browse files
committed
cleanup
1 parent 13dd3c9 commit c7247a0

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

src/main/java/org/htmlunit/cyberneko/HTMLScanner.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public class HTMLScanner implements XMLDocumentSource, XMLLocator, HTMLComponent
166166

167167
/**
168168
* Ignore specified charset found in the <meta equiv='Content-Type'
169-
* content='text/html;charset=…'> tag or in the <?xml …
169+
* content='text/html;charset='…'> tag or in the <?xml …
170170
* encoding='…'> processing instruction.
171171
*/
172172
public static final String IGNORE_SPECIFIED_CHARSET
@@ -335,9 +335,6 @@ public class HTMLScanner implements XMLDocumentSource, XMLLocator, HTMLComponent
335335
/** Scan return code: continue scanning (state transition). */
336336
private static final int SCAN_FALSE = 2;
337337

338-
/** Scan return code: scanner changed, return control to caller. */
339-
private static final int SCAN_SCANNER_CHANGED = 3;
340-
341338
// debugging
342339

343340
/** Set to true to debug changes in the scanner. */
@@ -1544,11 +1541,11 @@ protected int scanEntityRef(final XMLString str, final XMLString plainValue, fin
15441541
// the error route
15451542
if (result.isMatch_) {
15461543
// in case we overrun because the entity was broken or
1547-
// not terminated by a ;, we have to reset the char
1544+
// not terminated by a ';', we have to reset the char
15481545
// position because we read one more char than the entity has
15491546
fCurrentEntity.rewind(readCount - result.length_);
15501547

1551-
// if we have a correct character that is terminate by ;
1548+
// if we have a correct character that is terminated by ';'
15521549
// we can keep things simple
15531550
if (result.endsWithSemicolon_) {
15541551
if (plainValue != null) {
@@ -2598,7 +2595,7 @@ protected int scanComment() throws IOException {
25982595
// Scans markup content.
25992596
protected int scanCommentContent(final XMLString buffer) throws IOException {
26002597
int c;
2601-
OUTER: while (true) {
2598+
while (true) {
26022599
c = fCurrentEntity.read();
26032600
if (c == -1) {
26042601
if (fReportErrors_) {
@@ -2621,7 +2618,7 @@ protected int scanCommentContent(final XMLString buffer) throws IOException {
26212618
if (fReportErrors_) {
26222619
fErrorReporter.reportError("HTML1007", null);
26232620
}
2624-
break OUTER;
2621+
break;
26252622
}
26262623
if (count < 2) {
26272624
buffer.append('-');
@@ -2687,7 +2684,7 @@ else if (c == '\n' || c == '\r') {
26872684
// Scans cdata content.
26882685
protected int scanCDataContent(final XMLString xmlString) throws IOException {
26892686
int c;
2690-
OUTER: while (true) {
2687+
while (true) {
26912688
c = fCurrentEntity.read();
26922689
if (c == -1) {
26932690
if (fReportErrors_) {
@@ -2710,7 +2707,7 @@ protected int scanCDataContent(final XMLString xmlString) throws IOException {
27102707
if (fReportErrors_) {
27112708
fErrorReporter.reportError("HTML1007", null);
27122709
}
2713-
break OUTER;
2710+
break;
27142711
}
27152712
if (count < 2) {
27162713
xmlString.append(']');
@@ -3739,7 +3736,6 @@ else if (c == '<') {
37393736
closeIndex++;
37403737
}
37413738
else if (c == '<') {
3742-
state = ScanScriptState.DOUBLE_ESCAPED_LT;
37433739
closeIndex = 0;
37443740
}
37453741
else {
@@ -3756,7 +3752,6 @@ else if (Character.isWhitespace(c)) {
37563752
// ^^^^^
37573753
}
37583754
else if (c == '<') {
3759-
state = ScanScriptState.DOUBLE_ESCAPED_LT;
37603755
closeIndex = 0;
37613756
}
37623757
else {

src/main/java/org/htmlunit/cyberneko/HTMLTagBalancer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,9 +1341,9 @@ protected final int getElementDepth(final HTMLElements.Element element) {
13411341
int depth = -1;
13421342
for (int i = fElementStack.top - 1; i >= fragmentContextStackSize_; i--) {
13431343
final Info info = fElementStack.data[i];
1344-
if (info.element.code == element.code
1344+
if (info.element.code == elementCode
13451345
&& (elementCode != HTMLElements.UNKNOWN
1346-
|| (elementCode == HTMLElements.UNKNOWN && element.name.equals(info.element.name)))) {
1346+
|| element.name.equals(info.element.name))) {
13471347
depth = fElementStack.top - i;
13481348
break;
13491349
}
@@ -1375,6 +1375,7 @@ protected int getParentDepth(final Element element) {
13751375
if (info.element.code == bounds) {
13761376
break;
13771377
}
1378+
13781379
// use indexed loop to avoid Iterator allocation
13791380
for (int j = 0; j < parents.length; j++) {
13801381
final Element parent = parents[j];

0 commit comments

Comments
 (0)