Skip to content

Commit 63320db

Browse files
committed
code cleanup
1 parent 36c5811 commit 63320db

27 files changed

+62
-104
lines changed

src/main/java/org/htmlunit/Cache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ else if (response.getResponseHeaderValue(HttpHeader.LAST_MODIFIED) != null) {
168168
*
169169
* @param request the request corresponding to the specified compiled script
170170
* @param response the response corresponding to the specified compiled script
171-
* @param toCache the object that is to be cached, if possible (may be for instance a compiled script or
171+
* @param toCache the object that is to be cached, if possible (for instance a compiled script or
172172
* simply a WebResponse)
173173
* @return whether the response was cached or not
174174
*/

src/main/java/org/htmlunit/WebClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3080,16 +3080,16 @@ public Set<BroadcastChannel> getBroadcastChannels() {
30803080
* Our pool of CSS3Parsers. If you need a parser, get it from here and use the AutoCloseable
30813081
* functionality with a try-with-resource block. If you don't want to do that at all, continue
30823082
* to build CSS3Parsers the old fashioned way.
3083-
*
3083+
* <p>
30843084
* Fetching a parser is thread safe. This API is built to minimize synchronization overhead,
30853085
* hence it is possible to miss a returned parser from another thread under heavy pressure,
30863086
* but because that is unlikely, we keep it simple and efficient. Caches are not supposed
30873087
* to give cutting-edge guarantees.
3088-
*
3088+
* <p>
30893089
* This concept avoids a resource leak when someone does not close the fetched
30903090
* parser because the pool does not know anything about the parser unless
30913091
* it returns. We are not running a checkout-checkin concept.
3092-
*
3092+
* <p>
30933093
* <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
30943094
*/
30953095
static class CSS3ParserPool {
@@ -3130,7 +3130,7 @@ protected void recycle(final PooledCSS3Parser parser) {
31303130
* This is a poolable CSS3Parser which can be reused automatically when closed.
31313131
* A regular CSS3Parser is not thread-safe, hence also our pooled parser
31323132
* is not thread-safe.
3133-
*
3133+
* <p>
31343134
* <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
31353135
*/
31363136
public static class PooledCSS3Parser extends CSS3Parser implements AutoCloseable {

src/main/java/org/htmlunit/css/AbstractCssStyleDeclaration.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public abstract class AbstractCssStyleDeclaration implements Serializable {
8787

8888
/**
8989
* Get the value for the style attribute.
90-
* This impl ignores the default getDefaultValueIfEmpty flag, but there is a overload
90+
* This impl ignores the default getDefaultValueIfEmpty flag, but there is an overload
9191
* in {@link ComputedCssStyleDeclaration}.
9292
* @param definition the definition
9393
* @param getDefaultValueIfEmpty whether to get the default value if empty or not
@@ -113,7 +113,7 @@ public abstract class AbstractCssStyleDeclaration implements Serializable {
113113
* attributes exists, its value is returned. If neither attribute exists, an empty string
114114
* is returned.</p>
115115
*
116-
* <p>The second named attribute may be shorthand for a the actual desired property.
116+
* <p>The second named attribute may be shorthand for the actual desired property.
117117
* The following formats are possible:</p>
118118
* <ol>
119119
* <li><code>top right bottom left</code>: All values are explicit.</li>
@@ -833,9 +833,9 @@ public String getOpacity() {
833833
return "";
834834
}
835835

836-
final String trimedOpacity = opacity.trim();
836+
final String trimmedOpacity = opacity.trim();
837837
try {
838-
final double value = Double.parseDouble(trimedOpacity);
838+
final double value = Double.parseDouble(trimmedOpacity);
839839
if (value % 1 == 0) {
840840
return Integer.toString((int) value);
841841
}

src/main/java/org/htmlunit/css/ComputedCssStyleDeclaration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2467,7 +2467,7 @@ private String defaultIfEmpty(final String str, final String toReturnIfEmptyOrDe
24672467
/**
24682468
* Returns the specified length value as a pixel length value.
24692469
* This method does <b>NOT</b> handle percentages correctly;
2470-
* use {@link CssPixelValueConverter#pixelValue(DomElement, CssValue)} if you need percentage support).
2470+
* use {@link CssPixelValueConverter#pixelValue(DomElement, CssValue)} if you need percentage support.
24712471
* @param value the length value to convert to a pixel length value
24722472
* @return the specified length value as a pixel length value
24732473
* @see CssPixelValueConverter#pixelString(DomElement, CssValue)

src/main/java/org/htmlunit/css/CssPixelValueConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static int pixelValue(final DomElement element, final CssValue value) {
5757
}
5858

5959
/**
60-
* Returns the specified length CSS attribute value value as a pixel length value.
60+
* Returns the specified length CSS attribute value as a pixel length value.
6161
* If the specified CSS attribute value is a percentage, this method
6262
* uses the specified value object to recursively retrieve the base (parent) CSS attribute value.
6363
* @param element the element for which the CSS attribute value is to be retrieved
@@ -78,7 +78,7 @@ public static String pixelString(final DomElement element, final CssValue value)
7878
/**
7979
* Converts the specified length string value into an integer number of pixels. This method does
8080
* <b>NOT</b> handle percentages correctly; use {@link #pixelString(DomElement, CssValue)} if you
81-
* need percentage support).
81+
* need percentage support.
8282
* @param value the length string value to convert to an integer number of pixels
8383
* @return the integer number of pixels corresponding to the specified length string value
8484
* @see <a href="http://htmlhelp.com/reference/css/units.html">CSS Units</a>

src/main/java/org/htmlunit/css/CssStyleSheet.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ public void setEnabled(final boolean enabled) {
286286
/**
287287
* Loads the stylesheet at the specified link or href.
288288
* @param element the parent DOM element
289-
* @param link the stylesheet's link (may be {@code null} if a <code>url</code> is specified)
290-
* @param url the stylesheet's url (may be {@code null} if a <code>link</code> is specified)
289+
* @param link the stylesheet's link (maybe {@code null} if a <code>url</code> is specified)
290+
* @param url the stylesheet's url (maybe {@code null} if a <code>link</code> is specified)
291291
* @return the loaded stylesheet
292292
*/
293293
public static CssStyleSheet loadStylesheet(final HtmlElement element, final HtmlLink link, final String url) {
@@ -1553,7 +1553,7 @@ private static double resolutionValue(final CSSValueImpl cssValue) {
15531553
* @param style the style to modify
15541554
* @param element the element to which style rules must apply in order for them to be added to
15551555
* the specified style
1556-
* @param pseudoElement a string specifying the pseudo-element to match (may be {@code null})
1556+
* @param pseudoElement a string specifying the pseudo-element to match (maybe {@code null})
15571557
*/
15581558
public void modifyIfNecessary(final ComputedCssStyleDeclaration style, final DomElement element,
15591559
final String pseudoElement) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected DomNode getDomNode() {
7777
* @return the nodes in this node list
7878
*/
7979
private List<E> getNodes() {
80-
// a bit of a hack but i like to avoid synchronization
80+
// a bit of a hack but I like to avoid synchronization
8181
// see https://github.com/HtmlUnit/htmlunit/issues/882
8282
//
8383
// there is a small chance that the cachedElements_ are

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class DomAttr extends DomNamespaceNode implements Attr {
3535
* Instantiate a new attribute.
3636
*
3737
* @param page the page that the attribute belongs to
38-
* @param namespaceURI the namespace that defines the attribute name (may be {@code null})
38+
* @param namespaceURI the namespace that defines the attribute name (maybe {@code null})
3939
* @param qualifiedName the name of the attribute
4040
* @param value the value of the attribute
4141
* @param specified {@code true} if this attribute was explicitly given a value in the source document,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ String getQualifiedName(final String namespaceURI, final String localName) {
425425
* Returns the value of the attribute specified by name or an empty string. If the
426426
* result is an empty string then it will be either {@link #ATTRIBUTE_NOT_DEFINED}
427427
* if the attribute wasn't specified or {@link #ATTRIBUTE_VALUE_EMPTY} if the
428-
* attribute was specified but it was empty.
428+
* attribute was specified, but it was empty.
429429
*
430430
* @param attributeName the name of the attribute
431431
* @return the value of the attribute or {@link #ATTRIBUTE_NOT_DEFINED} or {@link #ATTRIBUTE_VALUE_EMPTY}
@@ -577,7 +577,7 @@ protected boolean isAttributeCaseSensitive() {
577577
* Returns the value of the attribute specified by namespace and local name or an empty
578578
* string. If the result is an empty string then it will be either {@link #ATTRIBUTE_NOT_DEFINED}
579579
* if the attribute wasn't specified or {@link #ATTRIBUTE_VALUE_EMPTY} if the
580-
* attribute was specified but it was empty.
580+
* attribute was specified, but it was empty.
581581
*
582582
* @param namespaceURI the URI that identifies an XML namespace
583583
* @param localName the name within the namespace

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ public int getColumnSpan() {
5858
if (span < 1) {
5959
return 1;
6060
}
61-
if (span > 1_000) {
62-
return 1_000;
63-
}
64-
return span;
61+
return Math.min(span, 1_000);
6562
}
6663
catch (final NumberFormatException e) {
6764
return 1;
@@ -85,10 +82,7 @@ public int getRowSpan() {
8582
return 0;
8683
}
8784

88-
if (span > 65_534) {
89-
return 65_534;
90-
}
91-
return span;
85+
return Math.min(span, 65_534);
9286
}
9387
catch (final NumberFormatException e) {
9488
return 1;

0 commit comments

Comments
 (0)