This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git
The following commit(s) were added to refs/heads/master by this push:
new 50c9af62 Remove DOS line endings
50c9af62 is described below
commit 50c9af62f224bdfef5dbe701ed02d9e94524b13d
Author: Sebb <[email protected]>
AuthorDate: Sun Dec 22 13:40:02 2024 +0000
Remove DOS line endings
---
pom.xml | 828 ++++++++++-----------
.../validator/routines/checkdigit/CheckDigit.java | 144 ++--
.../routines/checkdigit/ModulusTenCheckDigit.java | 504 ++++++-------
.../commons/validator/ParameterValidatorImpl.java | 68 +-
4 files changed, 772 insertions(+), 772 deletions(-)
diff --git a/pom.xml b/pom.xml
index 700b0e60..4f4ea641 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,414 +1,414 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-parent</artifactId>
- <version>78</version>
- </parent>
-
- <groupId>commons-validator</groupId>
- <artifactId>commons-validator</artifactId>
- <version>1.10.0-SNAPSHOT</version>
- <name>Apache Commons Validator</name>
- <description>
- Apache Commons Validator provides the building blocks for both client-side
and server-side data validation.
- It may be used standalone or with a framework like Struts.
- </description>
- <url>http://commons.apache.org/proper/commons-validator/</url>
- <inceptionYear>2002</inceptionYear>
-
- <properties>
- <commons.componentid>validator</commons.componentid>
- <commons.module.name>org.apache.commons.validator</commons.module.name>
- <!-- Re-generate the download page using: mvn commons:download-page -->
- <commons.release.version>1.10.0</commons.release.version>
- <commons.release.next>1.10.1</commons.release.next>
- <commons.rc.version>RC1</commons.rc.version>
- <commons.release.desc>(requires JDK
${maven.compiler.target})</commons.release.desc>
- <commons.bc.version>1.9.0</commons.bc.version>
- <commons.jira.id>VALIDATOR</commons.jira.id>
- <commons.jira.pid>12310494</commons.jira.pid>
- <commons.encoding>UTF-8</commons.encoding>
-
-
<commons.scmPubCheckoutDirectory>site-content</commons.scmPubCheckoutDirectory>
-
<commons.scmPubUrl>https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-validator</commons.scmPubUrl>
-
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-
<project.build.outputTimestamp>2024-05-28T23:13:31Z</project.build.outputTimestamp>
- <commons.release.isDistModule>true</commons.release.isDistModule>
- <!-- JaCoCo: Don't make code coverage worse than: -->
- <commons.jacoco.haltOnFailure>true</commons.jacoco.haltOnFailure>
- <commons.jacoco.classRatio>0.97</commons.jacoco.classRatio>
- <commons.jacoco.instructionRatio>0.87</commons.jacoco.instructionRatio>
- <commons.jacoco.methodRatio>0.81</commons.jacoco.methodRatio>
- <commons.jacoco.branchRatio>0.74</commons.jacoco.branchRatio>
- <commons.jacoco.lineRatio>0.78</commons.jacoco.lineRatio>
- <commons.jacoco.complexityRatio>0.71</commons.jacoco.complexityRatio>
- </properties>
-
- <scm>
-
<connection>scm:git:https://gitbox.apache.org/repos/asf/commons-validator</connection>
-
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/commons-validator</developerConnection>
- <url>https://gitbox.apache.org/repos/asf/commons-validator</url>
- </scm>
-
- <issueManagement>
- <system>jira</system>
- <url>http://issues.apache.org/jira/browse/VALIDATOR</url>
- </issueManagement>
-
- <distributionManagement>
- <site>
- <id>apache.website</id>
- <name>Apache Commons Site</name>
-
<url>scm:svn:https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-validator/</url>
- </site>
- </distributionManagement>
-
- <build>
- <defaultGoal>clean verify apache-rat:check japicmp:cmp checkstyle:check
spotbugs:check pmd:check javadoc:javadoc</defaultGoal>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes combine.children="append">
-
<exclude>src/test/resources/org/apache/commons/validator/routines/iban_registry_v*.txt</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.github.spotbugs</groupId>
- <artifactId>spotbugs-maven-plugin</artifactId>
- <configuration>
- <threshold>Normal</threshold>
- <effort>Default</effort>
-
<excludeFilterFile>${basedir}/src/conf/spotbugs-exclude-filter.xml</excludeFilterFile>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <resources>
- <resource>
- <directory>${basedir}</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>NOTICE.txt</include>
- <include>LICENSE.txt</include>
- </includes>
- </resource>
- <resource>
- <directory>${basedir}/src/main/resources</directory>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>${basedir}/src/assembly/bin.xml</descriptor>
- <descriptor>${basedir}/src/assembly/src.xml</descriptor>
- </descriptors>
- <tarLongFileMode>gnu</tarLongFileMode>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-scm-publish-plugin</artifactId>
- <configuration>
- <ignorePathsToDelete>
- <ignorePathToDelete>javadocs</ignorePathToDelete>
- </ignorePathsToDelete>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <configLocation>${basedir}/src/conf/checkstyle.xml</configLocation>
- <!-- TODO
<includeTestSourceDirectory>true</includeTestSourceDirectory> -->
- <!-- Needed to define config_loc -->
- <propertyExpansion>config_loc=${basedir}/src/conf</propertyExpansion>
- <enableRulesSummary>false</enableRulesSummary>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.github.spotbugs</groupId>
- <artifactId>spotbugs-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
-
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.9.4</version>
- </dependency>
-
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>2.1</version>
- <!-- exclude older version and use declared-only -->
- <exclusions>
- <exclusion>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.3.4</version>
- </dependency>
-
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2.2</version>
- </dependency>
-
- <!-- Needed for IBANValidatorTest -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-csv</artifactId>
- <version>1.12.0</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <!-- For testing DomainValidatorStartup -->
- <groupId>org.bitstrings.test</groupId>
- <artifactId>junit-clptr</artifactId>
- <version>1.2.2</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.17.0</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <configLocation>${basedir}/src/conf/checkstyle.xml</configLocation>
- <!-- Needed to define config_loc -->
- <propertyExpansion>config_loc=${basedir}/src/conf</propertyExpansion>
- <enableRulesSummary>false</enableRulesSummary>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- </configuration>
- <reportSets>
- <reportSet>
- <reports>
- <report>checkstyle</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <targetJdk>${maven.compiler.target}</targetJdk>
- </configuration>
- <reportSets>
- <reportSet>
- <reports>
- <report>pmd</report>
- <report>cpd</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- <plugin>
- <groupId>com.github.spotbugs</groupId>
- <artifactId>spotbugs-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
-
- <profiles>
- <profile>
- <id>setup-checkout</id>
- <activation>
- <file>
- <missing>site-content</missing>
- </file>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>prepare-checkout</id>
- <phase>pre-site</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <exec executable="svn">
- <arg line="checkout --depth immediates
${commons.scmPubUrl} ${commons.scmPubCheckoutDirectory}" />
- </exec>
-
- <exec executable="svn">
- <arg line="update --set-depth exclude
${commons.scmPubCheckoutDirectory}/javadocs" />
- </exec>
-
- <pathconvert pathsep=" " property="dirs">
- <dirset dir="${commons.scmPubCheckoutDirectory}"
includes="*" />
- </pathconvert>
- <exec executable="svn">
- <arg line="update --set-depth infinity ${dirs}" />
- </exec>
- </target>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <developers>
- <developer>
- <name>Don Brown</name>
- <id>mrdon</id>
- <email>[email protected]</email>
- </developer>
- <developer>
- <name>Martin Cooper</name>
- <id>martinc</id>
- <email>[email protected]</email>
- </developer>
- <developer>
- <name>David Graham</name>
- <id>dgraham</id>
- <email>[email protected]</email>
- </developer>
- <developer>
- <name>Ted Husted</name>
- <id>husted</id>
- <email>[email protected]</email>
- </developer>
- <developer>
- <name>Rob Leland</name>
- <id>rleland</id>
- <email>rleland at apache.org</email>
- </developer>
- <developer>
- <name>Craig McClanahan</name>
- <id>craigmcc</id>
- <email>[email protected]</email>
- </developer>
- <developer>
- <name>James Mitchell</name>
- <id>jmitchell</id>
- <email>jmitchell NOSPAM apache.org</email>
- <organization>EdgeTech, Inc</organization>
- </developer>
- <developer>
- <name>Niall Pemberton</name>
- <id>niallp</id>
- </developer>
- <developer>
- <name>James Turner</name>
- <id>turner</id>
- <email>[email protected]</email>
- </developer>
- <developer>
- <name>David Winterfeldt</name>
- <id>dwinterfeldt</id>
- <email>[email protected]</email>
- </developer>
- <developer>
- <name>Henri Yandell</name>
- <id>bayard</id>
- </developer>
- <developer>
- <name>Ben Speakmon</name>
- <id>bspeakmon</id>
- </developer>
- <developer>
- <name>Nick Burch</name>
- <id>nick</id>
- </developer>
- <developer>
- <name>SimoneTripodi</name>
- <id>simonetripodi</id>
- </developer>
- <developer>
- <name>Benedikt Ritter</name>
- <id>britter</id>
- </developer>
- <developer>
- <id>ggregory</id>
- <name>Gary Gregory</name>
- <email>ggregory at apache.org</email>
- <url>https://www.garygregory.com</url>
- <organization>The Apache Software Foundation</organization>
- <organizationUrl>https://www.apache.org/</organizationUrl>
- <roles>
- <role>PMC Member</role>
- </roles>
- <timezone>America/New_York</timezone>
- <properties>
-
<picUrl>https://people.apache.org/~ggregory/img/garydgregory80.png</picUrl>
- </properties>
- </developer>
- </developers>
- <contributors>
- <contributor>
- <name>Makoto Uchino</name>
- </contributor>
- </contributors>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>78</version>
+ </parent>
+
+ <groupId>commons-validator</groupId>
+ <artifactId>commons-validator</artifactId>
+ <version>1.10.0-SNAPSHOT</version>
+ <name>Apache Commons Validator</name>
+ <description>
+ Apache Commons Validator provides the building blocks for both client-side
and server-side data validation.
+ It may be used standalone or with a framework like Struts.
+ </description>
+ <url>http://commons.apache.org/proper/commons-validator/</url>
+ <inceptionYear>2002</inceptionYear>
+
+ <properties>
+ <commons.componentid>validator</commons.componentid>
+ <commons.module.name>org.apache.commons.validator</commons.module.name>
+ <!-- Re-generate the download page using: mvn commons:download-page -->
+ <commons.release.version>1.10.0</commons.release.version>
+ <commons.release.next>1.10.1</commons.release.next>
+ <commons.rc.version>RC1</commons.rc.version>
+ <commons.release.desc>(requires JDK
${maven.compiler.target})</commons.release.desc>
+ <commons.bc.version>1.9.0</commons.bc.version>
+ <commons.jira.id>VALIDATOR</commons.jira.id>
+ <commons.jira.pid>12310494</commons.jira.pid>
+ <commons.encoding>UTF-8</commons.encoding>
+
+
<commons.scmPubCheckoutDirectory>site-content</commons.scmPubCheckoutDirectory>
+
<commons.scmPubUrl>https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-validator</commons.scmPubUrl>
+
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+
<project.build.outputTimestamp>2024-05-28T23:13:31Z</project.build.outputTimestamp>
+ <commons.release.isDistModule>true</commons.release.isDistModule>
+ <!-- JaCoCo: Don't make code coverage worse than: -->
+ <commons.jacoco.haltOnFailure>true</commons.jacoco.haltOnFailure>
+ <commons.jacoco.classRatio>0.97</commons.jacoco.classRatio>
+ <commons.jacoco.instructionRatio>0.87</commons.jacoco.instructionRatio>
+ <commons.jacoco.methodRatio>0.81</commons.jacoco.methodRatio>
+ <commons.jacoco.branchRatio>0.74</commons.jacoco.branchRatio>
+ <commons.jacoco.lineRatio>0.78</commons.jacoco.lineRatio>
+ <commons.jacoco.complexityRatio>0.71</commons.jacoco.complexityRatio>
+ </properties>
+
+ <scm>
+
<connection>scm:git:https://gitbox.apache.org/repos/asf/commons-validator</connection>
+
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/commons-validator</developerConnection>
+ <url>https://gitbox.apache.org/repos/asf/commons-validator</url>
+ </scm>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://issues.apache.org/jira/browse/VALIDATOR</url>
+ </issueManagement>
+
+ <distributionManagement>
+ <site>
+ <id>apache.website</id>
+ <name>Apache Commons Site</name>
+
<url>scm:svn:https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-validator/</url>
+ </site>
+ </distributionManagement>
+
+ <build>
+ <defaultGoal>clean verify apache-rat:check japicmp:cmp checkstyle:check
spotbugs:check pmd:check javadoc:javadoc</defaultGoal>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes combine.children="append">
+
<exclude>src/test/resources/org/apache/commons/validator/routines/iban_registry_v*.txt</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ <configuration>
+ <threshold>Normal</threshold>
+ <effort>Default</effort>
+
<excludeFilterFile>${basedir}/src/conf/spotbugs-exclude-filter.xml</excludeFilterFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>NOTICE.txt</include>
+ <include>LICENSE.txt</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${basedir}/src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>${basedir}/src/assembly/bin.xml</descriptor>
+ <descriptor>${basedir}/src/assembly/src.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-scm-publish-plugin</artifactId>
+ <configuration>
+ <ignorePathsToDelete>
+ <ignorePathToDelete>javadocs</ignorePathToDelete>
+ </ignorePathsToDelete>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>${basedir}/src/conf/checkstyle.xml</configLocation>
+ <!-- TODO
<includeTestSourceDirectory>true</includeTestSourceDirectory> -->
+ <!-- Needed to define config_loc -->
+ <propertyExpansion>config_loc=${basedir}/src/conf</propertyExpansion>
+ <enableRulesSummary>false</enableRulesSummary>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.9.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>2.1</version>
+ <!-- exclude older version and use declared-only -->
+ <exclusions>
+ <exclusion>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.3.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.2</version>
+ </dependency>
+
+ <!-- Needed for IBANValidatorTest -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-csv</artifactId>
+ <version>1.12.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <!-- For testing DomainValidatorStartup -->
+ <groupId>org.bitstrings.test</groupId>
+ <artifactId>junit-clptr</artifactId>
+ <version>1.2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.17.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>${basedir}/src/conf/checkstyle.xml</configLocation>
+ <!-- Needed to define config_loc -->
+ <propertyExpansion>config_loc=${basedir}/src/conf</propertyExpansion>
+ <enableRulesSummary>false</enableRulesSummary>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>checkstyle</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <targetJdk>${maven.compiler.target}</targetJdk>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>pmd</report>
+ <report>cpd</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <profiles>
+ <profile>
+ <id>setup-checkout</id>
+ <activation>
+ <file>
+ <missing>site-content</missing>
+ </file>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-checkout</id>
+ <phase>pre-site</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <exec executable="svn">
+ <arg line="checkout --depth immediates
${commons.scmPubUrl} ${commons.scmPubCheckoutDirectory}" />
+ </exec>
+
+ <exec executable="svn">
+ <arg line="update --set-depth exclude
${commons.scmPubCheckoutDirectory}/javadocs" />
+ </exec>
+
+ <pathconvert pathsep=" " property="dirs">
+ <dirset dir="${commons.scmPubCheckoutDirectory}"
includes="*" />
+ </pathconvert>
+ <exec executable="svn">
+ <arg line="update --set-depth infinity ${dirs}" />
+ </exec>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <developers>
+ <developer>
+ <name>Don Brown</name>
+ <id>mrdon</id>
+ <email>[email protected]</email>
+ </developer>
+ <developer>
+ <name>Martin Cooper</name>
+ <id>martinc</id>
+ <email>[email protected]</email>
+ </developer>
+ <developer>
+ <name>David Graham</name>
+ <id>dgraham</id>
+ <email>[email protected]</email>
+ </developer>
+ <developer>
+ <name>Ted Husted</name>
+ <id>husted</id>
+ <email>[email protected]</email>
+ </developer>
+ <developer>
+ <name>Rob Leland</name>
+ <id>rleland</id>
+ <email>rleland at apache.org</email>
+ </developer>
+ <developer>
+ <name>Craig McClanahan</name>
+ <id>craigmcc</id>
+ <email>[email protected]</email>
+ </developer>
+ <developer>
+ <name>James Mitchell</name>
+ <id>jmitchell</id>
+ <email>jmitchell NOSPAM apache.org</email>
+ <organization>EdgeTech, Inc</organization>
+ </developer>
+ <developer>
+ <name>Niall Pemberton</name>
+ <id>niallp</id>
+ </developer>
+ <developer>
+ <name>James Turner</name>
+ <id>turner</id>
+ <email>[email protected]</email>
+ </developer>
+ <developer>
+ <name>David Winterfeldt</name>
+ <id>dwinterfeldt</id>
+ <email>[email protected]</email>
+ </developer>
+ <developer>
+ <name>Henri Yandell</name>
+ <id>bayard</id>
+ </developer>
+ <developer>
+ <name>Ben Speakmon</name>
+ <id>bspeakmon</id>
+ </developer>
+ <developer>
+ <name>Nick Burch</name>
+ <id>nick</id>
+ </developer>
+ <developer>
+ <name>SimoneTripodi</name>
+ <id>simonetripodi</id>
+ </developer>
+ <developer>
+ <name>Benedikt Ritter</name>
+ <id>britter</id>
+ </developer>
+ <developer>
+ <id>ggregory</id>
+ <name>Gary Gregory</name>
+ <email>ggregory at apache.org</email>
+ <url>https://www.garygregory.com</url>
+ <organization>The Apache Software Foundation</organization>
+ <organizationUrl>https://www.apache.org/</organizationUrl>
+ <roles>
+ <role>PMC Member</role>
+ </roles>
+ <timezone>America/New_York</timezone>
+ <properties>
+
<picUrl>https://people.apache.org/~ggregory/img/garydgregory80.png</picUrl>
+ </properties>
+ </developer>
+ </developers>
+ <contributors>
+ <contributor>
+ <name>Makoto Uchino</name>
+ </contributor>
+ </contributors>
+
+</project>
diff --git
a/src/main/java/org/apache/commons/validator/routines/checkdigit/CheckDigit.java
b/src/main/java/org/apache/commons/validator/routines/checkdigit/CheckDigit.java
index 931e3a18..373b83a3 100644
---
a/src/main/java/org/apache/commons/validator/routines/checkdigit/CheckDigit.java
+++
b/src/main/java/org/apache/commons/validator/routines/checkdigit/CheckDigit.java
@@ -1,72 +1,72 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.validator.routines.checkdigit;
-
-import org.apache.commons.validator.routines.CodeValidator;
-
-/**
- * <strong>Check Digit</strong> calculation and validation.
- * <p>
- * The logic for validating check digits has previously been
- * embedded within the logic for specific code validation, which
- * includes other validations such as verifying the format
- * or length of a code. {@link CheckDigit} provides for separating out
- * the check digit calculation logic enabling it to be more easily
- * tested and reused.
- * </p>
- * <p>
- * Although Commons Validator is primarily concerned with validation,
- * {@link CheckDigit} also defines behavior for calculating/generating check
- * digits, since it makes sense that users will want to (re-)use the
- * same logic for both. The {@link
org.apache.commons.validator.routines.ISBNValidator}
- * makes specific use of this feature by providing the facility to validate
ISBN-10 codes
- * and then convert them to the new ISBN-13 standard.
- * </p>
- * <p>
- * CheckDigit is used by the new generic {@link CodeValidator} implementation.
- * </p>
- *
- * <h2>Implementations</h2>
- * See the
- * <a href="package-summary.html">Package Summary</a> for a full
- * list of implementations provided within Commons Validator.
- *
- * @see org.apache.commons.validator.routines.CodeValidator
- * @since 1.4
- */
-public interface CheckDigit {
-
- /**
- * Calculates the <em>Check Digit</em> for a code.
- *
- * @param code The code to calculate the Check Digit for.
- * The string must not include the check digit
- * @return The calculated Check Digit
- * @throws CheckDigitException if an error occurs.
- */
- String calculate(String code) throws CheckDigitException;
-
- /**
- * Validates the check digit for the code.
- *
- * @param code The code to validate, the string must include the check
digit.
- * @return {@code true} if the check digit is valid, otherwise
- * {@code false}.
- */
- boolean isValid(String code);
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.validator.routines.checkdigit;
+
+import org.apache.commons.validator.routines.CodeValidator;
+
+/**
+ * <strong>Check Digit</strong> calculation and validation.
+ * <p>
+ * The logic for validating check digits has previously been
+ * embedded within the logic for specific code validation, which
+ * includes other validations such as verifying the format
+ * or length of a code. {@link CheckDigit} provides for separating out
+ * the check digit calculation logic enabling it to be more easily
+ * tested and reused.
+ * </p>
+ * <p>
+ * Although Commons Validator is primarily concerned with validation,
+ * {@link CheckDigit} also defines behavior for calculating/generating check
+ * digits, since it makes sense that users will want to (re-)use the
+ * same logic for both. The {@link
org.apache.commons.validator.routines.ISBNValidator}
+ * makes specific use of this feature by providing the facility to validate
ISBN-10 codes
+ * and then convert them to the new ISBN-13 standard.
+ * </p>
+ * <p>
+ * CheckDigit is used by the new generic {@link CodeValidator} implementation.
+ * </p>
+ *
+ * <h2>Implementations</h2>
+ * See the
+ * <a href="package-summary.html">Package Summary</a> for a full
+ * list of implementations provided within Commons Validator.
+ *
+ * @see org.apache.commons.validator.routines.CodeValidator
+ * @since 1.4
+ */
+public interface CheckDigit {
+
+ /**
+ * Calculates the <em>Check Digit</em> for a code.
+ *
+ * @param code The code to calculate the Check Digit for.
+ * The string must not include the check digit
+ * @return The calculated Check Digit
+ * @throws CheckDigitException if an error occurs.
+ */
+ String calculate(String code) throws CheckDigitException;
+
+ /**
+ * Validates the check digit for the code.
+ *
+ * @param code The code to validate, the string must include the check
digit.
+ * @return {@code true} if the check digit is valid, otherwise
+ * {@code false}.
+ */
+ boolean isValid(String code);
+
+}
diff --git
a/src/main/java/org/apache/commons/validator/routines/checkdigit/ModulusTenCheckDigit.java
b/src/main/java/org/apache/commons/validator/routines/checkdigit/ModulusTenCheckDigit.java
index 414f45b2..1afde83a 100644
---
a/src/main/java/org/apache/commons/validator/routines/checkdigit/ModulusTenCheckDigit.java
+++
b/src/main/java/org/apache/commons/validator/routines/checkdigit/ModulusTenCheckDigit.java
@@ -1,252 +1,252 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.validator.routines.checkdigit;
-
-import java.util.Arrays;
-
-import org.apache.commons.validator.GenericValidator;
-import org.apache.commons.validator.routines.CodeValidator;
-
-/**
- * General Modulus 10 Check Digit calculation/validation.
- *
- * <h2>How it Works</h2>
- * <p>
- * This implementation calculates/validates the check digit in the following
- * way:
- * <ul>
- * <li>Converting each character to an integer value using
- * {@code Character.getNumericValue(char)} - negative integer values from
- * that method are invalid.</li>
- * <li>Calculating a <em>weighted value</em> by multiplying the character's
- * integer value by a <em>weighting factor</em>. The <em>weighting factor</em>
is
- * selected from the configured {@code positionWeight} array based on its
- * position. The {@code postitionWeight} values are used either
- * left-to-right (when {@code useRightPos=false}) or right-to-left (when
- * {@code useRightPos=true}).</li>
- * <li>If {@code sumWeightedDigits=true}, the <em>weighted value</em> is
- * re-calculated by summing its digits.</li>
- * <li>The <em>weighted values</em> of each character are totalled.</li>
- * <li>The total modulo 10 will be zero for a code with a valid Check
Digit.</li>
- * </ul>
- * <h2>Limitations</h2>
- * <p>
- * This implementation has the following limitations:
- * <ul>
- * <li>It assumes the last character in the code is the Check Digit and
- * validates that it is a numeric character.</li>
- * <li>The only limitation on valid characters are those that
- * {@code Character.getNumericValue(char)} returns a positive value. If,
- * for example, the code should only contain numbers, this implementation does
- * not check that.</li>
- * <li>There are no checks on code length.</li>
- * </ul>
- * <p>
- * <strong>Note:</strong> This implementation can be combined with the
- * {@link CodeValidator} in order to ensure the length and characters are
valid.
- *
- * <h2>Example Usage</h2>
- * <p>
- * This implementation was added after a number of Modulus 10 routines and
these
- * are shown re-implemented using this routine below:
- *
- * <p>
- * <strong>ABA Number</strong> Check Digit Routine (equivalent of
- * {@link ABANumberCheckDigit}). Weighting factors are {@code [1, 7, 3]}
- * applied from right to left.
- *
- * <pre>
- * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 7, 3 }, true);
- * </pre>
- *
- * <p>
- * <strong>CUSIP</strong> Check Digit Routine (equivalent of {@link
CUSIPCheckDigit}).
- * Weighting factors are {@code [1, 2]} applied from right to left and the
- * digits of the <em>weighted value</em> are summed.
- *
- * <pre>
- * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 2 }, true,
true);
- * </pre>
- *
- * <p>
- * <strong>EAN-13 / UPC</strong> Check Digit Routine (equivalent of
- * {@link EAN13CheckDigit}). Weighting factors are {@code [1, 3]} applied
- * from right to left.
- *
- * <pre>
- * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 3 }, true);
- * </pre>
- *
- * <p>
- * <strong>Luhn</strong> Check Digit Routine (equivalent of {@link
LuhnCheckDigit}).
- * Weighting factors are {@code [1, 2]} applied from right to left and the
- * digits of the <em>weighted value</em> are summed.
- *
- * <pre>
- * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 2 }, true,
true);
- * </pre>
- *
- * <p>
- * <strong>SEDOL</strong> Check Digit Routine (equivalent of {@link
SedolCheckDigit}).
- * Weighting factors are {@code [1, 3, 1, 7, 3, 9, 1]} applied from left to
- * right.
- *
- * <pre>
- * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 3, 1, 7, 3, 9,
1 });
- * </pre>
- *
- * @since 1.6
- */
-public final class ModulusTenCheckDigit extends ModulusCheckDigit {
-
- private static final long serialVersionUID = -3752929983453368497L;
-
- /**
- * The weighted values to apply based on the character position
- */
- private final int[] positionWeight;
-
- /**
- * {@code true} if use positionWeights from right to left
- */
- private final boolean useRightPos;
-
- /**
- * {@code true} if sum the digits of the weighted value
- */
- private final boolean sumWeightedDigits;
-
- /**
- * Constructs a modulus 10 Check Digit routine with the specified weighting
- * from left to right.
- *
- * @param positionWeight the weighted values to apply based on the
- * character position
- */
- public ModulusTenCheckDigit(final int[] positionWeight) {
- this(positionWeight, false, false);
- }
-
- /**
- * Constructs a modulus 10 Check Digit routine with the specified
weighting,
- * indicating whether its from the left or right.
- *
- * @param positionWeight the weighted values to apply based on the
- * character position
- * @param useRightPos {@code true} if use positionWeights from right to
- * left
- */
- public ModulusTenCheckDigit(final int[] positionWeight, final boolean
useRightPos) {
- this(positionWeight, useRightPos, false);
- }
-
- /**
- * Constructs a modulus 10 Check Digit routine with the specified
weighting,
- * indicating whether its from the left or right and whether the weighted
- * digits should be summed.
- *
- * @param positionWeight the weighted values to apply based on the
- * character position
- * @param useRightPos {@code true} if use positionWeights from right to
- * left
- * @param sumWeightedDigits {@code true} if sum the digits of the
- * weighted value
- */
- public ModulusTenCheckDigit(final int[] positionWeight, final boolean
useRightPos, final boolean sumWeightedDigits) {
- this.positionWeight = Arrays.copyOf(positionWeight,
positionWeight.length);
- this.useRightPos = useRightPos;
- this.sumWeightedDigits = sumWeightedDigits;
- }
-
- /**
- * Validate a modulus check digit for a code.
- * <p>
- * Note: assumes last digit is the check digit
- *
- * @param code The code to validate
- * @return {@code true} if the check digit is valid, otherwise
- * {@code false}
- */
- @Override
- public boolean isValid(final String code) {
- if (GenericValidator.isBlankOrNull(code)) {
- return false;
- }
- if (!Character.isDigit(code.charAt(code.length() - 1))) {
- return false;
- }
- return super.isValid(code);
- }
-
- /**
- * Convert a character at a specified position to an integer value.
- * <p>
- * <strong>Note:</strong> this implementation only handlers values that
- * Character.getNumericValue(char) returns a non-negative number.
- *
- * @param character The character to convert
- * @param leftPos The position of the character in the code, counting from
- * left to right (for identifying the position in the string)
- * @param rightPos The position of the character in the code, counting from
- * right to left (not used here)
- * @return The integer value of the character
- * @throws CheckDigitException if Character.getNumericValue(char) returns a
- * negative number
- */
- @Override
- protected int toInt(final char character, final int leftPos, final int
rightPos) throws CheckDigitException {
- final int num = Character.getNumericValue(character);
- if (num < 0) {
- throw new CheckDigitException("Invalid Character[" + leftPos + "]
= '" + character + "'");
- }
- return num;
- }
-
- /**
- * Return a string representation of this implementation.
- *
- * @return a string representation
- */
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[positionWeight=" +
Arrays.toString(positionWeight) + ", useRightPos="
- + useRightPos + ", sumWeightedDigits=" + sumWeightedDigits +
"]";
- }
-
- /**
- * Calculates the <em>weighted</em> value of a character in the code at a
- * specified position.
- *
- * @param charValue The numeric value of the character.
- * @param leftPos The position of the character in the code, counting from
- * left to right
- * @param rightPos The position of the character in the code, counting from
- * right to left
- * @return The weighted value of the character.
- */
- @Override
- protected int weightedValue(final int charValue, final int leftPos, final
int rightPos) {
- final int pos = useRightPos ? rightPos : leftPos;
- final int weight = positionWeight[(pos - 1) % positionWeight.length];
- int weightedValue = charValue * weight;
- if (sumWeightedDigits) {
- weightedValue = sumDigits(weightedValue);
- }
- return weightedValue;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.validator.routines.checkdigit;
+
+import java.util.Arrays;
+
+import org.apache.commons.validator.GenericValidator;
+import org.apache.commons.validator.routines.CodeValidator;
+
+/**
+ * General Modulus 10 Check Digit calculation/validation.
+ *
+ * <h2>How it Works</h2>
+ * <p>
+ * This implementation calculates/validates the check digit in the following
+ * way:
+ * <ul>
+ * <li>Converting each character to an integer value using
+ * {@code Character.getNumericValue(char)} - negative integer values from
+ * that method are invalid.</li>
+ * <li>Calculating a <em>weighted value</em> by multiplying the character's
+ * integer value by a <em>weighting factor</em>. The <em>weighting factor</em>
is
+ * selected from the configured {@code positionWeight} array based on its
+ * position. The {@code postitionWeight} values are used either
+ * left-to-right (when {@code useRightPos=false}) or right-to-left (when
+ * {@code useRightPos=true}).</li>
+ * <li>If {@code sumWeightedDigits=true}, the <em>weighted value</em> is
+ * re-calculated by summing its digits.</li>
+ * <li>The <em>weighted values</em> of each character are totalled.</li>
+ * <li>The total modulo 10 will be zero for a code with a valid Check
Digit.</li>
+ * </ul>
+ * <h2>Limitations</h2>
+ * <p>
+ * This implementation has the following limitations:
+ * <ul>
+ * <li>It assumes the last character in the code is the Check Digit and
+ * validates that it is a numeric character.</li>
+ * <li>The only limitation on valid characters are those that
+ * {@code Character.getNumericValue(char)} returns a positive value. If,
+ * for example, the code should only contain numbers, this implementation does
+ * not check that.</li>
+ * <li>There are no checks on code length.</li>
+ * </ul>
+ * <p>
+ * <strong>Note:</strong> This implementation can be combined with the
+ * {@link CodeValidator} in order to ensure the length and characters are
valid.
+ *
+ * <h2>Example Usage</h2>
+ * <p>
+ * This implementation was added after a number of Modulus 10 routines and
these
+ * are shown re-implemented using this routine below:
+ *
+ * <p>
+ * <strong>ABA Number</strong> Check Digit Routine (equivalent of
+ * {@link ABANumberCheckDigit}). Weighting factors are {@code [1, 7, 3]}
+ * applied from right to left.
+ *
+ * <pre>
+ * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 7, 3 }, true);
+ * </pre>
+ *
+ * <p>
+ * <strong>CUSIP</strong> Check Digit Routine (equivalent of {@link
CUSIPCheckDigit}).
+ * Weighting factors are {@code [1, 2]} applied from right to left and the
+ * digits of the <em>weighted value</em> are summed.
+ *
+ * <pre>
+ * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 2 }, true,
true);
+ * </pre>
+ *
+ * <p>
+ * <strong>EAN-13 / UPC</strong> Check Digit Routine (equivalent of
+ * {@link EAN13CheckDigit}). Weighting factors are {@code [1, 3]} applied
+ * from right to left.
+ *
+ * <pre>
+ * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 3 }, true);
+ * </pre>
+ *
+ * <p>
+ * <strong>Luhn</strong> Check Digit Routine (equivalent of {@link
LuhnCheckDigit}).
+ * Weighting factors are {@code [1, 2]} applied from right to left and the
+ * digits of the <em>weighted value</em> are summed.
+ *
+ * <pre>
+ * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 2 }, true,
true);
+ * </pre>
+ *
+ * <p>
+ * <strong>SEDOL</strong> Check Digit Routine (equivalent of {@link
SedolCheckDigit}).
+ * Weighting factors are {@code [1, 3, 1, 7, 3, 9, 1]} applied from left to
+ * right.
+ *
+ * <pre>
+ * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 3, 1, 7, 3, 9,
1 });
+ * </pre>
+ *
+ * @since 1.6
+ */
+public final class ModulusTenCheckDigit extends ModulusCheckDigit {
+
+ private static final long serialVersionUID = -3752929983453368497L;
+
+ /**
+ * The weighted values to apply based on the character position
+ */
+ private final int[] positionWeight;
+
+ /**
+ * {@code true} if use positionWeights from right to left
+ */
+ private final boolean useRightPos;
+
+ /**
+ * {@code true} if sum the digits of the weighted value
+ */
+ private final boolean sumWeightedDigits;
+
+ /**
+ * Constructs a modulus 10 Check Digit routine with the specified weighting
+ * from left to right.
+ *
+ * @param positionWeight the weighted values to apply based on the
+ * character position
+ */
+ public ModulusTenCheckDigit(final int[] positionWeight) {
+ this(positionWeight, false, false);
+ }
+
+ /**
+ * Constructs a modulus 10 Check Digit routine with the specified
weighting,
+ * indicating whether its from the left or right.
+ *
+ * @param positionWeight the weighted values to apply based on the
+ * character position
+ * @param useRightPos {@code true} if use positionWeights from right to
+ * left
+ */
+ public ModulusTenCheckDigit(final int[] positionWeight, final boolean
useRightPos) {
+ this(positionWeight, useRightPos, false);
+ }
+
+ /**
+ * Constructs a modulus 10 Check Digit routine with the specified
weighting,
+ * indicating whether its from the left or right and whether the weighted
+ * digits should be summed.
+ *
+ * @param positionWeight the weighted values to apply based on the
+ * character position
+ * @param useRightPos {@code true} if use positionWeights from right to
+ * left
+ * @param sumWeightedDigits {@code true} if sum the digits of the
+ * weighted value
+ */
+ public ModulusTenCheckDigit(final int[] positionWeight, final boolean
useRightPos, final boolean sumWeightedDigits) {
+ this.positionWeight = Arrays.copyOf(positionWeight,
positionWeight.length);
+ this.useRightPos = useRightPos;
+ this.sumWeightedDigits = sumWeightedDigits;
+ }
+
+ /**
+ * Validate a modulus check digit for a code.
+ * <p>
+ * Note: assumes last digit is the check digit
+ *
+ * @param code The code to validate
+ * @return {@code true} if the check digit is valid, otherwise
+ * {@code false}
+ */
+ @Override
+ public boolean isValid(final String code) {
+ if (GenericValidator.isBlankOrNull(code)) {
+ return false;
+ }
+ if (!Character.isDigit(code.charAt(code.length() - 1))) {
+ return false;
+ }
+ return super.isValid(code);
+ }
+
+ /**
+ * Convert a character at a specified position to an integer value.
+ * <p>
+ * <strong>Note:</strong> this implementation only handlers values that
+ * Character.getNumericValue(char) returns a non-negative number.
+ *
+ * @param character The character to convert
+ * @param leftPos The position of the character in the code, counting from
+ * left to right (for identifying the position in the string)
+ * @param rightPos The position of the character in the code, counting from
+ * right to left (not used here)
+ * @return The integer value of the character
+ * @throws CheckDigitException if Character.getNumericValue(char) returns a
+ * negative number
+ */
+ @Override
+ protected int toInt(final char character, final int leftPos, final int
rightPos) throws CheckDigitException {
+ final int num = Character.getNumericValue(character);
+ if (num < 0) {
+ throw new CheckDigitException("Invalid Character[" + leftPos + "]
= '" + character + "'");
+ }
+ return num;
+ }
+
+ /**
+ * Return a string representation of this implementation.
+ *
+ * @return a string representation
+ */
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[positionWeight=" +
Arrays.toString(positionWeight) + ", useRightPos="
+ + useRightPos + ", sumWeightedDigits=" + sumWeightedDigits +
"]";
+ }
+
+ /**
+ * Calculates the <em>weighted</em> value of a character in the code at a
+ * specified position.
+ *
+ * @param charValue The numeric value of the character.
+ * @param leftPos The position of the character in the code, counting from
+ * left to right
+ * @param rightPos The position of the character in the code, counting from
+ * right to left
+ * @return The weighted value of the character.
+ */
+ @Override
+ protected int weightedValue(final int charValue, final int leftPos, final
int rightPos) {
+ final int pos = useRightPos ? rightPos : leftPos;
+ final int weight = positionWeight[(pos - 1) % positionWeight.length];
+ int weightedValue = charValue * weight;
+ if (sumWeightedDigits) {
+ weightedValue = sumDigits(weightedValue);
+ }
+ return weightedValue;
+ }
+
+}
diff --git
a/src/test/java/org/apache/commons/validator/ParameterValidatorImpl.java
b/src/test/java/org/apache/commons/validator/ParameterValidatorImpl.java
index f4808b9f..c39a562e 100644
--- a/src/test/java/org/apache/commons/validator/ParameterValidatorImpl.java
+++ b/src/test/java/org/apache/commons/validator/ParameterValidatorImpl.java
@@ -1,34 +1,34 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.validator;
-
-/**
- * Contains validation methods for different unit tests.
- */
-public class ParameterValidatorImpl {
-
- /**
- * ValidatorParameter is valid.
- */
- public static boolean validateParameter(final java.lang.Object bean, final
org.apache.commons.validator.Form form,
- final org.apache.commons.validator.Field field, final
org.apache.commons.validator.Validator validator,
- final org.apache.commons.validator.ValidatorAction action, final
org.apache.commons.validator.ValidatorResults results,
- final java.util.Locale locale) throws Exception {
-
- return true;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.validator;
+
+/**
+ * Contains validation methods for different unit tests.
+ */
+public class ParameterValidatorImpl {
+
+ /**
+ * ValidatorParameter is valid.
+ */
+ public static boolean validateParameter(final java.lang.Object bean, final
org.apache.commons.validator.Form form,
+ final org.apache.commons.validator.Field field, final
org.apache.commons.validator.Validator validator,
+ final org.apache.commons.validator.ValidatorAction action, final
org.apache.commons.validator.ValidatorResults results,
+ final java.util.Locale locale) throws Exception {
+
+ return true;
+ }
+}