Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix grammar issues in the JavaDoc comments #308

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ protected boolean isValidSymbolicDomain(String domain) {
/**
* Returns true if the user component of an email address is valid.
* @param user being validated
* @return true if the user name is valid.
* @return true if the username is valid.
*/
protected boolean isValidUser(final String user) {
return USER_PATTERN.matcher(user).matches();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/commons/validator/Field.java
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ public boolean isDependency(final String validatorName) {

/**
* If there is a value specified for the indexedProperty field then
* {@code true} will be returned. Otherwise it will be
* {@code true} will be returned. Otherwise, it will be
* {@code false}.
* @return Whether the Field is indexed.
*/
Expand Down Expand Up @@ -715,7 +715,7 @@ private void processVars(final String key, final String replaceValue) {
* @param results
* @param actions
* @param pos
* @return true if all of the dependent validations passed.
* @return true if all dependent validations passed.
* @throws ValidatorException If there's an error running a validator
*/
private boolean runDependentValidators(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public static Float formatFloat(final String value, final Locale locale) {
}

/**
* Checks if the value can safely be converted to a int primitive.
* Checks if the value can safely be converted to an int primitive.
*
* @param value The value validation is being performed on.
* @return the converted Integer value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class GenericValidator implements Serializable {
/**
* Calculate an adjustment amount for line endings.
*
* See Bug 37962 for the rational behind this.
* See Bug 37962 for the rationale behind this.
*
* @param value The value validation is being performed on.
* @param lineEndLength The length to use for line endings.
Expand Down Expand Up @@ -239,7 +239,7 @@ public static boolean isInRange(final short value, final short min, final short
}

/**
* <p>Checks if the value can safely be converted to a int primitive.</p>
* <p>Checks if the value can safely be converted to an int primitive.</p>
*
* @param value The value validation is being performed on.
* @return true if the value can be converted to an Integer.
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/apache/commons/validator/UrlValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public class UrlValidator implements Serializable {
private static final int PARSE_URL_FRAGMENT = 9;

/**
* Protocol (ie. http:, ftp:,https:).
* Protocol (i.e. http:, ftp:,https:).
*/
private static final Pattern SCHEME_PATTERN = Pattern.compile("^\\p{Alpha}[\\p{Alnum}\\+\\-\\.]*");

Expand Down Expand Up @@ -346,7 +346,7 @@ protected boolean isValidAuthority(final String authority) {
final String topLevel = domainSegment[segmentCount - 1];


// First letter of top level must be a alpha
// First letter of top level must be an alpha
// Make sure there's a host name preceding the authority.
if (topLevel.length() < TOP_LEVEL_MIN_LEN || topLevel.length() > TOP_LEVEL_MAX_LEN || !ALPHA_PATTERN.matcher(topLevel.substring(0, 1)).matches()
|| segmentCount < 2) {
Expand Down Expand Up @@ -409,7 +409,7 @@ protected boolean isValidPath(final String path) {
}

/**
* Returns true if the query is null or it's a properly formatted query string.
* Returns true if the query is null, or it's a properly formatted query string.
* @param query Query value to validate.
* @return true if query is valid.
*/
Expand All @@ -422,8 +422,8 @@ protected boolean isValidQuery(final String query) {
}

/**
* Validate scheme. If schemes[] was initialized to a non null,
* then only those scheme's are allowed. Note this is slightly different
* Validate scheme. If schemes[] was initialized to a non-null,
* then only those schemes are allowed. Note this is slightly different
* than for the constructor.
* @param scheme The scheme to validate. A {@code null} value is considered
* invalid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class ValidatorAction implements Serializable {

/**
* <p>
* The method signature of the validation method. This should be a comma delimited list of the full class names of each parameter in the correct order that
* The method signature of the validation method. This should be a comma-delimited list of the full class names of each parameter in the correct order that
* the method takes.
* </p>
* <p>
Expand Down Expand Up @@ -668,7 +668,7 @@ public synchronized void setJavascript(final String javaScript) {
* {@code setJavascript} will result in an {@code IllegalStateException} being thrown.
* </p>
* <p>
* If <strong>neither</strong> setJsFunction or setJavascript is set then validator will attempt to load the default JavaScript definition.
* If <strong>neither</strong> setJsFunction nor setJavascript is set then validator will attempt to load the default JavaScript definition.
* </p>
*
* <pre>
Expand Down
24 changes: 9 additions & 15 deletions src/main/java/org/apache/commons/validator/ValidatorResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ public ValidatorResources() {
*
* @param in InputStream to a validation.xml configuration file. It's the client's
* responsibility to close this stream.
* @throws SAXException if the validation XML files are not valid or well
* formed.
* @throws SAXException if the validation XML files are not valid or well-formed.
* @throws IOException if an I/O error occurs processing the XML files
* @since 1.1
*/
Expand All @@ -145,8 +144,7 @@ public ValidatorResources(final InputStream in) throws IOException, SAXException
* @param streams An array of InputStreams to several validation.xml
* configuration files that will be read in order and merged into this object.
* It's the client's responsibility to close these streams.
* @throws SAXException if the validation XML files are not valid or well
* formed.
* @throws SAXException if the validation XML files are not valid or well-formed.
* @throws IOException if an I/O error occurs processing the XML files
* @since 1.1
*/
Expand All @@ -169,8 +167,7 @@ public ValidatorResources(final InputStream[] streams)
* Create a ValidatorResources object from an uri
*
* @param uri The location of a validation.xml configuration file.
* @throws SAXException if the validation XML files are not valid or well
* formed.
* @throws SAXException if the validation XML files are not valid or well-formed.
* @throws IOException if an I/O error occurs processing the XML files
* @since 1.2
*/
Expand All @@ -183,8 +180,7 @@ public ValidatorResources(final String uri) throws IOException, SAXException {
*
* @param uris An array of uris to several validation.xml
* configuration files that will be read in order and merged into this object.
* @throws SAXException if the validation XML files are not valid or well
* formed.
* @throws SAXException if the validation XML files are not valid or well-formed.
* @throws IOException if an I/O error occurs processing the XML files
* @since 1.2
*/
Expand All @@ -205,8 +201,7 @@ public ValidatorResources(final String... uris)
*
* @param url The URL for the validation.xml
* configuration file that will be read into this object.
* @throws SAXException if the validation XML file are not valid or well
* formed.
* @throws SAXException if the validation XML file are not valid or well-formed.
* @throws IOException if an I/O error occurs processing the XML files
* @since 1.3.1
*/
Expand All @@ -220,8 +215,7 @@ public ValidatorResources(final URL url)
*
* @param urls An array of URL to several validation.xml
* configuration files that will be read in order and merged into this object.
* @throws SAXException if the validation XML files are not valid or well
* formed.
* @throws SAXException if the validation XML files are not valid or well-formed.
* @throws IOException if an I/O error occurs processing the XML files
* @since 1.3.1
*/
Expand Down Expand Up @@ -335,7 +329,7 @@ public void addValidatorAction(final ValidatorAction va) {
}

/**
* Builds a key to store the {@code FormSet} under based on it's
* Builds a key to store the {@code FormSet} under based on its
* language, country, and variant values.
* @param fs The Form Set.
* @return generated key for a formset.
Expand Down Expand Up @@ -543,7 +537,7 @@ private FormSet getParent(final FormSet fs) {
}

/**
* Gets a {@code ValidatorAction} based on it's name.
* Gets a {@code ValidatorAction} based on its name.
* @param key The validator action key.
* @return The validator action.
*/
Expand Down Expand Up @@ -590,7 +584,7 @@ private Digester initDigester() {
}

/**
* Process the {@code ValidatorResources} object. Currently sets the
* Process the {@code ValidatorResources} object. Currently, sets the
* {@code FastHashMap} s to the 'fast' mode and call the processes
* all other resources. <strong>Note </strong>: The framework calls this
* automatically when ValidatorResources is created from an XML file. If you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ValidatorResults() {
}

/**
* Add a the result of a validator action.
* Add the result of a validator action.
*
* @param field The field validated.
* @param validatorName The name of the validator.
Expand All @@ -56,7 +56,7 @@ public void add(final Field field, final String validatorName, final boolean res
}

/**
* Add a the result of a validator action.
* Add the result of a validator action.
*
* @param field The field validated.
* @param validatorName The name of the validator.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/commons/validator/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* <p>In order to use the Validator, the following basic steps are required:</p>
* <ul>
* <li>Create a new instance of the
* {@code org.apache.commons.validator.Validator} class. Currently
* {@code org.apache.commons.validator.Validator} class. Currently,
* Validator instances may be safely reused if the current ValidatorResources
* are the same, as long as
* you have completed any previous validation, and you do not try to utilize
Expand Down Expand Up @@ -68,7 +68,7 @@
* using the Apache Commons BeanUtils
* (https://commons.apache.org/beanutils/) package.
* Error messages and the arguments for error messages can be
* associated with a fields validation.
* associated with a field's validation.
* </p>
* <a id="doc.Resources"></a>
* <h2>Resources</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private int calculateQuarter(final Calendar calendar, final int monthOfFirstQuar

/**
* <p>Compares a calendar value to another, indicating whether it is
* equal, less then or more than at a specified level.</p>
* equal, less than or more than at a specified level.</p>
*
* @param value The Calendar value.
* @param compare The {@link Calendar} to check the value against.
Expand Down Expand Up @@ -159,7 +159,7 @@ protected int compare(final Calendar value, final Calendar compare, final int fi

/**
* <p>Compares a calendar's quarter value to another, indicating whether it is
* equal, less then or more than the specified quarter.</p>
* equal, less than or more than the specified quarter.</p>
*
* @param value The Calendar value.
* @param compare The {@link Calendar} to check the value against.
Expand All @@ -175,7 +175,7 @@ protected int compareQuarters(final Calendar value, final Calendar compare, fina

/**
* <p>Compares a calendar time value to another, indicating whether it is
* equal, less then or more than at a specified level.</p>
* equal, less than or more than at a specified level.</p>
*
* @param value The Calendar value.
* @param compare The {@link Calendar} to check the value against.
Expand Down Expand Up @@ -241,7 +241,7 @@ protected String format(Object value, final Format formatter) {
* @param value The value validation is being performed on.
* @param locale The locale to use for the Format.
* @param timeZone The Time Zone used to format the date,
* system default if null (unless value is a {@link Calendar}.
* system default if null unless value is a {@link Calendar}.
* @return The value formatted as a {@link String}.
*/
public String format(final Object value, final Locale locale, final TimeZone timeZone) {
Expand Down Expand Up @@ -270,7 +270,7 @@ public String format(final Object value, final String pattern, final Locale loca
* @param pattern The pattern used to format the value.
* @param locale The locale to use for the Format.
* @param timeZone The Time Zone used to format the date,
* system default if null (unless value is a {@link Calendar}.
* system default if null unless value is a {@link Calendar}.
* @return The value formatted as a {@link String}.
*/
public String format(final Object value, final String pattern, final Locale locale, final TimeZone timeZone) {
Expand All @@ -290,7 +290,7 @@ public String format(final Object value, final String pattern, final Locale loca
* @param value The value validation is being performed on.
* @param pattern The pattern used to format the value.
* @param timeZone The Time Zone used to format the date,
* system default if null (unless value is a {@link Calendar}.
* system default if null unless value is a {@link Calendar}.
* @return The value formatted as a {@link String}.
*/
public String format(final Object value, final String pattern, final TimeZone timeZone) {
Expand All @@ -303,7 +303,7 @@ public String format(final Object value, final String pattern, final TimeZone ti
*
* @param value The value validation is being performed on.
* @param timeZone The Time Zone used to format the date,
* system default if null (unless value is a {@link Calendar}.
* system default if null unless value is a {@link Calendar}.
* @return The value formatted as a {@link String}.
*/
public String format(final Object value, final TimeZone timeZone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* <li>using a specified pattern with a specified {@link Locale}</li>
* </ul>
*
* <p>For each of the above mechanisms, conversion method (i.e the
* <p>For each of the above mechanisms, conversion method (i.e. the
* {@code validate} methods) implementations are provided which
* either use the default {@code TimeZone} or allow the
* {@code TimeZone} to be specified.</p>
Expand All @@ -50,7 +50,7 @@
*
* <p>Alternatively the CalendarValidator's {@code adjustToTimeZone()} method
* can be used to adjust the {@code TimeZone} of the {@link Calendar}
* object afterwards.</p>
* object afterward.</p>
*
* <p>Once a value has been successfully converted the following
* methods can be used to perform various date comparison checks:</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* </ul>
* <p>
* Codes often include <em>format</em> characters - such as hyphens - to make them
* more easily human readable. These can be removed prior to length and check digit
* more easily human-readable. These can be removed prior to length and check digit
* validation by specifying them as a <em>non-capturing</em> group in the regular
* expression (i.e. use the {@code (?: )} notation).
* <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public CreditCardValidator(final long options) {

/**
* Tests whether the given flag is on. If the flag is not a power of 2
* (ie. 3) this tests whether the combination of flags is on.
* (i.e. 3) this tests whether the combination of flags is on.
*
* @param options The options specified.
* @param flag Flag value to check.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
* <p>{@code ... = new IntegerValidator(false, IntegerValidator.CURRENCY_FORMAT);}</p>
*
* <p>Pick the appropriate validator, depending on the type (e.g Float, Double, Integer, Long etc)
* <p>Pick the appropriate validator, depending on the type (e.g. Float, Double, Integer, Long etc)
* you want the currency converted to. One thing to note - only the CurrencyValidator
* implements <em>lenient</em> behavior regarding the currency symbol.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* <li>using a specified pattern with a specified {@link Locale}</li>
* </ul>
*
* <p>For each of the above mechanisms, conversion method (i.e the
* <p>For each of the above mechanisms, conversion method (i.e. the
* {@code validate} methods) implementations are provided which
* either use the default {@code TimeZone} or allow the
* {@code TimeZone} to be specified.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,7 @@ public boolean isValidInfrastructureTld(final String iTld) {
* widely used "local" domains (localhost or localdomain). Leading dots are
* ignored if present. The search is case-insensitive.
* @param lTld the parameter to check for local TLD status, not null
* @return true if the parameter is an local TLD
* @return true if the parameter is a local TLD
*/
public boolean isValidLocalTld(final String lTld) {
final String key = chompLeadingDot(unicodeToASCII(lTld).toLowerCase(Locale.ENGLISH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ protected boolean isValidDomain(final String domain) {
* Returns true if the user component of an email address is valid.
*
* @param user being validated
* @return true if the user name is valid.
* @return true if the username is valid.
*/
protected boolean isValidUser(final String user) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ public RegexValidator getRegexValidator() {
/*
* Wikipedia [1] says that only uppercase is allowed.
* The SWIFT PDF file [2] implies that lower case is allowed.
* However there are no examples using lower-case.
* However, there are no examples using lower-case.
* Unfortunately the relevant ISO documents (ISO 13616-1) are not available for free.
* The IBANCheckDigit code treats upper and lower case the same,
* so any case validation has to be done in this class.
*
* Note: the European Payments council has a document [3] which includes a description
* of the IBAN. Section 5 clearly states that only upper case is allowed.
* Also the maximum length is 34 characters (including the country code),
* Also, the maximum length is 34 characters (including the country code),
* and the length is fixed for each country.
*
* It looks like lower-case is permitted in BBANs, but they must be converted to
Expand Down
Loading
Loading