Skip to content

Commit 2bcecb6

Browse files
committed
cleanup
1 parent cf04836 commit 2bcecb6

19 files changed

Lines changed: 118 additions & 113 deletions

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

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -844,29 +844,31 @@ else if (featureId.equals(ALLOW_SELFCLOSING_TAGS)) {
844844
/** Sets a property. */
845845
@Override
846846
public void setProperty(final String propertyId, final Object value) throws XMLConfigurationException {
847-
if (propertyId.equals(NAMES_ELEMS)) {
848-
fNamesElems = getNamesValue(String.valueOf(value));
849-
}
850-
else if (propertyId.equals(NAMES_ATTRS)) {
851-
fNamesAttrs = getNamesValue(String.valueOf(value));
852-
}
853-
else if (propertyId.equals(DEFAULT_ENCODING)) {
854-
fDefaultIANAEncoding = String.valueOf(value);
855-
}
856-
else if (propertyId.equals(ERROR_REPORTER)) {
857-
fErrorReporter = (HTMLErrorReporter) value;
858-
}
859-
else if (propertyId.equals(ENCODING_TRANSLATOR)) {
860-
fEncodingTranslator = (EncodingTranslator) value;
861-
}
862-
else if (propertyId.equals(DOCTYPE_PUBID)) {
863-
fDoctypePubid = String.valueOf(value);
864-
}
865-
else if (propertyId.equals(DOCTYPE_SYSID)) {
866-
fDoctypeSysid = String.valueOf(value);
867-
}
868-
else if (propertyId.equals(READER_BUFFER_SIZE)) {
869-
fReaderBufferSize = Integer.parseInt(String.valueOf(value));
847+
switch (propertyId) {
848+
case NAMES_ELEMS:
849+
fNamesElems = getNamesValue(String.valueOf(value));
850+
break;
851+
case NAMES_ATTRS:
852+
fNamesAttrs = getNamesValue(String.valueOf(value));
853+
break;
854+
case DEFAULT_ENCODING:
855+
fDefaultIANAEncoding = String.valueOf(value);
856+
break;
857+
case ERROR_REPORTER:
858+
fErrorReporter = (HTMLErrorReporter) value;
859+
break;
860+
case ENCODING_TRANSLATOR:
861+
fEncodingTranslator = (EncodingTranslator) value;
862+
break;
863+
case DOCTYPE_PUBID:
864+
fDoctypePubid = String.valueOf(value);
865+
break;
866+
case DOCTYPE_SYSID:
867+
fDoctypeSysid = String.valueOf(value);
868+
break;
869+
case READER_BUFFER_SIZE:
870+
fReaderBufferSize = Integer.parseInt(String.valueOf(value));
871+
break;
870872
}
871873
}
872874

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -386,17 +386,16 @@ else if ("svg".equalsIgnoreCase(qname.getLocalpart())) {
386386
public void setFeature(final String featureId, final boolean state)
387387
throws XMLConfigurationException {
388388

389-
if (featureId.equals(AUGMENTATIONS)) {
390-
fAugmentations = state;
391-
return;
392-
}
393-
if (featureId.equals(REPORT_ERRORS)) {
394-
fReportErrors = state;
395-
return;
396-
}
397-
if (featureId.equals(IGNORE_OUTSIDE_CONTENT)) {
398-
fIgnoreOutsideContent = state;
399-
return;
389+
switch (featureId) {
390+
case AUGMENTATIONS:
391+
fAugmentations = state;
392+
return;
393+
case REPORT_ERRORS:
394+
fReportErrors = state;
395+
return;
396+
case IGNORE_OUTSIDE_CONTENT:
397+
fIgnoreOutsideContent = state;
398+
return;
400399
}
401400
}
402401

src/main/java/org/htmlunit/cyberneko/util/FastHashMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* Simple hash map implementation taken from here
2828
* https://github.com/mikvor/hashmapTest/blob/master/src/main/java/map/objobj/ObjObjMap.java
2929
* No concrete license specified at the source. The project is public domain.
30-
*
30+
* <p>
3131
* Not thread-safe! Null support was removed.
3232
*
3333
* @param <K> the type of the key
@@ -340,7 +340,7 @@ private void readObject(final ObjectInputStream aInputStream) throws ClassNotFou
340340
clear();
341341

342342
// sort things in, so we get a nice clean new map, this will
343-
// also cleanup what was previously a removed entry, we have not
343+
// also clean up what was previously a removed entry, we have not
344344
// kept that information anyway
345345
for (int i = 0; i < srcData.length; i += 2) {
346346
final Object key = srcData[i];

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public void setValue(final String newvalue) {
302302

303303
// Create and add the new one, generating only non-aggregate events
304304
// (There are no listeners on the new Text, but there may be
305-
// capture/bubble listeners on the Attr.
305+
// capture/bubble listeners on the Attr).
306306
// Note that aggregate events are NOT dispatched here,
307307
// since we need to combine the remove and insert.
308308
isSpecified(true);
@@ -513,7 +513,7 @@ Node internalInsertBefore(final Node newChild, Node refChild, final boolean repl
513513
// have been transferred. (Alternative behaviors would be to
514514
// reparent up to the first failure point or reparent all those
515515
// which are acceptable to the target node, neither of which is
516-
// as robust. PR-DOM-0818 isn't entirely clear on which it
516+
// as robust.) PR-DOM-0818 isn't entirely clear on which it
517517
// recommends?????
518518

519519
// No need to check kids for right-document; if they weren't,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private void setName(final String namespaceURI, final String qname) {
5959
// 1. if the qualified name is 'null' it is malformed.
6060
// 2. or if the qualifiedName is null and the namespaceURI is different from
6161
// null,
62-
// We dont need to check for namespaceURI != null, if qualified name is null
62+
// We don't need to check for namespaceURI != null, if qualified name is null
6363
// throw DOMException.
6464
if (qname == null) {
6565
final String msg = DOMMessageFormatter.formatMessage("NAMESPACE_ERR", null);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public void setXmlEncoding(final String value) {
195195
*
196196
* An attribute specifying the encoding used for this entity at the tiome of
197197
* parsing, when it is an external parsed entity. This is <code>null</code> if
198-
* it an entity from the internal subset or if it is not known..
198+
* it is an entity from the internal subset or if it is not known.
199199
*/
200200
@Override
201201
public String getInputEncoding() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* synchronized with its parent. This leads me back to the "cached image of
4848
* centrally defined data" solution, much as I dislike it.
4949
* <P>
50-
* For now I have decided, since REC-DOM-Level-1-19980818 doesn't cover this in
50+
* For now, I have decided, since REC-DOM-Level-1-19980818 doesn't cover this in
5151
* much detail, that synchronization doesn't have to be considered while the
5252
* user is deep in the tree. That is, if you're looking within one of the
5353
* EntityReferennce's children and the Entity changes, you won't be informed;

src/main/java/org/htmlunit/cyberneko/xerces/parsers/AbstractDOMParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public void processingInstruction(final String target, final XMLString data,
263263
* @param namespaceContext The namespace context in effect at the start of this
264264
* document. This object represents the current context.
265265
* Implementors of this class are responsible for
266-
* copying the namespace bindings from the the current
266+
* copying the namespace bindings from the current
267267
* context (and its parent contexts) if that information
268268
* is important.
269269
* @param augs Additional information that may include infoset

src/main/java/org/htmlunit/cyberneko/xerces/parsers/AbstractSAXParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected AbstractSAXParser(final XMLParserConfiguration config) {
125125
* @param namespaceContext The namespace context in effect at the start of this
126126
* document. This object represents the current context.
127127
* Implementors of this class are responsible for
128-
* copying the namespace bindings from the the current
128+
* copying the namespace bindings from the current
129129
* context (and its parent contexts) if that information
130130
* is important.
131131
* @param augs Additional information that may include infoset

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public ErrorHandler getErrorHandler() {
5656
*
5757
* @param domain The domain of the warning. The domain can be any string but
5858
* is suggested to be a valid URI. The domain can be used to
59-
* conveniently specify a web site location of the relevent
59+
* conveniently specify a website location of the relevant
6060
* specification or document pertaining to this warning.
6161
* @param key The warning key. This key can be any string and is
6262
* implementation dependent.
@@ -90,7 +90,7 @@ public void warning(final String domain, final String key, final XMLParseExcepti
9090
*
9191
* @param domain The domain of the error. The domain can be any string but is
9292
* suggested to be a valid URI. The domain can be used to
93-
* conveniently specify a web site location of the relevent
93+
* conveniently specify a website location of the relevant
9494
* specification or document pertaining to this error.
9595
* @param key The error key. This key can be any string and is
9696
* implementation dependent.
@@ -130,7 +130,7 @@ public void error(final String domain, final String key, final XMLParseException
130130
*
131131
* @param domain The domain of the fatal error. The domain can be any string
132132
* but is suggested to be a valid URI. The domain can be used
133-
* to conveniently specify a web site location of the relevent
133+
* to conveniently specify a website location of the relevant
134134
* specification or document pertaining to this fatal error.
135135
* @param key The fatal error key. This key can be any string and is
136136
* implementation dependent.

0 commit comments

Comments
 (0)