Codebase list libcommons-validator-java / c20d129
New upstream version 1.6 Emmanuel Bourg 6 years ago
33 changed file(s) with 1611 addition(s) and 925 deletion(s). Raw diff Collapse all Expand all
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 language: java
16 sudo: false
17
18 jdk:
19 - openjdk7
20 - oraclejdk8
21
22 after_success:
23 - mvn clean cobertura:cobertura coveralls:report
2323
2424 export MAVEN_OPTS="-Xmx512m" # Unix
2525 set MAVEN_OPTS="-Xmx512m" # Windows
26
27 There can be problems building the site using Maven 3.0.5 or earlier;
28 if so please use a later version.
00 Apache Commons Validator
1 Copyright 2001-2016 The Apache Software Foundation
1 Copyright 2001-2017 The Apache Software Foundation
22
33 This product includes software developed at
44 The Apache Software Foundation (http://www.apache.org/).
0 Apache Apache Commons Validator
1 Version 1.5.1
2 RELEASE NOTES
0 Apache Commons Validator 1.6
1 RELEASE NOTES
32
4 The Apache Commons Validator team is pleased to announce the release of Apache Apache Commons Validator 1.5.1
3 The Apache Commons Validator team is pleased to announce the release of Apache Commons Validator 1.6
54
65 Apache Commons Validator provides the building blocks for both client side validation and server side data validation.
76 It may be used standalone or with a framework like Struts.
87
9 This is a maintenance release.
8 This is primarily a maintenance release.
109 All projects are encouraged to update to this release of Apache Commons Validator.
1110
1211 Commons Validator requires Java 1.6 or later.
13
14 IMPORTANT NOTES
12 Main enhancements =================
13 * Modulus Ten Check Digit Implementation
14 * Generic CreditCard validation (syntax and checkdigit only; does not check IIN)
15 * CreditCard validation specification by numeric range
16 IMPORTANT NOTES
1517 ===============
1618
1719 BREAKING CHANGES:
2628 Changes in this version include:
2729
2830 New features:
29 o VALIDATOR-351: DomainValidator - allow access to internal arrays
31 o VALIDATOR-415: Simplify building new CreditCard validators
32 o VALIDATOR-413: Generic CreditCard validation
33 o VALIDATOR-394: General Modulus Ten Check Digit Implementation Thanks to Niall Pemberton.
3034
3135 Fixed Bugs:
32 o VALIDATOR-392: Mastercard Series 2 BIN ranges (active from October 2016) added to CreditCardValidator
33 To disable the new ranges, use option MASTERCARD_PRE_OCT2016 or validator MASTERCARD_VALIDATOR_PRE_OCT2016 Thanks to Tim Deboer.
34 o VALIDATOR-386: org.apache.commons.validator.routines.DomainValidator.ArrayType is not public Thanks to Auke van Leeuwen.
35 o VALIDATOR-359: EmailValidator does not catch invalid email address like dora@.com Thanks to Dora Kinghorn.
36 o VALIDATOR-384: EmailValidator does not support escaped quotes in a quoted string Thanks to Kris Babic.
36 o VALIDATOR-420: Query params validator shouldn't accept whitespaces Thanks to Marcin Gasior.
37 o VALIDATOR-419: Invalid IPv6 addresses that are IPv4-mapped pass InetAddressValidator validation Thanks to Denis Iskhakov.
38 o VALIDATOR-418: UrlValidatorTest: testIsValid() does not run all tests Thanks to Robert McGuigan.
39 o VALIDATOR-379: CodeValidator unconditionally trim()s the input string - document the behaviour
40 o VALIDATOR-387: Userinfo without colon should be valid in UrlValidator Thanks to Shumpei Akai.
41 o VALIDATOR-411: UrlValidator accepts ports above max limit of 16-bit unsigned integer
42 o VALIDATOR-407: Generic .shop top level domain is considered invalid
43 o VALIDATOR-405: IBANValidator - Costa Rica entry has been updated in SWIFT docs
44 o VALIDATOR-401: IBANValidator fails for Seychelles and Ukraine
45 o VALIDATOR-391: UrlValidator.isValid throws exception for FILEURLs
46 Fixed code so it handles URLs with no authority field Thanks to Mark E. Scott, Jr. & Jason Loomis.
3747
3848 Changes:
39 o Updated to TLD list Version 2016041301, Last Updated Thu Apr 14 07:07:01 2016 UTC
49 o IANA TLD lists: Updated to Version 2017020400, Last Updated Sat Feb 4 07:07:01 2017 UTC
50 o Update to version 73 of SWIFT IBAN list: added BY (Belarus) and IQ (Iraq); fixed Santa Lucia format
4051
52
53 Historical list of changes: http://commons.apache.org/proper/commons-validator/changes-report.html
4154
4255 For complete information on Apache Commons Validator, including instructions on how to submit bug reports,
4356 patches, or suggestions for improvement, see the Apache Apache Commons Validator website:
4457
45 http://commons.apache.org/proper/commons-validator/
58 http://commons.apache.org/proper/commons-validator/
+0
-62
build.properties.sample less more
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # $Id: build.properties.sample 1237244 2012-01-29 11:23:19Z simonetripodi $
16 # $Rev: 1237244 $
17 # $Date: 2012-01-29 12:23:19 +0100 (Sun, 29 Jan 2012) $
18 # -----------------------------------------------------------------------------
19 # This is an example "build.properties" file. Make any changes you need,
20 # and rename this file to "build.properties" in the same directory that
21 # contains the "build.xml" file.
22 # -----------------------------------------------------------------------------
23 apache.dir=D:/Java/Programs/Apache
24
25
26 # The JAR file containing version 1.7.0 (or later) of the Beanutils package
27 # from the Jakarta Commons project.
28 commons-beanutils.jar=../beanutils/dist/commons-beanutils.jar
29
30 # The JAR file containing version 1.8 (or later) of the Digester package
31 # from the Jakarta Commons project.
32 commons-digester.jar=../digester/dist/commons-digester.jar
33
34 # The JAR file containing version 1.1 (or later) of the Logging package
35 # from the Jakarta Commons project.
36 commons-logging.jar=../logging/dist/commons-logging.jar
37
38 # The JAR file containing version 3.8.1 (or later) of
39 # JUnit Unit Testing (http://www.junit.org)
40 junit.jar=D:/java/Lib/junit3.8.1/junit.jar
41
42 # Needed for building the version Javadocs
43 xerces.jar=${apache.dir}/xerces-2_5_0/xercesImpl.jar
44
45 # jsdoc 1.5.2 or Newer is needed for building the Javascript Javadocs
46 jsdoc.home=/cygdrive/d/Projects/Sourceforge/JsDoc/JSDoc-1.5.2
47
48 #############################Maven Variables #######################################
49 # CVS Start Change Log date
50 maven.changelog.range=2000
51
52
53 # If you are using ssh tunneling & have a .cvspass file setup
54 cvs.developer.host=localhost
55 # Maven deploy user
56 cvs.developer.id=rleland
57
58 ######## Maven Variables located in your $HOME/build.properties ####
59 # maven.username=rleland
60 # maven.mode.online=true
61 # maven.debugOn=true
+0
-516
build.xml less more
0 <!--
1 Licensed to the Apache Software Foundation (ASF) under one or more
2 contributor license agreements. See the NOTICE file distributed with
3 this work for additional information regarding copyright ownership.
4 The ASF licenses this file to You under the Apache License, Version 2.0
5 (the "License"); you may not use this file except in compliance with
6 the License. You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 -->
16 <project name="Validator" default="dist" basedir=".">
17
18
19 <!--
20 "Validator" component of the Apache Commons Subproject
21 $Id: build.xml 1705347 2015-09-25 20:17:56Z adrianc $
22 -->
23
24
25 <!-- ========== Initialize Properties ===================================== -->
26
27
28 <property file="build.properties"/> <!-- Component local -->
29 <property file="../build.properties"/> <!-- Commons local -->
30 <property file="${user.home}/build.properties"/> <!-- User local -->
31
32
33 <!-- ========== External Dependencies ===================================== -->
34
35
36 <!-- The directories corresponding to your necessary dependencies -->
37 <property name="junit.home" value="/usr/local/junit3.8.1"/>
38 <property name="commons.home" value="../../jakarta-commons"/>
39 <property name="sandbox.home" value="../../jakarta-commons-sandbox"/>
40 <property name="beanutils.home" value="${commons.home}/beanutils"/>
41 <property name="collections.home" value="${commons.home}/collections"/>
42 <property name="digester.home" value="${commons.home}/digester"/>
43 <property name="logging.home" value="${commons.home}/logging"/>
44
45
46 <!-- ========== Derived Values ============================================ -->
47
48
49 <!-- The locations of necessary jar files -->
50 <property name="junit.jar" value="${junit.home}/junit.jar"/>
51 <property name="commons-beanutils.jar" value="${beanutils.home}/dist/commons-beanutils.jar"/>
52 <property name="commons-digester.jar" value="${digester.home}/dist/commons-digester.jar"/>
53 <property name="commons-logging.jar" value="${logging.home}/dist/commons-logging.jar"/>
54 <property name="commons-collections.jar" value="${collections.home}/dist/commons-collections.jar"/>
55
56
57 <!-- ========== Component Declarations ==================================== -->
58
59
60 <!-- The name of this component -->
61 <property name="component.name" value="validator"/>
62
63 <!-- The primary package name of this component -->
64 <property name="component.package" value="org.apache.commons.validator"/>
65
66 <!-- The title of this component -->
67 <property name="component.title" value="Commons Validator"/>
68
69 <!-- The current version number of this component -->
70 <property name="component.version" value="1.5.0-SNAPSHOT"/>
71
72 <!-- The base directory for compilation targets -->
73 <property name="build.home" value="target"/>
74
75 <!-- The base directory for component resources -->
76 <property name="resources.home" value="src/main/resources"/>
77
78 <!-- The base directory for distribution targets -->
79 <property name="dist.home" value="dist"/>
80
81 <!-- The base directory for release targets -->
82 <property name="release.home" value="release" />
83
84 <!-- The base directory for component sources -->
85 <property name="source.home" value="src/main/java"/>
86
87 <!-- The base directory for unit test sources -->
88 <property name="test.home" value="src/test"/>
89
90 <!-- The base directory for example sources -->
91 <property name="example.home" value="src/example"/>
92
93 <!-- Directory where test results are stored -->
94 <property name="test.results.dir" value="${build.home}/test-results" />
95
96 <!-- Directory where binary release files are staged -->
97 <property name="stage.bin.dir" value="${release.home}/stage/bin"/>
98
99 <!-- Directory where source release files are staged -->
100 <property name="stage.src.dir" value="${release.home}/stage/src"/>
101
102 <!-- Directory where release builds are prepared for upload -->
103 <property name="upload.dir" value="${release.home}/upload"/>
104
105 <!-- Base file name for upload files -->
106 <property name="upload.file.base" value="${component.name}-${component.version}"/>
107
108 <!-- Download lib dir -->
109 <property name="download.lib.dir" value="lib"/>
110
111 <!-- ========== Compiler Defaults ========================================= -->
112
113
114 <!-- source JDK version (should be same as maven.compile.source) -->
115 <property name="compile.source" value="1.5"/>
116
117 <!-- target JDK version (should be same as maven.compile.target) -->
118 <property name="compile.target" value="1.5"/>
119
120 <!-- Should Java compilations set the 'debug' compiler option? -->
121 <property name="compile.debug" value="true"/>
122
123 <!-- Should Java compilations set the 'deprecation' compiler option? -->
124 <property name="compile.deprecation" value="false"/>
125
126 <!-- Should Java compilations set the 'optimize' compiler option? -->
127 <property name="compile.optimize" value="true"/>
128
129 <!-- Construct compile classpath -->
130 <path id="compile.classpath">
131 <pathelement location="${build.home}/classes"/>
132 <pathelement location="${commons-beanutils.jar}"/>
133 <pathelement location="${commons-digester.jar}"/>
134 <pathelement location="${commons-logging.jar}"/>
135 <pathelement location="${commons-collections.jar}"/>
136 <path refid="downloaded.lib.classpath"/>
137 </path>
138
139 <!-- Construct compile classpath -->
140 <path id="downloaded.lib.classpath">
141 <pathelement location="${download.lib.dir}/commons-beanutils.jar"/>
142 <pathelement location="${download.lib.dir}/commons-digester.jar"/>
143 <pathelement location="${download.lib.dir}/commons-logging.jar"/>
144 <pathelement location="${download.lib.dir}/commons-collections.jar"/>
145 <pathelement location="${download.lib.dir}/junit.jar"/>
146 </path>
147
148 <!-- ========== Test Execution Defaults =================================== -->
149
150
151 <!-- Construct unit test classpath -->
152 <path id="test.classpath">
153 <pathelement location="${build.home}/classes"/>
154 <pathelement location="${build.home}/tests"/>
155 <pathelement location="${commons-beanutils.jar}"/>
156 <pathelement location="${commons-digester.jar}"/>
157 <pathelement location="${commons-logging.jar}"/>
158 <pathelement location="${commons-collections.jar}"/>
159 <pathelement location="${junit.jar}"/>
160 <pathelement location="${xerces.jar}"/>
161 <path refid="downloaded.lib.classpath"/>
162 </path>
163
164 <!-- Should all tests fail if one does? -->
165 <property name="test.failonerror" value="true"/>
166
167 <!-- ========== Example Execution Defaults ================================ -->
168
169
170 <!-- Construct example classpath -->
171 <path id="example.classpath">
172 <path refid="test.classpath"/>
173 <pathelement location="${build.home}/example" />
174 </path>
175
176
177 <!-- ========== Executable Targets ======================================== -->
178
179
180 <target name="init"
181 description="Initialize and evaluate conditionals">
182 <echo message="-------- ${component.name} ${component.version} --------"/>
183 <filter token="name" value="${component.name}"/>
184 <filter token="package" value="${component.package}"/>
185 <filter token="version" value="${component.version}"/>
186 <filter token="compilesource" value="${compile.source}"/>
187 <filter token="compiletarget" value="${compile.target}"/>
188 <available property="jsdoc.found" type="file" file="${jsdoc.home}/jsdoc.pl"/>
189 </target>
190
191
192 <target name="prepare" depends="init,download-dependencies"
193 description="Prepare build directory">
194 <mkdir dir="${build.home}"/>
195 <mkdir dir="${build.home}/classes"/>
196 <mkdir dir="${build.home}/tests"/>
197 <mkdir dir="${test.results.dir}"/>
198 </target>
199
200
201 <target name="static" depends="prepare"
202 description="Copy static files to build directory">
203 <tstamp/>
204 </target>
205
206
207 <target name="compile" depends="static"
208 description="Compile shareable components">
209 <javac srcdir="${source.home}"
210 destdir="${build.home}/classes"
211 source="${compile.source}"
212 target="${compile.target}"
213 debug="${compile.debug}"
214 deprecation="${compile.deprecation}"
215 optimize="${compile.optimize}">
216 <classpath refid="compile.classpath"/>
217 </javac>
218 <copy todir="${build.home}/classes" filtering="on">
219 <fileset dir="${source.home}"
220 excludes="**/*.java"/>
221 </copy>
222 <copy todir="${build.home}/classes">
223 <fileset dir="${resources.home}" includes="**/*.dtd,**/*.xml"/>
224 </copy>
225 </target>
226
227
228 <target name="clean"
229 description="Clean build and distribution directories">
230 <delete dir="${build.home}"/>
231 <delete dir="${dist.home}"/>
232 <delete dir="${release.home}"/>
233 </target>
234
235
236 <target name="all" depends="clean,compile"
237 description="Clean and compile all components"/>
238
239
240 <target name="javadoc.init"
241 description="Initializes Javadoc directories">
242 <mkdir dir="${dist.home}"/>
243 <mkdir dir="${dist.home}/docs"/>
244 <mkdir dir="${dist.home}/docs/apidocs"/>
245 </target>
246
247 <target name="javadoc" depends="compile"
248 description="Create component Javadoc documentation">
249 <!--javadoc sourcepath="${source.home}"
250 destdir="${dist.home}/docs/apidocs"
251 packagenames="org.apache.commons.*"
252 author="true"
253 private="true"
254 version="true"
255 doctitle="&lt;h1&gt;${component.title} (Version ${component.version})&lt;/h1&gt;"
256 windowtitle="${component.title} (Version ${component.version})"
257 bottom="Copyright (c) 2001-2004 Apache Software Foundation"
258 classpathref="compile.classpath" / -->
259 </target>
260
261
262
263 <target name="change-log" >
264 <cvschangelog destfile="changelog.xml" start="${cvs.start}" />
265 <style in="changelog.xml" out="changelog.html" style="${ant.home}/etc/changelog.xsl">
266 <param name="title" expression="Validator ChangeLog"/>
267 <param name="module" expression="commons"/>
268 <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
269 </style>
270 </target>
271
272
273
274 <target name="dist" depends="compile,javadoc"
275 description="Create binary distribution">
276 <mkdir dir="${dist.home}"/>
277
278 <copy file="LICENSE.txt"
279 todir="${dist.home}"/>
280 <copy file="NOTICE.txt"
281 todir="${dist.home}"/>
282 <copy file="RELEASE-NOTES.txt"
283 todir="${dist.home}"/>
284 <mkdir dir="${build.home}/classes/META-INF"/>
285 <copy file="LICENSE.txt"
286 tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
287 <copy file="NOTICE.txt"
288 tofile="${build.home}/classes/META-INF/NOTICE.txt"/>
289
290 <manifest file="${build.home}/MANIFEST.MF">
291 <attribute name="Specification-Title" value="${component.title}"/>
292 <attribute name="Specification-Version" value="${component.version}"/>
293 <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
294 <attribute name="Implementation-Title" value="${component.title}"/>
295 <attribute name="Implementation-Version" value="${component.version}"/>
296 <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
297 <attribute name="Implementation-Vendor-Id" value="org.apache"/>
298 <attribute name="X-Compile-Source-JDK" value="${compile.source}"/>
299 <attribute name="X-Compile-Target-JDK" value="${compile.target}"/>
300 </manifest>
301
302 <jar jarfile="${dist.home}/commons-${component.name}-${component.version}.jar"
303 basedir="${build.home}/classes"
304 manifest="${build.home}/MANIFEST.MF"/>
305 </target>
306
307 <!-- ========== Unit Test Targets ========================================= -->
308
309
310 <target name="compile.tests" depends="compile"
311 description="Compile unit test cases">
312 <javac srcdir="${test.home}/java"
313 destdir="${build.home}/tests"
314 debug="${compile.debug}"
315 deprecation="${compile.deprecation}"
316 optimize="${compile.optimize}">
317 <classpath refid="test.classpath"/>
318 </javac>
319 <copy todir="${build.home}/tests" filtering="on">
320 <fileset dir="${test.home}/resources"/>
321 </copy>
322 </target>
323
324
325 <target name="test" depends="compile.tests,test.main,test.checkdigit,test.routines"
326 description="Run all unit test cases">
327 </target>
328
329 <target name="test.main" depends="compile.tests"
330 description="Run main unit test cases">
331 <echo message="Running main tests ..."/>
332
333 <junit fork="yes" forkmode="once" printsummary="yes"
334 haltonfailure="${test.failonerror}"
335 failureproperty="main.test.failed" showoutput="true">
336 <classpath refid="test.classpath"/>
337 <formatter type="plain"/>
338 <batchtest todir="${test.results.dir}">
339 <fileset dir="${test.home}/java">
340 <include name="org/apache/commons/validator/*Test.java" />
341 <exclude name="**/Abstract*Test.java" />
342 </fileset>
343 </batchtest>
344 </junit>
345 </target>
346
347 <target name="test.checkdigit" depends="compile.tests"
348 description="Run checkdigit unit test cases">
349 <echo message="Running checkdigit tests ..."/>
350
351 <junit fork="yes" forkmode="once" printsummary="yes"
352 haltonfailure="${test.failonerror}"
353 failureproperty="main.test.failed" showoutput="true">
354 <classpath refid="test.classpath"/>
355 <formatter type="plain"/>
356 <batchtest todir="${test.results.dir}">
357 <fileset dir="${test.home}/java">
358 <include name="org/apache/commons/validator/routines/checkdigit/*Test.java" />
359 <exclude name="**/Abstract*Test.java" />
360 </fileset>
361 </batchtest>
362 </junit>
363 </target>
364
365 <target name="test.routines" depends="compile.tests"
366 description="Run routines unit test cases">
367 <echo message="Running routines tests ..."/>
368
369 <junit fork="yes" forkmode="once" printsummary="yes"
370 haltonfailure="${test.failonerror}"
371 failureproperty="main.test.failed" showoutput="true">
372 <classpath refid="test.classpath"/>
373 <formatter type="plain"/>
374 <batchtest todir="${test.results.dir}">
375 <fileset dir="${test.home}/java">
376 <include name="org/apache/commons/validator/routines/*Test.java" />
377 <exclude name="**/Abstract*Test.java" />
378 </fileset>
379 </batchtest>
380 </junit>
381 </target>
382
383 <!-- ========== Example Targets =========================================== -->
384
385
386 <target name="prepare.example" depends="compile"
387 description="Prepare example directory">
388 <mkdir dir="${build.home}/example"/>
389 </target>
390
391
392 <target name="compile.example" depends="prepare.example"
393 description="Compile example application">
394 <javac srcdir="${example.home}"
395 destdir="${build.home}/example"
396 debug="${compile.debug}"
397 deprecation="${compile.deprecation}"
398 optimize="${compile.optimize}">
399 <classpath refid="example.classpath"/>
400 </javac>
401 <copy todir="${build.home}/example" filtering="on">
402 <fileset dir="${example.home}" excludes="**/*.java"/>
403 </copy>
404 </target>
405
406
407 <target name="example" depends="compile.example,compile.tests"
408 description="Run example application">
409 <java fork="yes"
410 classname="org.apache.commons.validator.example.ValidateExample"
411 taskname="main" failonerror="true">
412 <classpath refid="example.classpath" />
413 </java>
414 </target>
415
416
417 <!-- ========== Release Targets =========================================== -->
418
419
420 <target name="release" depends="clean,dist"
421 description="Construct release distribution">
422 <mkdir dir="${stage.bin.dir}/${upload.file.base}"/>
423 <mkdir dir="${stage.src.dir}/${upload.file.base}-src"/>
424 <copy todir="${stage.bin.dir}/${upload.file.base}">
425 <fileset dir="${dist.home}"/>
426 </copy>
427 <copy todir="${stage.src.dir}/${upload.file.base}-src">
428 <fileset dir=".">
429 <exclude name="build.properties"/>
430 <exclude name="${build.home}/**"/>
431 <exclude name="${dist.home}/**"/>
432 <exclude name="${build.home}/**"/>
433 </fileset>
434 </copy>
435 <mkdir dir="${upload.dir}"/>
436 <zip zipfile="${upload.dir}/${upload.file.base}.zip"
437 basedir="${stage.bin.dir}"/>
438 <zip zipfile="${upload.dir}/${upload.file.base}-src.zip"
439 basedir="${stage.src.dir}"/>
440 <tar tarfile="${upload.dir}/${upload.file.base}.tar"
441 basedir="${stage.bin.dir}"
442 longfile="gnu"/>
443 <tar tarfile="${upload.dir}/${upload.file.base}-src.tar"
444 basedir="${stage.src.dir}"
445 longfile="gnu"/>
446 <gzip src="${upload.dir}/${upload.file.base}.tar"
447 zipfile="${upload.dir}/${upload.file.base}.tar.gz"/>
448 <gzip src="${upload.dir}/${upload.file.base}-src.tar"
449 zipfile="${upload.dir}/${upload.file.base}-src.tar.gz"/>
450 </target>
451
452
453 <!-- ========== Download Dependencies =========================================== -->
454
455 <target name="download-dependencies"
456 depends="check-availability" unless="skip.download">
457 <echo message="doing download-dependencies..." />
458 <antcall target="download-beanutils" />
459 <antcall target="download-digester" />
460 <antcall target="download-logging" />
461 <antcall target="download-collections" />
462 <antcall target="download-junit" />
463 </target>
464
465 <target name="check-availability">
466 <echo message="doing check-availability..." />
467 <available file="${commons-beanutils.jar}" property="beanutils.found"/>
468 <available file="${commons-digester.jar}" property="digester.found"/>
469 <available file="${commons-logging.jar}" property="logging.found"/>
470 <available file="${commons-collections.jar}" property="collections.found"/>
471 <available file="${junit.jar}" property="junit.found"/>
472 </target>
473
474 <target name="download-beanutils" unless="beanutils.found">
475 <echo message="Downloading beanutils..."/>
476 <mkdir dir="${download.lib.dir}" />
477 <get dest="${download.lib.dir}/commons-beanutils.jar"
478 usetimestamp="true" ignoreerrors="true"
479 src="http://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar"/>
480 </target>
481
482 <target name="download-digester" unless="digester.found">
483 <echo message="Downloading digester..."/>
484 <mkdir dir="${download.lib.dir}" />
485 <get dest="${download.lib.dir}/commons-digester.jar"
486 usetimestamp="true" ignoreerrors="true"
487 src="http://repo.maven.apache.org/maven2/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar"/>
488 </target>
489
490 <target name="download-logging" unless="logging.found">
491 <echo message="Downloading logging..."/>
492 <mkdir dir="${download.lib.dir}" />
493 <get dest="${download.lib.dir}/commons-logging.jar"
494 usetimestamp="true" ignoreerrors="true"
495 src="http://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar"/>
496 </target>
497
498 <target name="download-collections" unless="collections.found">
499 <echo message="Downloading collections..."/>
500 <mkdir dir="${download.lib.dir}" />
501 <get dest="${download.lib.dir}/commons-collections.jar"
502 usetimestamp="true" ignoreerrors="true"
503 src="http://repo.maven.apache.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar"/>
504 </target>
505
506 <target name="download-junit" unless="junit.found">
507 <echo message="Downloading junit..."/>
508 <mkdir dir="${download.lib.dir}" />
509 <get dest="${download.lib.dir}/junit.jar"
510 usetimestamp="true" ignoreerrors="true"
511 src="http://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar"/>
512 </target>
513
514 </project>
515
+0
-41
etc/jsdoc.bat less more
0 @echo off
1
2 rem * $Id: jsdoc.bat 1608569 2014-07-07 19:28:41Z britter $
3 rem * ====================================================================
4 rem *
5 rem * Licensed to the Apache Software Foundation (ASF) under one or more
6 rem * contributor license agreements. See the NOTICE file distributed with
7 rem * this work for additional information regarding copyright ownership.
8 rem * The ASF licenses this file to You under the Apache License, Version 2.0
9 rem * (the "License"); you may not use this file except in compliance with
10 rem * the License. You may obtain a copy of the License at
11 rem *
12 rem * http://www.apache.org/licenses/LICENSE-2.0
13 rem *
14 rem * Unless required by applicable law or agreed to in writing, software
15 rem * distributed under the License is distributed on an "AS IS" BASIS,
16 rem * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 rem * See the License for the specific language governing permissions and
18 rem * limitations under the License.
19
20 rem *--------------------------------------------------------------*
21 rem * *
22 rem * JSDoc is a perl script for generating javadoc for javascript.*
23 rem * *
24 rem * The latest version can be downloaded from : *
25 rem * *
26 rem * http://sourceforge.net/projects/jsdoc/ *
27 rem * *
28 rem * N.B. You also need something like ActivePerl installed to *
29 rem * run this on windows. See the Installation instructions: *
30 rem * *
31 rem * http://jsdoc.sourceforge.net/#install *
32 rem * *
33 rem *--------------------------------------------------------------*
34
35 set _PACKAGE=/org/apache/commons/validator/javascript
36 set _JSDOC_HOME=%1
37 set _JAVASCRIPT_DIR=%2%_PACKAGE%
38 set _OUTPUT_DIR=%3%_PACKAGE%
39 set _COPYRIGHT="Copyright © 2000-2014 - Apache Software Foundation"
40 perl %_JSDOC_HOME%/jsdoc.pl --project-summary %_JAVASCRIPT_DIR%/package.html --project-name "Package %_PACKAGE%" --page-footer %_COPYRIGHT% -d %_OUTPUT_DIR% %_JAVASCRIPT_DIR%
+0
-32
etc/jsdoc.sh less more
0 #!/bin/sh
1 # $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//validator/etc/jsdoc.sh,v 1.4 2004/05/21 14:28:12 rleland Exp $
2 # $Revision: 1608569 $
3 # $Date: 2014-07-07 21:28:41 +0200 (Mon, 07 Jul 2014) $
4 #
5 # ====================================================================
6 # Licensed to the Apache Software Foundation (ASF) under one or more
7 # contributor license agreements. See the NOTICE file distributed with
8 # this work for additional information regarding copyright ownership.
9 # The ASF licenses this file to You under the Apache License, Version 2.0
10 # (the "License"); you may not use this file except in compliance with
11 # the License. You may obtain a copy of the License at
12 #
13 # http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 #
21
22 # jsdoc is a perl script for generating javadoc for javascript.
23 # The latest version can be downloaded from :
24 # http://sourceforge.net/projects/jsdoc/
25 #
26
27 dirtoprocess=$2
28 outputto=$3
29 package=/org/apache/commons/validator/javascript
30 perl $1/jsdoc.pl --project-summary ${dirtoprocess}${package}/package.html --project-name "Package org.apache.commons.validator.javascript" --page-footer "Copyright © 2000-2014 - Apache Software Foundation
31 " -d ${outputto}/${package} -r $dirtoprocess
1919 <parent>
2020 <groupId>org.apache.commons</groupId>
2121 <artifactId>commons-parent</artifactId>
22 <version>39</version>
22 <version>42</version>
2323 </parent>
2424 <modelVersion>4.0.0</modelVersion>
2525 <groupId>commons-validator</groupId>
2626 <artifactId>commons-validator</artifactId>
27 <version>1.5.1</version>
27 <version>1.6</version>
2828 <name>Apache Commons Validator</name>
2929 <description>
3030 Apache Commons Validator provides the building blocks for both client side validation and server side data validation.
123123 </contributors>
124124
125125 <scm>
126 <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/validator/tags/VALIDATOR_1_5_1</connection>
127 <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/validator/tags/VALIDATOR_1_5_1</developerConnection>
128 <url>http://svn.apache.org/viewvc/commons/proper/validator/tags/VALIDATOR_1_5_1</url>
126 <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/validator/tags/VALIDATOR_1_6/</connection>
127 <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/validator/tags/VALIDATOR_1_6/</developerConnection>
128 <url>http://svn.apache.org/viewvc/commons/proper/validator/tags/VALIDATOR_1_6/</url>
129129 </scm>
130130
131131 <distributionManagement>
139139 <properties>
140140 <commons.componentid>validator</commons.componentid>
141141 <!-- Re-generate the download page using: mvn commons:download-page -->
142 <commons.release.version>1.5.1</commons.release.version>
143 <commons.rc.version>RC2</commons.rc.version>
142 <commons.release.version>1.6</commons.release.version>
143 <commons.rc.version>RC1</commons.rc.version>
144144 <commons.release.desc>(requires JDK ${maven.compiler.target})</commons.release.desc>
145 <commons.release.2.version>1.4.1</commons.release.2.version>
146 <commons.release.2.desc>(requires JDK 1.4)</commons.release.2.desc>
147 <commons.release.2.binary.suffix />
148145 <commons.jira.id>VALIDATOR</commons.jira.id>
149146 <commons.jira.pid>12310494</commons.jira.pid>
150147 <commons.encoding>UTF-8</commons.encoding>
284281 </plugin>
285282 <plugin>
286283 <artifactId>maven-pmd-plugin</artifactId>
287 <version>3.5</version>
284 <version>3.7</version>
288285 <configuration>
289286 <targetJdk>${maven.compiler.target}</targetJdk>
290287 </configuration>
300297 <plugin>
301298 <groupId>org.codehaus.mojo</groupId>
302299 <artifactId>findbugs-maven-plugin</artifactId>
303 <version>3.0.2</version>
300 <version>3.0.4</version>
304301 <configuration>
305302 <threshold>Normal</threshold>
306303 <effort>Default</effort>
6363 -->
6464
6565 <body>
66 <release version="1.5.1" date="2016-??-??" description="
66 <release version="1.6" date="2017-02-20" description="
67 This is primarily a maintenance release.
68
69 All projects are encouraged to update to this release of
70 Apache Commons Validator.
71
72 Commons Validator requires Java 1.6 or later.
73
74 Main enhancements
75 =================
76
77 * Modulus Ten Check Digit Implementation
78
79 * Generic CreditCard validation (syntax and checkdigit only; does not check IIN)
80
81 * CreditCard validation specification by numeric range
82
83 IMPORTANT NOTES
84 ===============
85
86
87 BREAKING CHANGES:
88
89 * NONE.
90
91
92 DEPENDENCIES
93 ============
94
95 The dependencies for Validator have not changed since the 1.4 release.
96
97 For the current list of dependencies, please see
98 http://commons.apache.org/validator/dependencies.html
99 ">
100 <action issue="VALIDATOR-420" type="fix" dev="sebb" due-to="Marcin Gasior">
101 Query params validator shouldn't accept whitespaces
102 </action>
103 <action issue="VALIDATOR-419" type="fix" dev="sebb" due-to="Denis Iskhakov">
104 Invalid IPv6 addresses that are IPv4-mapped pass InetAddressValidator validation
105 </action>
106 <action issue="VALIDATOR-418" type="fix" dev="britter" due-to="Robert McGuigan">
107 UrlValidatorTest: testIsValid() does not run all tests
108 </action>
109 <action issue="VALIDATOR-415" type="add" dev="sebb">
110 Simplify building new CreditCard validators
111 </action>
112 <action issue="VALIDATOR-413" type="add" dev="sebb">
113 Generic CreditCard validation
114 </action>
115 <action issue="VALIDATOR-379" type="fix" dev="sebb">
116 CodeValidator unconditionally trim()s the input string - document the behaviour
117 </action>
118 <action issue="VALIDATOR-387" type="fix" dev="sebb" due-to="Shumpei Akai">
119 Userinfo without colon should be valid in UrlValidator
120 </action>
121 <action issue="VALIDATOR-394" type="add" dev="sebb" due-to="Niall Pemberton">
122 General Modulus Ten Check Digit Implementation
123 </action>
124 <action issue="VALIDATOR-411" type="fix" dev="sebb">
125 UrlValidator accepts ports above max limit of 16-bit unsigned integer
126 </action>
127 <action type="update" dev="sebb">
128 IANA TLD lists: Updated to Version 2017020400, Last Updated Sat Feb 4 07:07:01 2017 UTC
129 </action>
130 <action type="update" dev="sebb">
131 Update to version 73 of SWIFT IBAN list: added BY (Belarus) and IQ (Iraq); fixed Santa Lucia format
132 </action>
133 <action issue="VALIDATOR-407" type="fix" dev="sebb">
134 Generic .shop top level domain is considered invalid
135 </action>
136 <action issue="VALIDATOR-405" type="fix" dev="sebb">
137 IBANValidator - Costa Rica entry has been updated in SWIFT docs
138 </action>
139 <action issue="VALIDATOR-401" type="fix" dev="britter">
140 IBANValidator fails for Seychelles and Ukraine
141 </action>
142 <action issue="VALIDATOR-391" type="fix" dev="sebb" due-to="Mark E. Scott, Jr. &amp; Jason Loomis">
143 UrlValidator.isValid throws exception for FILEURLs
144 Fixed code so it handles URLs with no authority field
145 </action>
146 </release>
147 <release version="1.5.1" date="2016-04-30" description="
67148 This is a maintenance release.
68149
69150 All projects are encouraged to update to this release of
1313 ## KIND, either express or implied. See the License for the
1414 ## specific language governing permissions and limitations
1515 ## under the License.
16 Apache ${project.name}
17 Version ${version}
18 RELEASE NOTES
16 ##
17 ${project.name} ${version}
18 RELEASE NOTES
1919
20 The ${developmentTeam} is pleased to announce the release of Apache ${project.name} ${version}
20 The ${developmentTeam} is pleased to announce the release of ${project.name} ${version}
2121
2222 $introduction.replaceAll("(?<!\015)\012", "
2323 ").replaceAll("(?m)^ +","")
2424
2525 ## N.B. the available variables are described here:
2626 ## http://maven.apache.org/plugins/maven-changes-plugin/examples/using-a-custom-announcement-template.html
27 ##
2728 ## Hack to improve layout: replace all pairs of spaces with a single new-line
2829 $release.description.replaceAll(" ", "
2930 ")
4344 ## Use replaceAll to fix up LF-only line ends on Windows.
4445 #set($action=$actionItem.getAction().replaceAll("\n","
4546 "))
47 ## Replace &lt; with < so can embed tag markup
48 #set($action=$action.replaceAll("&lt;","<"))
49 ## use an empty date to mean don't format the entry
50 ## TODO how to enable leading spaces without compromising html report
51 ## unfortunately leading spaces are trimmed even from CDATA sections
52 #if ($actionItem.getDate() && $actionItem.getDate().length()==0)
53 $action
54 #else
4655 ## Fix up indentation for multi-line action descriptions
4756 #set($action=$action.replaceAll("(?m)^ +",$indent2))
4857 #if ($actionItem.getIssue())
6069 #set($dueto="")
6170 #end
6271 o $issue ${action}$dueto
72 #end
6373 #set($action="")
6474 #set($issue="")
6575 #set($dueto="")
7585 #foreach($actionItem in $release.getActions('add'))
7686 #processaction()
7787 #end
88
7889 #end
79
90 ##
8091 #if ($release.getActions('fix').size() !=0)
8192 Fixed Bugs:
8293 #foreach($actionItem in $release.getActions('fix'))
8394 #processaction()
8495 #end
96
8597 #end
86
98 ##
8799 #if ($release.getActions('update').size() !=0)
88100 Changes:
89101 #foreach($actionItem in $release.getActions('update'))
90102 #processaction()
91103 #end
104
92105 #end
93
106 ##
94107 #if ($release.getActions('remove').size() !=0)
95108 Removed:
96109 #foreach($actionItem in $release.getActions('remove'))
100113 ## End of main loop
101114 #end
102115
116 Historical list of changes: ${project.url}changes-report.html
117
103118 For complete information on ${project.name}, including instructions on how to submit bug reports,
104119 patches, or suggestions for improvement, see the Apache ${project.name} website:
105120
106 ${project.url}
121 ${project.url}
6363 * <br>
6464 * Or just avoid using parentheses except for the parts you want to capture
6565 *
66 * @version $Revision: 1739011 $
66 * @version $Revision: 1781789 $
6767 * @since Validator 1.4
6868 */
6969 public final class CodeValidator implements Serializable {
217217 /**
218218 * Validate the code returning either <code>true</code>
219219 * or <code>false</code>.
220 * <p>
221 * This calls {@link #validate(String)} and returns false
222 * if the return value is null, true otherwise.
223 * <p>
224 * Note that {@link #validate(String)} trims the input
225 * and if there is a {@link RegexValidator} it may also
226 * change the input as part of the validation.
220227 *
221228 * @param input The code to validate
222229 * @return <code>true</code> if valid, otherwise
229236 /**
230237 * Validate the code returning either the valid code or
231238 * <code>null</code> if invalid.
239 * <p>
240 * Note that this method trims the input
241 * and if there is a {@link RegexValidator} it may also
242 * change the input as part of the validation.
232243 *
233244 * @param input The code to validate
234245 * @return The code if valid, otherwise <code>null</code>
3737 *
3838 * <p>
3939 * configures the validator to only pass American Express and Visa cards.
40 * If a card type is not directly supported by this class, you can implement
41 * the CreditCardType interface and pass an instance into the
42 * <code>addAllowedCardType</code> method.
40 * If a card type is not directly supported by this class, you can create an
41 * instance of the {@link CodeValidator} class and pass it to a {@link CreditCardValidator}
42 * constructor along with any existing validators. For example:
4343 * </p>
4444 *
45 * <pre>
46 * <code>CreditCardValidator ccv = new CreditCardValidator(
47 * new CodeValidator[] {
48 * CreditCardValidator.AMEX_VALIDATOR,
49 * CreditCardValidator.VISA_VALIDATOR,
50 * new CodeValidator("^(4)(\\d{12,18})$", LUHN_VALIDATOR) // add VPAY
51 * };</code>
52 * </pre>
53 *
4554 * <p>
46 * For a similar implementation in Perl, reference Sean M. Burke's
47 * <a href="http://www.speech.cs.cmu.edu/~sburke/pub/luhn_lib.html">script</a>.
55 * Alternatively you can define a validator using the {@link CreditCardRange} class.
56 * For example:
57 * </p>
58 *
59 * <pre>
60 * <code>CreditCardValidator ccv = new CreditCardValidator(
61 * new CreditCardRange[]{
62 * new CreditCardRange("300", "305", 14, 14), // Diners
63 * new CreditCardRange("3095", null, 14, 14), // Diners
64 * new CreditCardRange("36", null, 14, 14), // Diners
65 * new CreditCardRange("38", "39", 14, 14), // Diners
66 * new CreditCardRange("4", null, new int[] {13, 16}), // VISA
67 * }
68 * );
69 * </code>
70 * </pre>
71 * <p>
72 * This can be combined with a list of {@code CodeValidator}s
73 * </p>
74 * <p>
4875 * More information can be found in Michael Gilleland's essay
4976 * <a href="http://web.archive.org/web/20120614072656/http://www.merriampark.com/anatomycc.htm">Anatomy of Credit Card Numbers</a>.
5077 * </p>
5178 *
52 * @version $Revision: 1739207 $
79 * @version $Revision: 1782740 $
5380 * @since Validator 1.4
5481 */
5582 public class CreditCardValidator implements Serializable {
5683
5784 private static final long serialVersionUID = 5955978921148959496L;
85
86 private static final int MIN_CC_LENGTH = 12; // minimum allowed length
87
88 private static final int MAX_CC_LENGTH = 19; // maximum allowed length
89
90 /**
91 * Class that represents a credit card range.
92 * @since 1.6
93 */
94 public static class CreditCardRange {
95 final String low; // e.g. 34 or 644
96 final String high; // e.g. 34 or 65
97 final int minLen; // e.g. 16 or -1
98 final int maxLen; // e.g. 19 or -1
99 final int lengths[]; // e.g. 16,18,19
100
101 /**
102 * Create a credit card range specifier for use in validation
103 * of the number syntax including the IIN range.
104 * <p>
105 * The low and high parameters may be shorter than the length
106 * of an IIN (currently 6 digits) in which case subsequent digits
107 * are ignored and may range from 0-9.
108 * <br>
109 * The low and high parameters may be different lengths.
110 * e.g. Discover "644" and "65".
111 * </p>
112 * @param low the low digits of the IIN range
113 * @param high the high digits of the IIN range
114 * @param minLen the minimum length of the entire number
115 * @param maxLen the maximum length of the entire number
116 */
117 public CreditCardRange(String low, String high, int minLen, int maxLen) {
118 this.low = low;
119 this.high = high;
120 this.minLen = minLen;
121 this.maxLen = maxLen;
122 this.lengths = null;
123 }
124
125 /**
126 * Create a credit card range specifier for use in validation
127 * of the number syntax including the IIN range.
128 * <p>
129 * The low and high parameters may be shorter than the length
130 * of an IIN (currently 6 digits) in which case subsequent digits
131 * are ignored and may range from 0-9.
132 * <br>
133 * The low and high parameters may be different lengths.
134 * e.g. Discover "644" and "65".
135 * </p>
136 * @param low the low digits of the IIN range
137 * @param high the high digits of the IIN range
138 * @param lengths array of valid lengths
139 */
140 public CreditCardRange(String low, String high, int [] lengths) {
141 this.low = low;
142 this.high = high;
143 this.minLen = -1;
144 this.maxLen = -1;
145 this.lengths = lengths.clone();
146 }
147 }
58148
59149 /**
60150 * Option specifying that no cards are allowed. This is useful if
120210 */
121211 private static final CheckDigit LUHN_VALIDATOR = LuhnCheckDigit.LUHN_CHECK_DIGIT;
122212
123 /** American Express (Amex) Card Validator */
213 /**
214 * American Express (Amex) Card Validator
215 * <p>
216 * 34xxxx (15) <br>
217 * 37xxxx (15) <br>
218 */
124219 public static final CodeValidator AMEX_VALIDATOR = new CodeValidator("^(3[47]\\d{13})$", LUHN_VALIDATOR);
125220
126 /** Diners Card Validator */
221 /**
222 * Diners Card Validator
223 * <p>
224 * 300xxx - 305xxx (14) <br>
225 * 3095xx (14) <br>
226 * 36xxxx (14) <br>
227 * 38xxxx (14) <br>
228 * 39xxxx (14) <br>
229 */
127230 public static final CodeValidator DINERS_VALIDATOR = new CodeValidator("^(30[0-5]\\d{11}|3095\\d{10}|36\\d{12}|3[8-9]\\d{12})$", LUHN_VALIDATOR);
128231
129 /** Discover Card regular expressions */
232 /**
233 * Discover Card regular expressions
234 * <p>
235 * 6011xx (16) <br>
236 * 644xxx - 65xxxx (16) <br>
237 */
130238 private static final RegexValidator DISCOVER_REGEX = new RegexValidator(new String[] {"^(6011\\d{12})$", "^(64[4-9]\\d{13})$", "^(65\\d{14})$"});
131239
132240 /** Discover Card Validator */
133241 public static final CodeValidator DISCOVER_VALIDATOR = new CodeValidator(DISCOVER_REGEX, LUHN_VALIDATOR);
134242
135 /** Mastercard regular expressions */
243 /**
244 * Mastercard regular expressions
245 * <p>
246 * 2221xx - 2720xx (16) <br>
247 * 51xxx - 55xxx (16) <br>
248 */
136249 private static final RegexValidator MASTERCARD_REGEX = new RegexValidator(
137250 new String[] {
138251 "^(5[1-5]\\d{14})$", // 51 - 55 (pre Oct 2016)
155268 @Deprecated
156269 public static final CodeValidator MASTERCARD_VALIDATOR_PRE_OCT2016 = new CodeValidator("^(5[1-5]\\d{14})$", LUHN_VALIDATOR);
157270
158 /** Visa Card Validator */
271 /**
272 * Visa Card Validator
273 * <p>
274 * 4xxxxx (13 or 16)
275 */
159276 public static final CodeValidator VISA_VALIDATOR = new CodeValidator("^(4)(\\d{12}|\\d{15})$", LUHN_VALIDATOR);
160277
161 /** VPay (Visa) Card Validator
278 /** VPay (Visa) Card Validator
279 * <p>
280 * 4xxxxx (13-19)
162281 * @since 1.5.0
163282 */
164283 public static final CodeValidator VPAY_VALIDATOR = new CodeValidator("^(4)(\\d{12,18})$", LUHN_VALIDATOR);
219338 throw new IllegalArgumentException("Card validators are missing");
220339 }
221340 Collections.addAll(cardTypes, creditCardValidators);
341 }
342
343 /**
344 * Create a new CreditCardValidator with the specified {@link CreditCardRange}s.
345 * @param creditCardRanges Set of valid code validators
346 * @since 1.6
347 */
348 public CreditCardValidator(CreditCardRange[] creditCardRanges) {
349 if (creditCardRanges == null) {
350 throw new IllegalArgumentException("Card ranges are missing");
351 }
352 Collections.addAll(cardTypes, createRangeValidator(creditCardRanges, LUHN_VALIDATOR));
353 }
354
355 /**
356 * Create a new CreditCardValidator with the specified {@link CodeValidator}s
357 * and {@link CreditCardRange}s.
358 * <p>
359 * This can be used to combine predefined validators such as {@link #MASTERCARD_VALIDATOR}
360 * with additional validators using the simpler {@link CreditCardRange}s.
361 * @param creditCardValidators Set of valid code validators
362 * @param creditCardRanges Set of valid code validators
363 * @since 1.6
364 */
365 public CreditCardValidator(CodeValidator[] creditCardValidators, CreditCardRange[] creditCardRanges) {
366 if (creditCardValidators == null) {
367 throw new IllegalArgumentException("Card validators are missing");
368 }
369 if (creditCardRanges == null) {
370 throw new IllegalArgumentException("Card ranges are missing");
371 }
372 Collections.addAll(cardTypes, creditCardValidators);
373 Collections.addAll(cardTypes, createRangeValidator(creditCardRanges, LUHN_VALIDATOR));
374 }
375
376 /**
377 * Create a new generic CreditCardValidator which validates the syntax and check digit only.
378 * Does not check the Issuer Identification Number (IIN)
379 *
380 * @param minLen minimum allowed length
381 * @param maxLen maximum allowed length
382 * @return the validator
383 * @since 1.6
384 */
385 public static CreditCardValidator genericCreditCardValidator(int minLen, int maxLen) {
386 return new CreditCardValidator(new CodeValidator[] {new CodeValidator("(\\d+)", minLen, maxLen, LUHN_VALIDATOR)});
387 }
388
389 /**
390 * Create a new generic CreditCardValidator which validates the syntax and check digit only.
391 * Does not check the Issuer Identification Number (IIN)
392 *
393 * @param length exact length
394 * @return the validator
395 * @since 1.6
396 */
397 public static CreditCardValidator genericCreditCardValidator(int length) {
398 return genericCreditCardValidator(length, length);
399 }
400
401 /**
402 * Create a new generic CreditCardValidator which validates the syntax and check digit only.
403 * Does not check the Issuer Identification Number (IIN)
404 *
405 * @return the validator
406 * @since 1.6
407 */
408 public static CreditCardValidator genericCreditCardValidator() {
409 return genericCreditCardValidator(MIN_CC_LENGTH, MAX_CC_LENGTH);
222410 }
223411
224412 /**
258446 return null;
259447
260448 }
449
450 // package protected for unit test access
451 static boolean validLength(int valueLength, CreditCardRange range) {
452 if (range.lengths != null) {
453 for(int length : range.lengths) {
454 if (valueLength == length) {
455 return true;
456 }
457 }
458 return false;
459 }
460 return valueLength >= range.minLen && valueLength <= range.maxLen;
461 }
462
463 // package protected for unit test access
464 static CodeValidator createRangeValidator(final CreditCardRange[] creditCardRanges, final CheckDigit digitCheck ) {
465 return new CodeValidator(
466 // must be numeric (rest of validation is done later)
467 new RegexValidator("(\\d+)") {
468 private static final long serialVersionUID = 1L;
469 private CreditCardRange[] ccr = creditCardRanges.clone();
470 @Override
471 // must return full string
472 public String validate(String value) {
473 if (super.match(value) != null) {
474 int length = value.length();
475 for(CreditCardRange range : ccr) {
476 if (validLength(length, range)) {
477 if (range.high == null) { // single prefix only
478 if (value.startsWith(range.low)) {
479 return value;
480 }
481 } else if (range.low.compareTo(value) <= 0 // no need to trim value here
482 &&
483 // here we have to ignore digits beyond the prefix
484 range.high.compareTo(value.substring(0, range.high.length())) >= 0) {
485 return value;
486 }
487 }
488 }
489 }
490 return null;
491 }
492 @Override
493 public boolean isValid(String value) {
494 return validate(value) != null;
495 }
496 @Override
497 public String[] match(String value) {
498 return new String[]{validate(value)};
499 }
500 }, digitCheck);
501 }
502
261503 /**
262504 * Tests whether the given flag is on. If the flag is not a power of 2
263505 * (ie. 3) this tests whether the combination of flags is on.
5757 * {@link java.net.InetAddress} for that functionality.)
5858 * </p>
5959 *
60 * @version $Revision: 1740822 $
60 * @version $Revision: 1781829 $
6161 * @since Validator 1.4
6262 */
6363 public class DomainValidator implements Serializable {
282282
283283 // WARNING: this array MUST be sorted, otherwise it cannot be searched reliably using binary search
284284 private static final String[] GENERIC_TLDS = new String[] {
285 // Taken from Version 2016042500, Last Updated Mon Apr 25 07:07:01 2016 UTC
285 // Taken from Version 2017020400, Last Updated Sat Feb 4 07:07:01 2017 UTC
286286 "aaa", // aaa American Automobile Association, Inc.
287287 "aarp", // aarp AARP
288 "abarth", // abarth Fiat Chrysler Automobiles N.V.
288289 "abb", // abb ABB Ltd
289290 "abbott", // abbott Abbott Laboratories, Inc.
290291 "abbvie", // abbvie AbbVie Inc.
292 "abc", // abc Disney Enterprises, Inc.
293 "able", // able Able Inc.
291294 "abogado", // abogado Top Level Domain Holdings Limited
292295 "abudhabi", // abudhabi Abu Dhabi Systems and Information Centre
293296 "academy", // academy Half Oaks, LLC
302305 "adult", // adult ICM Registry AD LLC
303306 "aeg", // aeg Aktiebolaget Electrolux
304307 "aero", // aero Societe Internationale de Telecommunications Aeronautique (SITA INC USA)
308 "aetna", // aetna Aetna Life Insurance Company
309 "afamilycompany", // afamilycompany Johnson Shareholdings, Inc.
305310 "afl", // afl Australian Football League
306311 "agakhan", // agakhan Fondation Aga Khan (Aga Khan Foundation)
307312 "agency", // agency Steel Falls, LLC
308313 "aig", // aig American International Group, Inc.
314 "aigo", // aigo aigo Digital Technology Co,Ltd.
315 "airbus", // airbus Airbus S.A.S.
309316 "airforce", // airforce United TLD Holdco Ltd.
310317 "airtel", // airtel Bharti Airtel Limited
311318 "akdn", // akdn Fondation Aga Khan (Aga Khan Foundation)
319 "alfaromeo", // alfaromeo Fiat Chrysler Automobiles N.V.
312320 "alibaba", // alibaba Alibaba Group Holding Limited
313321 "alipay", // alipay Alibaba Group Holding Limited
314322 "allfinanz", // allfinanz Allfinanz Deutsche Vermögensberatung Aktiengesellschaft
323 "allstate", // allstate Allstate Fire and Casualty Insurance Company
315324 "ally", // ally Ally Financial Inc.
316325 "alsace", // alsace REGION D ALSACE
326 "alstom", // alstom ALSTOM
327 "americanexpress", // americanexpress American Express Travel Related Services Company, Inc.
328 "americanfamily", // americanfamily AmFam, Inc.
329 "amex", // amex American Express Travel Related Services Company, Inc.
330 "amfam", // amfam AmFam, Inc.
317331 "amica", // amica Amica Mutual Insurance Company
318332 "amsterdam", // amsterdam Gemeente Amsterdam
319333 "analytics", // analytics Campus IP LLC
320334 "android", // android Charleston Road Registry Inc.
321335 "anquan", // anquan QIHOO 360 TECHNOLOGY CO. LTD.
336 "anz", // anz Australia and New Zealand Banking Group Limited
337 "aol", // aol AOL Inc.
322338 "apartments", // apartments June Maple, LLC
323339 "app", // app Charleston Road Registry Inc.
324340 "apple", // apple Apple Inc.
326342 "aramco", // aramco Aramco Services Company
327343 "archi", // archi STARTING DOT LIMITED
328344 "army", // army United TLD Holdco Ltd.
345 "art", // art UK Creative Ideas Limited
329346 "arte", // arte Association Relative à la Télévision Européenne G.E.I.E.
347 "asda", // asda Wal-Mart Stores, Inc.
330348 "asia", // asia DotAsia Organisation Ltd.
331349 "associates", // associates Baxter Hill, LLC
350 "athleta", // athleta The Gap, Inc.
332351 "attorney", // attorney United TLD Holdco, Ltd
333352 "auction", // auction United TLD HoldCo, Ltd.
334353 "audi", // audi AUDI Aktiengesellschaft
354 "audible", // audible Amazon Registry Services, Inc.
335355 "audio", // audio Uniregistry, Corp.
356 "auspost", // auspost Australian Postal Corporation
336357 "author", // author Amazon Registry Services, Inc.
337358 "auto", // auto Uniregistry, Corp.
338359 "autos", // autos DERAutos, LLC
342363 "azure", // azure Microsoft Corporation
343364 "baby", // baby Johnson &amp; Johnson Services, Inc.
344365 "baidu", // baidu Baidu, Inc.
366 "banamex", // banamex Citigroup Inc.
367 "bananarepublic", // bananarepublic The Gap, Inc.
345368 "band", // band United TLD Holdco, Ltd
346369 "bank", // bank fTLD Registry Services, LLC
347370 "bar", // bar Punto 2012 Sociedad Anonima Promotora de Inversion de Capital Variable
350373 "barclays", // barclays Barclays Bank PLC
351374 "barefoot", // barefoot Gallo Vineyards, Inc.
352375 "bargains", // bargains Half Hallow, LLC
376 "baseball", // baseball MLB Advanced Media DH, LLC
377 "basketball", // basketball Fédération Internationale de Basketball (FIBA)
353378 "bauhaus", // bauhaus Werkhaus GmbH
354379 "bayern", // bayern Bayern Connect GmbH
355380 "bbc", // bbc British Broadcasting Corporation
381 "bbt", // bbt BB&amp;T Corporation
356382 "bbva", // bbva BANCO BILBAO VIZCAYA ARGENTARIA, S.A.
357383 "bcg", // bcg The Boston Consulting Group, Inc.
358384 "bcn", // bcn Municipi de Barcelona
359385 "beats", // beats Beats Electronics, LLC
386 "beauty", // beauty L&#39;Oréal
360387 "beer", // beer Top Level Domain Holdings Limited
361388 "bentley", // bentley Bentley Motors Limited
362389 "berlin", // berlin dotBERLIN GmbH &amp; Co. KG
363390 "best", // best BestTLD Pty Ltd
391 "bestbuy", // bestbuy BBY Solutions, Inc.
364392 "bet", // bet Afilias plc
365393 "bharti", // bharti Bharti Enterprises (Holding) Private Limited
366394 "bible", // bible American Bible Society
372400 "biz", // biz Neustar, Inc.
373401 "black", // black Afilias Limited
374402 "blackfriday", // blackfriday Uniregistry, Corp.
403 "blanco", // blanco BLANCO GmbH + Co KG
404 "blockbuster", // blockbuster Dish DBS Corporation
405 "blog", // blog Knock Knock WHOIS There, LLC
375406 "bloomberg", // bloomberg Bloomberg IP Holdings LLC
376407 "blue", // blue Afilias Limited
377408 "bms", // bms Bristol-Myers Squibb Company
380411 "bnpparibas", // bnpparibas BNP Paribas
381412 "boats", // boats DERBoats, LLC
382413 "boehringer", // boehringer Boehringer Ingelheim International GmbH
414 "bofa", // bofa NMS Services, Inc.
383415 "bom", // bom Núcleo de Informação e Coordenação do Ponto BR - NIC.br
384416 "bond", // bond Bond University Limited
385417 "boo", // boo Charleston Road Registry Inc.
386418 "book", // book Amazon Registry Services, Inc.
419 "booking", // booking Booking.com B.V.
387420 "boots", // boots THE BOOTS COMPANY PLC
388421 "bosch", // bosch Robert Bosch GMBH
389422 "bostik", // bostik Bostik SA
423 "boston", // boston Boston TLD Management, LLC
390424 "bot", // bot Amazon Registry Services, Inc.
391425 "boutique", // boutique Over Galley, LLC
426 "box", // box NS1 Limited
392427 "bradesco", // bradesco Banco Bradesco S.A.
393428 "bridgestone", // bridgestone Bridgestone Corporation
394429 "broadway", // broadway Celebrate Broadway, Inc.
407442 "cafe", // cafe Pioneer Canyon, LLC
408443 "cal", // cal Charleston Road Registry Inc.
409444 "call", // call Amazon Registry Services, Inc.
445 "calvinklein", // calvinklein PVH gTLD Holdings LLC
446 "cam", // cam AC Webconnecting Holding B.V.
410447 "camera", // camera Atomic Maple, LLC
411448 "camp", // camp Delta Dynamite, LLC
412449 "cancerresearch", // cancerresearch Australian Cancer Research Foundation
413450 "canon", // canon Canon Inc.
414451 "capetown", // capetown ZA Central Registry NPC trading as ZA Central Registry
415452 "capital", // capital Delta Mill, LLC
453 "capitalone", // capitalone Capital One Financial Corporation
416454 "car", // car Cars Registry Limited
417455 "caravan", // caravan Caravan International, Inc.
418456 "cards", // cards Foggy Hollow, LLC
422460 "cars", // cars Uniregistry, Corp.
423461 "cartier", // cartier Richemont DNS Inc.
424462 "casa", // casa Top Level Domain Holdings Limited
463 "case", // case CNH Industrial N.V.
464 "caseih", // caseih CNH Industrial N.V.
425465 "cash", // cash Delta Lake, LLC
426466 "casino", // casino Binky Sky, LLC
427467 "cat", // cat Fundacio puntCAT
428468 "catering", // catering New Falls. LLC
469 "catholic", // catholic Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication)
429470 "cba", // cba COMMONWEALTH BANK OF AUSTRALIA
430471 "cbn", // cbn The Christian Broadcasting Network, Inc.
472 "cbre", // cbre CBRE, Inc.
473 "cbs", // cbs CBS Domains Inc.
431474 "ceb", // ceb The Corporate Executive Board Company
432475 "center", // center Tin Mill, LLC
433476 "ceo", // ceo CEOTLD Pty Ltd
439482 "chase", // chase JPMorgan Chase &amp; Co.
440483 "chat", // chat Sand Fields, LLC
441484 "cheap", // cheap Sand Cover, LLC
485 "chintai", // chintai CHINTAI Corporation
442486 "chloe", // chloe Richemont DNS Inc.
443487 "christmas", // christmas Uniregistry, Corp.
444488 "chrome", // chrome Charleston Road Registry Inc.
489 "chrysler", // chrysler FCA US LLC.
445490 "church", // church Holly Fileds, LLC
446491 "cipriani", // cipriani Hotel Cipriani Srl
447492 "circle", // circle Amazon Registry Services, Inc.
448493 "cisco", // cisco Cisco Technology, Inc.
494 "citadel", // citadel Citadel Domain LLC
495 "citi", // citi Citigroup Inc.
449496 "citic", // citic CITIC Group Corporation
450497 "city", // city Snow Sky, LLC
451498 "cityeats", // cityeats Lifestyle Domain Holdings, Inc.
464511 "college", // college XYZ.COM LLC
465512 "cologne", // cologne NetCologne Gesellschaft für Telekommunikation mbH
466513 "com", // com VeriSign Global Registry Services
514 "comcast", // comcast Comcast IP Holdings I, LLC
467515 "commbank", // commbank COMMONWEALTH BANK OF AUSTRALIA
468516 "community", // community Fox Orchard, LLC
469517 "company", // company Silver Avenue, LLC
476524 "contact", // contact Top Level Spectrum, Inc.
477525 "contractors", // contractors Magic Woods, LLC
478526 "cooking", // cooking Top Level Domain Holdings Limited
527 "cookingchannel", // cookingchannel Lifestyle Domain Holdings, Inc.
479528 "cool", // cool Koko Lake, LLC
480529 "coop", // coop DotCooperation LLC
481530 "corsica", // corsica Collectivité Territoriale de Corse
489538 "cricket", // cricket dot Cricket Limited
490539 "crown", // crown Crown Equipment Corporation
491540 "crs", // crs Federated Co-operatives Limited
541 "cruise", // cruise Viking River Cruises (Bermuda) Ltd.
492542 "cruises", // cruises Spring Way, LLC
493543 "csc", // csc Alliance-One Services, Inc.
494544 "cuisinella", // cuisinella SALM S.A.S.
497547 "dabur", // dabur Dabur India Limited
498548 "dad", // dad Charleston Road Registry Inc.
499549 "dance", // dance United TLD Holdco Ltd.
550 "data", // data Dish DBS Corporation
500551 "date", // date dot Date Limited
501552 "dating", // dating Pine Fest, LLC
502553 "datsun", // datsun NISSAN MOTOR CO., LTD.
503554 "day", // day Charleston Road Registry Inc.
504555 "dclk", // dclk Charleston Road Registry Inc.
556 "dds", // dds Minds + Machines Group Limited
557 "deal", // deal Amazon Registry Services, Inc.
505558 "dealer", // dealer Dealer Dot Com, Inc.
506559 "deals", // deals Sand Sunset, LLC
507560 "degree", // degree United TLD Holdco, Ltd
515568 "desi", // desi Desi Networks LLC
516569 "design", // design Top Level Design, LLC
517570 "dev", // dev Charleston Road Registry Inc.
571 "dhl", // dhl Deutsche Post AG
518572 "diamonds", // diamonds John Edge, LLC
519573 "diet", // diet Uniregistry, Corp.
520574 "digital", // digital Dash Park, LLC
521575 "direct", // direct Half Trail, LLC
522576 "directory", // directory Extra Madison, LLC
523577 "discount", // discount Holly Hill, LLC
578 "discover", // discover Discover Financial Services
579 "dish", // dish Dish DBS Corporation
580 "diy", // diy Lifestyle Domain Holdings, Inc.
524581 "dnp", // dnp Dai Nippon Printing Co., Ltd.
525582 "docs", // docs Charleston Road Registry Inc.
583 "doctor", // doctor Brice Trail, LLC
584 "dodge", // dodge FCA US LLC.
526585 "dog", // dog Koko Mill, LLC
527586 "doha", // doha Communications Regulatory Authority (CRA)
528587 "domains", // domains Sugar Cross, LLC
529 // "doosan", // doosan Doosan Corporation (retired)
588 // "doosan", // doosan Doosan Corporation (retired)
589 "dot", // dot Dish DBS Corporation
530590 "download", // download dot Support Limited
531591 "drive", // drive Charleston Road Registry Inc.
592 "dtv", // dtv Dish DBS Corporation
532593 "dubai", // dubai Dubai Smart Government Department
594 "duck", // duck Johnson Shareholdings, Inc.
595 "dunlop", // dunlop The Goodyear Tire &amp; Rubber Company
596 "duns", // duns The Dun &amp; Bradstreet Corporation
597 "dupont", // dupont E. I. du Pont de Nemours and Company
533598 "durban", // durban ZA Central Registry NPC trading as ZA Central Registry
534599 "dvag", // dvag Deutsche Vermögensberatung Aktiengesellschaft DVAG
600 "dvr", // dvr Hughes Satellite Systems Corporation
535601 "earth", // earth Interlink Co., Ltd.
536602 "eat", // eat Charleston Road Registry Inc.
603 "eco", // eco Big Room Inc.
537604 "edeka", // edeka EDEKA Verband kaufmännischer Genossenschaften e.V.
538605 "edu", // edu EDUCAUSE
539606 "education", // education Brice Way, LLC
543610 "engineer", // engineer United TLD Holdco Ltd.
544611 "engineering", // engineering Romeo Canyon
545612 "enterprises", // enterprises Snow Oaks, LLC
613 "epost", // epost Deutsche Post AG
546614 "epson", // epson Seiko Epson Corporation
547615 "equipment", // equipment Corn Station, LLC
616 "ericsson", // ericsson Telefonaktiebolaget L M Ericsson
548617 "erni", // erni ERNI Group Holding AG
549618 "esq", // esq Charleston Road Registry Inc.
550619 "estate", // estate Trixy Park, LLC
620 "esurance", // esurance Esurance Insurance Company
551621 "eurovision", // eurovision European Broadcasting Union (EBU)
552622 "eus", // eus Puntueus Fundazioa
553623 "events", // events Pioneer Maple, LLC
565635 "fan", // fan Asiamix Digital Ltd
566636 "fans", // fans Asiamix Digital Limited
567637 "farm", // farm Just Maple, LLC
638 "farmers", // farmers Farmers Insurance Exchange
568639 "fashion", // fashion Top Level Domain Holdings Limited
569640 "fast", // fast Amazon Registry Services, Inc.
641 "fedex", // fedex Federal Express Corporation
570642 "feedback", // feedback Top Level Spectrum, Inc.
643 "ferrari", // ferrari Fiat Chrysler Automobiles N.V.
571644 "ferrero", // ferrero Ferrero Trading Lux S.A.
645 "fiat", // fiat Fiat Chrysler Automobiles N.V.
646 "fidelity", // fidelity Fidelity Brokerage Services LLC
647 "fido", // fido Rogers Communications Canada Inc.
572648 "film", // film Motion Picture Domain Registry Pty Ltd
573649 "final", // final Núcleo de Informação e Coordenação do Ponto BR - NIC.br
574650 "finance", // finance Cotton Cypress, LLC
575651 "financial", // financial Just Cover, LLC
652 "fire", // fire Amazon Registry Services, Inc.
576653 "firestone", // firestone Bridgestone Corporation
577654 "firmdale", // firmdale Firmdale Holdings Limited
578655 "fish", // fish Fox Woods, LLC
581658 "fitness", // fitness Brice Orchard, LLC
582659 "flickr", // flickr Yahoo! Domain Services Inc.
583660 "flights", // flights Fox Station, LLC
661 "flir", // flir FLIR Systems, Inc.
584662 "florist", // florist Half Cypress, LLC
585663 "flowers", // flowers Uniregistry, Corp.
586 "flsmidth", // flsmidth FLSmidth A/S
664 // "flsmidth", // flsmidth FLSmidth A/S retired 2016-07-22
587665 "fly", // fly Charleston Road Registry Inc.
588666 "foo", // foo Charleston Road Registry Inc.
667 "food", // food Lifestyle Domain Holdings, Inc.
668 "foodnetwork", // foodnetwork Lifestyle Domain Holdings, Inc.
589669 "football", // football Foggy Farms, LLC
590670 "ford", // ford Ford Motor Company
591671 "forex", // forex DOTFOREX REGISTRY LTD
593673 "forum", // forum Fegistry, LLC
594674 "foundation", // foundation John Dale, LLC
595675 "fox", // fox FOX Registry, LLC
676 "free", // free Amazon Registry Services, Inc.
596677 "fresenius", // fresenius Fresenius Immobilien-Verwaltungs-GmbH
597678 "frl", // frl FRLregistry B.V.
598679 "frogans", // frogans OP3FT
680 "frontdoor", // frontdoor Lifestyle Domain Holdings, Inc.
599681 "frontier", // frontier Frontier Communications Corporation
600682 "ftr", // ftr Frontier Communications Corporation
683 "fujitsu", // fujitsu Fujitsu Limited
684 "fujixerox", // fujixerox Xerox DNHC LLC
685 "fun", // fun DotSpace, Inc.
601686 "fund", // fund John Castle, LLC
602687 "furniture", // furniture Lone Fields, LLC
603688 "futbol", // futbol United TLD Holdco, Ltd.
607692 "gallo", // gallo Gallo Vineyards, Inc.
608693 "gallup", // gallup Gallup, Inc.
609694 "game", // game Uniregistry, Corp.
695 "games", // games United TLD Holdco Ltd.
696 "gap", // gap The Gap, Inc.
610697 "garden", // garden Top Level Domain Holdings Limited
611698 "gbiz", // gbiz Charleston Road Registry Inc.
612699 "gdn", // gdn Joint Stock Company "Navigation-information systems"
613700 "gea", // gea GEA Group Aktiengesellschaft
614701 "gent", // gent COMBELL GROUP NV/SA
615702 "genting", // genting Resorts World Inc. Pte. Ltd.
703 "george", // george Wal-Mart Stores, Inc.
616704 "ggee", // ggee GMO Internet, Inc.
617705 "gift", // gift Uniregistry, Corp.
618706 "gifts", // gifts Goose Sky, LLC
619707 "gives", // gives United TLD Holdco Ltd.
620708 "giving", // giving Giving Limited
709 "glade", // glade Johnson Shareholdings, Inc.
621710 "glass", // glass Black Cover, LLC
622711 "gle", // gle Charleston Road Registry Inc.
623712 "global", // global Dot Global Domain Registry Limited
626715 "gmbh", // gmbh Extra Dynamite, LLC
627716 "gmo", // gmo GMO Internet, Inc.
628717 "gmx", // gmx 1&amp;1 Mail &amp; Media GmbH
718 "godaddy", // godaddy Go Daddy East, LLC
629719 "gold", // gold June Edge, LLC
630720 "goldpoint", // goldpoint YODOBASHI CAMERA CO.,LTD.
631721 "golf", // golf Lone Falls, LLC
632722 "goo", // goo NTT Resonant Inc.
723 "goodhands", // goodhands Allstate Fire and Casualty Insurance Company
724 "goodyear", // goodyear The Goodyear Tire &amp; Rubber Company
633725 "goog", // goog Charleston Road Registry Inc.
634726 "google", // google Charleston Road Registry Inc.
635727 "gop", // gop Republican State Leadership Committee, Inc.
641733 "green", // green Afilias Limited
642734 "gripe", // gripe Corn Sunset, LLC
643735 "group", // group Romeo Town, LLC
736 "guardian", // guardian The Guardian Life Insurance Company of America
644737 "gucci", // gucci Guccio Gucci S.p.a.
645738 "guge", // guge Charleston Road Registry Inc.
646739 "guide", // guide Snow Moon, LLC
647740 "guitars", // guitars Uniregistry, Corp.
648741 "guru", // guru Pioneer Cypress, LLC
742 "hair", // hair L&#39;Oreal
649743 "hamburg", // hamburg Hamburg Top-Level-Domain GmbH
650744 "hangout", // hangout Charleston Road Registry Inc.
651745 "haus", // haus United TLD Holdco, LTD.
746 "hbo", // hbo HBO Registry Services, Inc.
747 "hdfc", // hdfc HOUSING DEVELOPMENT FINANCE CORPORATION LIMITED
652748 "hdfcbank", // hdfcbank HDFC Bank Limited
653749 "health", // health DotHealth, LLC
654750 "healthcare", // healthcare Silver Glen, LLC
656752 "helsinki", // helsinki City of Helsinki
657753 "here", // here Charleston Road Registry Inc.
658754 "hermes", // hermes Hermes International
755 "hgtv", // hgtv Lifestyle Domain Holdings, Inc.
659756 "hiphop", // hiphop Uniregistry, Corp.
757 "hisamitsu", // hisamitsu Hisamitsu Pharmaceutical Co.,Inc.
660758 "hitachi", // hitachi Hitachi, Ltd.
661759 "hiv", // hiv dotHIV gemeinnuetziger e.V.
760 "hkt", // hkt PCCW-HKT DataCom Services Limited
662761 "hockey", // hockey Half Willow, LLC
663762 "holdings", // holdings John Madison, LLC
664763 "holiday", // holiday Goose Woods, LLC
665764 "homedepot", // homedepot Homer TLC, Inc.
765 "homegoods", // homegoods The TJX Companies, Inc.
666766 "homes", // homes DERHomes, LLC
767 "homesense", // homesense The TJX Companies, Inc.
667768 "honda", // honda Honda Motor Co., Ltd.
769 "honeywell", // honeywell Honeywell GTLD LLC
668770 "horse", // horse Top Level Domain Holdings Limited
771 "hospital", // hospital Ruby Pike, LLC
669772 "host", // host DotHost Inc.
670773 "hosting", // hosting Uniregistry, Corp.
774 "hot", // hot Amazon Registry Services, Inc.
671775 "hoteles", // hoteles Travel Reservations SRL
672776 "hotmail", // hotmail Microsoft Corporation
673777 "house", // house Sugar Park, LLC
674778 "how", // how Charleston Road Registry Inc.
675779 "hsbc", // hsbc HSBC Holdings PLC
676780 "htc", // htc HTC corporation
781 "hughes", // hughes Hughes Satellite Systems Corporation
782 "hyatt", // hyatt Hyatt GTLD, L.L.C.
677783 "hyundai", // hyundai Hyundai Motor Company
678784 "ibm", // ibm International Business Machines Corporation
679785 "icbc", // icbc Industrial and Commercial Bank of China Limited
680786 "ice", // ice IntercontinentalExchange, Inc.
681787 "icu", // icu One.com A/S
788 "ieee", // ieee IEEE Global LLC
682789 "ifm", // ifm ifm electronic gmbh
683 "iinet", // iinet Connect West Pty. Ltd.
790 // "iinet", // iinet Connect West Pty. Ltd. (Retired)
791 "ikano", // ikano Ikano S.A.
684792 "imamat", // imamat Fondation Aga Khan (Aga Khan Foundation)
793 "imdb", // imdb Amazon Registry Services, Inc.
685794 "immo", // immo Auburn Bloom, LLC
686795 "immobilien", // immobilien United TLD Holdco Ltd.
687796 "industries", // industries Outer House, LLC
693802 "insurance", // insurance fTLD Registry Services LLC
694803 "insure", // insure Pioneer Willow, LLC
695804 "int", // int Internet Assigned Numbers Authority
805 "intel", // intel Intel Corporation
696806 "international", // international Wild Way, LLC
807 "intuit", // intuit Intuit Administrative Services, Inc.
697808 "investments", // investments Holly Glen, LLC
698809 "ipiranga", // ipiranga Ipiranga Produtos de Petroleo S.A.
699810 "irish", // irish Dot-Irish LLC
702813 "ist", // ist Istanbul Metropolitan Municipality
703814 "istanbul", // istanbul Istanbul Metropolitan Municipality / Medya A.S.
704815 "itau", // itau Itau Unibanco Holding S.A.
816 "itv", // itv ITV Services Limited
817 "iveco", // iveco CNH Industrial N.V.
705818 "iwc", // iwc Richemont DNS Inc.
706819 "jaguar", // jaguar Jaguar Land Rover Ltd
707820 "java", // java Oracle Corporation
708821 "jcb", // jcb JCB Co., Ltd.
709822 "jcp", // jcp JCP Media, Inc.
823 "jeep", // jeep FCA US LLC.
710824 "jetzt", // jetzt New TLD Company AB
711825 "jewelry", // jewelry Wild Bloom, LLC
826 "jio", // jio Affinity Names, Inc.
712827 "jlc", // jlc Richemont DNS Inc.
713828 "jll", // jll Jones Lang LaSalle Incorporated
714829 "jmp", // jmp Matrix IP LLC
720835 "jpmorgan", // jpmorgan JPMorgan Chase &amp; Co.
721836 "jprs", // jprs Japan Registry Services Co., Ltd.
722837 "juegos", // juegos Uniregistry, Corp.
838 "juniper", // juniper JUNIPER NETWORKS, INC.
723839 "kaufen", // kaufen United TLD Holdco Ltd.
724840 "kddi", // kddi KDDI CORPORATION
725841 "kerryhotels", // kerryhotels Kerry Trading Co. Limited
729845 "kia", // kia KIA MOTORS CORPORATION
730846 "kim", // kim Afilias Limited
731847 "kinder", // kinder Ferrero Trading Lux S.A.
848 "kindle", // kindle Amazon Registry Services, Inc.
732849 "kitchen", // kitchen Just Goodbye, LLC
733850 "kiwi", // kiwi DOT KIWI LIMITED
734851 "koeln", // koeln NetCologne Gesellschaft für Telekommunikation mbH
735852 "komatsu", // komatsu Komatsu Ltd.
853 "kosher", // kosher Kosher Marketing Assets LLC
736854 "kpmg", // kpmg KPMG International Cooperative (KPMG International Genossenschaft)
737855 "kpn", // kpn Koninklijke KPN N.V.
738856 "krd", // krd KRG Department of Information Technology
740858 "kuokgroup", // kuokgroup Kerry Trading Co. Limited
741859 "kyoto", // kyoto Academic Institution: Kyoto Jyoho Gakuen
742860 "lacaixa", // lacaixa CAIXA D&#39;ESTALVIS I PENSIONS DE BARCELONA
861 "ladbrokes", // ladbrokes LADBROKES INTERNATIONAL PLC
743862 "lamborghini", // lamborghini Automobili Lamborghini S.p.A.
744863 "lamer", // lamer The Estée Lauder Companies Inc.
745864 "lancaster", // lancaster LANCASTER
865 "lancia", // lancia Fiat Chrysler Automobiles N.V.
866 "lancome", // lancome L&#39;Oréal
746867 "land", // land Pine Moon, LLC
747868 "landrover", // landrover Jaguar Land Rover Ltd
748869 "lanxess", // lanxess LANXESS Corporation
749870 "lasalle", // lasalle Jones Lang LaSalle Incorporated
750871 "lat", // lat ECOM-LAC Federación de Latinoamérica y el Caribe para Internet y el Comercio Electrónico
872 "latino", // latino Dish DBS Corporation
751873 "latrobe", // latrobe La Trobe University
752874 "law", // law Minds + Machines Group Limited
753875 "lawyer", // lawyer United TLD Holdco, Ltd
754876 "lds", // lds IRI Domain Management, LLC
755877 "lease", // lease Victor Trail, LLC
756878 "leclerc", // leclerc A.C.D. LEC Association des Centres Distributeurs Edouard Leclerc
879 "lefrak", // lefrak LeFrak Organization, Inc.
757880 "legal", // legal Blue Falls, LLC
881 "lego", // lego LEGO Juris A/S
758882 "lexus", // lexus TOYOTA MOTOR CORPORATION
759883 "lgbt", // lgbt Afilias Limited
760884 "liaison", // liaison Liaison Technologies, Incorporated
764888 "lifestyle", // lifestyle Lifestyle Domain Holdings, Inc.
765889 "lighting", // lighting John McCook, LLC
766890 "like", // like Amazon Registry Services, Inc.
891 "lilly", // lilly Eli Lilly and Company
767892 "limited", // limited Big Fest, LLC
768893 "limo", // limo Hidden Frostbite, LLC
769894 "lincoln", // lincoln Ford Motor Company
770895 "linde", // linde Linde Aktiengesellschaft
771896 "link", // link Uniregistry, Corp.
897 "lipsy", // lipsy Lipsy Ltd
772898 "live", // live United TLD Holdco Ltd.
773899 "living", // living Lifestyle Domain Holdings, Inc.
774900 "lixil", // lixil LIXIL Group Corporation
775901 "loan", // loan dot Loan Limited
776902 "loans", // loans June Woods, LLC
903 "locker", // locker Dish DBS Corporation
777904 "locus", // locus Locus Analytics LLC
905 "loft", // loft Annco, Inc.
778906 "lol", // lol Uniregistry, Corp.
779907 "london", // london Dot London Domains Limited
780908 "lotte", // lotte Lotte Holdings Co., Ltd.
781909 "lotto", // lotto Afilias Limited
782910 "love", // love Merchant Law Group LLP
911 "lpl", // lpl LPL Holdings, Inc.
912 "lplfinancial", // lplfinancial LPL Holdings, Inc.
783913 "ltd", // ltd Over Corner, LLC
784914 "ltda", // ltda InterNetX Corp.
915 "lundbeck", // lundbeck H. Lundbeck A/S
785916 "lupin", // lupin LUPIN LIMITED
786917 "luxe", // luxe Top Level Domain Holdings Limited
787918 "luxury", // luxury Luxury Partners LLC
919 "macys", // macys Macys, Inc.
788920 "madrid", // madrid Comunidad de Madrid
789921 "maif", // maif Mutuelle Assurance Instituteur France (MAIF)
790922 "maison", // maison Victor Frostbite, LLC
796928 "marketing", // marketing Fern Pass, LLC
797929 "markets", // markets DOTMARKETS REGISTRY LTD
798930 "marriott", // marriott Marriott Worldwide Corporation
931 "marshalls", // marshalls The TJX Companies, Inc.
932 "maserati", // maserati Fiat Chrysler Automobiles N.V.
933 "mattel", // mattel Mattel Sites, Inc.
799934 "mba", // mba Lone Hollow, LLC
935 "mcd", // mcd McDonald’s Corporation
936 "mcdonalds", // mcdonalds McDonald’s Corporation
937 "mckinsey", // mckinsey McKinsey Holdings, Inc.
800938 "med", // med Medistry LLC
801939 "media", // media Grand Glen, LLC
802940 "meet", // meet Afilias Limited
806944 "men", // men Exclusive Registry Limited
807945 "menu", // menu Wedding TLD2, LLC
808946 "meo", // meo PT Comunicacoes S.A.
947 "metlife", // metlife MetLife Services and Solutions, LLC
809948 "miami", // miami Top Level Domain Holdings Limited
810949 "microsoft", // microsoft Microsoft Corporation
811950 "mil", // mil DoD Network Information Center
812951 "mini", // mini Bayerische Motoren Werke Aktiengesellschaft
952 "mint", // mint Intuit Administrative Services, Inc.
953 "mit", // mit Massachusetts Institute of Technology
954 "mitsubishi", // mitsubishi Mitsubishi Corporation
955 "mlb", // mlb MLB Advanced Media DH, LLC
813956 "mls", // mls The Canadian Real Estate Association
814957 "mma", // mma MMA IARD
815958 "mobi", // mobi Afilias Technologies Limited dba dotMobi
959 "mobile", // mobile Dish DBS Corporation
816960 "mobily", // mobily GreenTech Consultancy Company W.L.L.
817961 "moda", // moda United TLD Holdco Ltd.
818962 "moe", // moe Interlink Co., Ltd.
820964 "mom", // mom Uniregistry, Corp.
821965 "monash", // monash Monash University
822966 "money", // money Outer McCook, LLC
967 "monster", // monster Monster Worldwide, Inc.
823968 "montblanc", // montblanc Richemont DNS Inc.
969 "mopar", // mopar FCA US LLC.
824970 "mormon", // mormon IRI Domain Management, LLC (&quot;Applicant&quot;)
825971 "mortgage", // mortgage United TLD Holdco, Ltd
826972 "moscow", // moscow Foundation for Assistance for Internet Technologies and Infrastructure Development (FAITID)
973 "moto", // moto Motorola Trademark Holdings, LLC
827974 "motorcycles", // motorcycles DERMotorcycles, LLC
828975 "mov", // mov Charleston Road Registry Inc.
829976 "movie", // movie New Frostbite, LLC
830977 "movistar", // movistar Telefónica S.A.
978 "msd", // msd MSD Registry Holdings, Inc.
831979 "mtn", // mtn MTN Dubai Limited
832980 "mtpc", // mtpc Mitsubishi Tanabe Pharma Corporation
833981 "mtr", // mtr MTR Corporation Limited
834982 "museum", // museum Museum Domain Management Association
835983 "mutual", // mutual Northwestern Mutual MU TLD Registry, LLC
836 "mutuelle", // mutuelle Fédération Nationale de la Mutualité Française
984 // "mutuelle", // mutuelle Fédération Nationale de la Mutualité Française (Retired)
985 "nab", // nab National Australia Bank Limited
837986 "nadex", // nadex Nadex Domains, Inc
838987 "nagoya", // nagoya GMO Registry, Inc.
839988 "name", // name VeriSign Information Services, Inc.
989 "nationwide", // nationwide Nationwide Mutual Insurance Company
840990 "natura", // natura NATURA COSMÉTICOS S.A.
841991 "navy", // navy United TLD Holdco Ltd.
992 "nba", // nba NBA REGISTRY, LLC
842993 "nec", // nec NEC Corporation
843994 "net", // net VeriSign Global Registry Services
844995 "netbank", // netbank COMMONWEALTH BANK OF AUSTRALIA
996 "netflix", // netflix Netflix, Inc.
845997 "network", // network Trixy Manor, LLC
846998 "neustar", // neustar NeuStar, Inc.
847999 "new", // new Charleston Road Registry Inc.
1000 "newholland", // newholland CNH Industrial N.V.
8481001 "news", // news United TLD Holdco Ltd.
1002 "next", // next Next plc
1003 "nextdirect", // nextdirect Next plc
8491004 "nexus", // nexus Charleston Road Registry Inc.
1005 "nfl", // nfl NFL Reg Ops LLC
8501006 "ngo", // ngo Public Interest Registry
8511007 "nhk", // nhk Japan Broadcasting Corporation (NHK)
8521008 "nico", // nico DWANGO Co., Ltd.
1009 "nike", // nike NIKE, Inc.
8531010 "nikon", // nikon NIKON CORPORATION
8541011 "ninja", // ninja United TLD Holdco Ltd.
8551012 "nissan", // nissan NISSAN MOTOR CO., LTD.
8571014 "nokia", // nokia Nokia Corporation
8581015 "northwesternmutual", // northwesternmutual Northwestern Mutual Registry, LLC
8591016 "norton", // norton Symantec Corporation
1017 "now", // now Amazon Registry Services, Inc.
8601018 "nowruz", // nowruz Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti.
1019 "nowtv", // nowtv Starbucks (HK) Limited
8611020 "nra", // nra NRA Holdings Company, INC.
8621021 "nrw", // nrw Minds + Machines GmbH
8631022 "ntt", // ntt NIPPON TELEGRAPH AND TELEPHONE CORPORATION
8641023 "nyc", // nyc The City of New York by and through the New York City Department of Information Technology &amp; Telecommunications
8651024 "obi", // obi OBI Group Holding SE &amp; Co. KGaA
1025 "observer", // observer Top Level Spectrum, Inc.
1026 "off", // off Johnson Shareholdings, Inc.
8661027 "office", // office Microsoft Corporation
8671028 "okinawa", // okinawa BusinessRalliart inc.
1029 "olayan", // olayan Crescent Holding GmbH
1030 "olayangroup", // olayangroup Crescent Holding GmbH
1031 "oldnavy", // oldnavy The Gap, Inc.
1032 "ollo", // ollo Dish DBS Corporation
8681033 "omega", // omega The Swatch Group Ltd
8691034 "one", // one One.com A/S
8701035 "ong", // ong Public Interest Registry
8711036 "onl", // onl I-REGISTRY Ltd., Niederlassung Deutschland
8721037 "online", // online DotOnline Inc.
1038 "onyourside", // onyourside Nationwide Mutual Insurance Company
8731039 "ooo", // ooo INFIBEAM INCORPORATION LIMITED
1040 "open", // open American Express Travel Related Services Company, Inc.
8741041 "oracle", // oracle Oracle Corporation
8751042 "orange", // orange Orange Brand Services Limited
8761043 "org", // org Public Interest Registry (PIR)
8771044 "organic", // organic Afilias Limited
1045 "orientexpress", // orientexpress Orient Express
8781046 "origins", // origins The Estée Lauder Companies Inc.
8791047 "osaka", // osaka Interlink Co., Ltd.
8801048 "otsuka", // otsuka Otsuka Holdings Co., Ltd.
1049 "ott", // ott Dish DBS Corporation
8811050 "ovh", // ovh OVH SAS
8821051 "page", // page Charleston Road Registry Inc.
8831052 "pamperedchef", // pamperedchef The Pampered Chef, Ltd.
1053 "panasonic", // panasonic Panasonic Corporation
8841054 "panerai", // panerai Richemont DNS Inc.
8851055 "paris", // paris City of Paris
8861056 "pars", // pars Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti.
8881058 "parts", // parts Sea Goodbye, LLC
8891059 "party", // party Blue Sky Registry Limited
8901060 "passagens", // passagens Travel Reservations SRL
1061 "pay", // pay Amazon Registry Services, Inc.
1062 "pccw", // pccw PCCW Enterprises Limited
8911063 "pet", // pet Afilias plc
1064 "pfizer", // pfizer Pfizer Inc.
8921065 "pharmacy", // pharmacy National Association of Boards of Pharmacy
8931066 "philips", // philips Koninklijke Philips N.V.
1067 "phone", // phone Dish DBS Corporation
8941068 "photo", // photo Uniregistry, Corp.
8951069 "photography", // photography Sugar Glen, LLC
8961070 "photos", // photos Sea Corner, LLC
9031077 "pin", // pin Amazon Registry Services, Inc.
9041078 "ping", // ping Ping Registry Provider, Inc.
9051079 "pink", // pink Afilias Limited
1080 "pioneer", // pioneer Pioneer Corporation
9061081 "pizza", // pizza Foggy Moon, LLC
9071082 "place", // place Snow Galley, LLC
9081083 "play", // play Charleston Road Registry Inc.
9091084 "playstation", // playstation Sony Computer Entertainment Inc.
9101085 "plumbing", // plumbing Spring Tigers, LLC
9111086 "plus", // plus Sugar Mill, LLC
1087 "pnc", // pnc PNC Domain Co., LLC
9121088 "pohl", // pohl Deutsche Vermögensberatung Aktiengesellschaft DVAG
9131089 "poker", // poker Afilias Domains No. 5 Limited
1090 "politie", // politie Politie Nederland
9141091 "porn", // porn ICM Registry PN LLC
9151092 "post", // post Universal Postal Union
1093 "pramerica", // pramerica Prudential Financial, Inc.
9161094 "praxi", // praxi Praxi S.p.A.
9171095 "press", // press DotPress Inc.
1096 "prime", // prime Amazon Registry Services, Inc.
9181097 "pro", // pro Registry Services Corporation dba RegistryPro
9191098 "prod", // prod Charleston Road Registry Inc.
9201099 "productions", // productions Magic Birch, LLC
9241103 "properties", // properties Big Pass, LLC
9251104 "property", // property Uniregistry, Corp.
9261105 "protection", // protection XYZ.COM LLC
1106 "pru", // pru Prudential Financial, Inc.
1107 "prudential", // prudential Prudential Financial, Inc.
9271108 "pub", // pub United TLD Holdco Ltd.
9281109 "pwc", // pwc PricewaterhouseCoopers LLP
9291110 "qpon", // qpon dotCOOL, Inc.
9301111 "quebec", // quebec PointQuébec Inc
9311112 "quest", // quest Quest ION Limited
1113 "qvc", // qvc QVC, Inc.
9321114 "racing", // racing Premier Registry Limited
1115 "radio", // radio European Broadcasting Union (EBU)
1116 "raid", // raid Johnson Shareholdings, Inc.
9331117 "read", // read Amazon Registry Services, Inc.
1118 "realestate", // realestate dotRealEstate LLC
9341119 "realtor", // realtor Real Estate Domains LLC
9351120 "realty", // realty Fegistry, LLC
9361121 "recipes", // recipes Grand Island, LLC
9411126 "reise", // reise Foggy Way, LLC
9421127 "reisen", // reisen New Cypress, LLC
9431128 "reit", // reit National Association of Real Estate Investment Trusts, Inc.
1129 "reliance", // reliance Reliance Industries Limited
9441130 "ren", // ren Beijing Qianxiang Wangjing Technology Development Co., Ltd.
9451131 "rent", // rent XYZ.COM LLC
9461132 "rentals", // rentals Big Hollow,LLC
9531139 "reviews", // reviews United TLD Holdco, Ltd.
9541140 "rexroth", // rexroth Robert Bosch GMBH
9551141 "rich", // rich I-REGISTRY Ltd., Niederlassung Deutschland
1142 "richardli", // richardli Pacific Century Asset Management (HK) Limited
9561143 "ricoh", // ricoh Ricoh Company, Ltd.
1144 "rightathome", // rightathome Johnson Shareholdings, Inc.
1145 "ril", // ril Reliance Industries Limited
9571146 "rio", // rio Empresa Municipal de Informática SA - IPLANRIO
9581147 "rip", // rip United TLD Holdco Ltd.
1148 "rmit", // rmit Royal Melbourne Institute of Technology
9591149 "rocher", // rocher Ferrero Trading Lux S.A.
9601150 "rocks", // rocks United TLD Holdco, LTD.
9611151 "rodeo", // rodeo Top Level Domain Holdings Limited
1152 "rogers", // rogers Rogers Communications Canada Inc.
9621153 "room", // room Amazon Registry Services, Inc.
9631154 "rsvp", // rsvp Charleston Road Registry Inc.
9641155 "ruhr", // ruhr regiodot GmbH &amp; Co. KG
9711162 "sakura", // sakura SAKURA Internet Inc.
9721163 "sale", // sale United TLD Holdco, Ltd
9731164 "salon", // salon Outer Orchard, LLC
1165 "samsclub", // samsclub Wal-Mart Stores, Inc.
9741166 "samsung", // samsung SAMSUNG SDS CO., LTD
9751167 "sandvik", // sandvik Sandvik AB
9761168 "sandvikcoromant", // sandvikcoromant Sandvik AB
9791171 "sapo", // sapo PT Comunicacoes S.A.
9801172 "sarl", // sarl Delta Orchard, LLC
9811173 "sas", // sas Research IP LLC
1174 "save", // save Amazon Registry Services, Inc.
9821175 "saxo", // saxo Saxo Bank A/S
9831176 "sbi", // sbi STATE BANK OF INDIA
9841177 "sbs", // sbs SPECIAL BROADCASTING SERVICE CORPORATION
9911184 "schule", // schule Outer Moon, LLC
9921185 "schwarz", // schwarz Schwarz Domains und Services GmbH &amp; Co. KG
9931186 "science", // science dot Science Limited
1187 "scjohnson", // scjohnson Johnson Shareholdings, Inc.
9941188 "scor", // scor SCOR SE
9951189 "scot", // scot Dot Scot Registry Limited
9961190 "seat", // seat SEAT, S.A. (Sociedad Unipersonal)
1191 "secure", // secure Amazon Registry Services, Inc.
9971192 "security", // security XYZ.COM LLC
9981193 "seek", // seek Seek Limited
9991194 "select", // select iSelect Ltd
10001195 "sener", // sener Sener Ingeniería y Sistemas, S.A.
10011196 "services", // services Fox Castle, LLC
1197 "ses", // ses SES
10021198 "seven", // seven Seven West Media Ltd
10031199 "sew", // sew SEW-EURODRIVE GmbH &amp; Co KG
10041200 "sex", // sex ICM Registry SX LLC
10051201 "sexy", // sexy Uniregistry, Corp.
10061202 "sfr", // sfr Societe Francaise du Radiotelephone - SFR
1203 "shangrila", // shangrila Shangri‐La International Hotel Management Limited
10071204 "sharp", // sharp Sharp Corporation
10081205 "shaw", // shaw Shaw Cablesystems G.P.
10091206 "shell", // shell Shell Information Technology International Inc
10101207 "shia", // shia Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti.
10111208 "shiksha", // shiksha Afilias Limited
10121209 "shoes", // shoes Binky Galley, LLC
1210 "shop", // shop GMO Registry, Inc.
1211 "shopping", // shopping Over Keep, LLC
10131212 "shouji", // shouji QIHOO 360 TECHNOLOGY CO. LTD.
10141213 "show", // show Snow Beach, LLC
1214 "showtime", // showtime CBS Domains Inc.
10151215 "shriram", // shriram Shriram Capital Ltd.
1216 "silk", // silk Amazon Registry Services, Inc.
10161217 "sina", // sina Sina Corporation
10171218 "singles", // singles Fern Madison, LLC
10181219 "site", // site DotSite Inc.
10201221 "skin", // skin L&#39;Oréal
10211222 "sky", // sky Sky International AG
10221223 "skype", // skype Microsoft Corporation
1224 "sling", // sling Hughes Satellite Systems Corporation
1225 "smart", // smart Smart Communications, Inc. (SMART)
10231226 "smile", // smile Amazon Registry Services, Inc.
10241227 "sncf", // sncf SNCF (Société Nationale des Chemins de fer Francais)
10251228 "soccer", // soccer Foggy Shadow, LLC
10371240 "spot", // spot Amazon Registry Services, Inc.
10381241 "spreadbetting", // spreadbetting DOTSPREADBETTING REGISTRY LTD
10391242 "srl", // srl InterNetX Corp.
1243 "srt", // srt FCA US LLC.
10401244 "stada", // stada STADA Arzneimittel AG
1245 "staples", // staples Staples, Inc.
10411246 "star", // star Star India Private Limited
10421247 "starhub", // starhub StarHub Limited
10431248 "statebank", // statebank STATE BANK OF INDIA
10601265 "surgery", // surgery Tin Avenue, LLC
10611266 "suzuki", // suzuki SUZUKI MOTOR CORPORATION
10621267 "swatch", // swatch The Swatch Group Ltd
1268 "swiftcover", // swiftcover Swiftcover Insurance Services Limited
10631269 "swiss", // swiss Swiss Confederation
10641270 "sydney", // sydney State of New South Wales, Department of Premier and Cabinet
10651271 "symantec", // symantec Symantec Corporation
10681274 "taipei", // taipei Taipei City Government
10691275 "talk", // talk Amazon Registry Services, Inc.
10701276 "taobao", // taobao Alibaba Group Holding Limited
1277 "target", // target Target Domain Holdings, LLC
10711278 "tatamotors", // tatamotors Tata Motors Ltd
10721279 "tatar", // tatar Limited Liability Company &quot;Coordination Center of Regional Domain of Tatarstan Republic&quot;
10731280 "tattoo", // tattoo Uniregistry, Corp.
10741281 "tax", // tax Storm Orchard, LLC
10751282 "taxi", // taxi Pine Falls, LLC
10761283 "tci", // tci Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti.
1284 "tdk", // tdk TDK Corporation
10771285 "team", // team Atomic Lake, LLC
10781286 "tech", // tech Dot Tech LLC
10791287 "technology", // technology Auburn Falls, LLC
10861294 "thd", // thd Homer TLC, Inc.
10871295 "theater", // theater Blue Tigers, LLC
10881296 "theatre", // theatre XYZ.COM LLC
1297 "tiaa", // tiaa Teachers Insurance and Annuity Association of America
10891298 "tickets", // tickets Accent Media Limited
10901299 "tienda", // tienda Victor Manor, LLC
10911300 "tiffany", // tiffany Tiffany and Company
10921301 "tips", // tips Corn Willow, LLC
10931302 "tires", // tires Dog Edge, LLC
10941303 "tirol", // tirol punkt Tirol GmbH
1304 "tjmaxx", // tjmaxx The TJX Companies, Inc.
1305 "tjx", // tjx The TJX Companies, Inc.
1306 "tkmaxx", // tkmaxx The TJX Companies, Inc.
10951307 "tmall", // tmall Alibaba Group Holding Limited
10961308 "today", // today Pearl Woods, LLC
10971309 "tokyo", // tokyo GMO Registry, Inc.
11081320 "trading", // trading DOTTRADING REGISTRY LTD
11091321 "training", // training Wild Willow, LLC
11101322 "travel", // travel Tralliance Registry Management Company, LLC.
1323 "travelchannel", // travelchannel Lifestyle Domain Holdings, Inc.
11111324 "travelers", // travelers Travelers TLD, LLC
11121325 "travelersinsurance", // travelersinsurance Travelers TLD, LLC
11131326 "trust", // trust Artemis Internet Inc
11171330 "tunes", // tunes Amazon Registry Services, Inc.
11181331 "tushu", // tushu Amazon Registry Services, Inc.
11191332 "tvs", // tvs T V SUNDRAM IYENGAR &amp; SONS PRIVATE LIMITED
1333 "ubank", // ubank National Australia Bank Limited
11201334 "ubs", // ubs UBS AG
1335 "uconnect", // uconnect FCA US LLC.
11211336 "unicom", // unicom China United Network Communications Corporation Limited
11221337 "university", // university Little Station, LLC
11231338 "uno", // uno Dot Latin LLC
11241339 "uol", // uol UBN INTERNET LTDA.
1340 "ups", // ups UPS Market Driver, Inc.
11251341 "vacations", // vacations Atomic Tigers, LLC
11261342 "vana", // vana Lifestyle Domain Holdings, Inc.
1343 "vanguard", // vanguard The Vanguard Group, Inc.
11271344 "vegas", // vegas Dot Vegas, Inc.
11281345 "ventures", // ventures Binky Lake, LLC
11291346 "verisign", // verisign VeriSign, Inc.
11371354 "vin", // vin Holly Shadow, LLC
11381355 "vip", // vip Minds + Machines Group Limited
11391356 "virgin", // virgin Virgin Enterprises Limited
1357 "visa", // visa Visa Worldwide Pte. Limited
11401358 "vision", // vision Koko Station, LLC
11411359 "vista", // vista Vistaprint Limited
11421360 "vistaprint", // vistaprint Vistaprint Limited
11431361 "viva", // viva Saudi Telecom Company
1362 "vivo", // vivo Telefonica Brasil S.A.
11441363 "vlaanderen", // vlaanderen DNS.be vzw
11451364 "vodka", // vodka Top Level Domain Holdings Limited
11461365 "volkswagen", // volkswagen Volkswagen Group of America Inc.
1366 "volvo", // volvo Volvo Holding Sverige Aktiebolag
11471367 "vote", // vote Monolith Registry LLC
11481368 "voting", // voting Valuetainment Corp.
11491369 "voto", // voto Monolith Registry LLC
11501370 "voyage", // voyage Ruby House, LLC
11511371 "vuelos", // vuelos Travel Reservations SRL
11521372 "wales", // wales Nominet UK
1373 "walmart", // walmart Wal-Mart Stores, Inc.
11531374 "walter", // walter Sandvik AB
11541375 "wang", // wang Zodiac Registry Limited
11551376 "wanggou", // wanggou Amazon Registry Services, Inc.
1377 "warman", // warman Weir Group IP Limited
11561378 "watch", // watch Sand Shadow, LLC
11571379 "watches", // watches Richemont DNS Inc.
11581380 "weather", // weather The Weather Channel, LLC
11711393 "win", // win First Registry Limited
11721394 "windows", // windows Microsoft Corporation
11731395 "wine", // wine June Station, LLC
1396 "winners", // winners The TJX Companies, Inc.
11741397 "wme", // wme William Morris Endeavor Entertainment, LLC
11751398 "wolterskluwer", // wolterskluwer Wolters Kluwer N.V.
1399 "woodside", // woodside Woodside Petroleum Limited
11761400 "work", // work Top Level Domain Holdings Limited
11771401 "works", // works Little Dynamite, LLC
11781402 "world", // world Bitter Fields, LLC
1403 "wow", // wow Amazon Registry Services, Inc.
11791404 "wtc", // wtc World Trade Centers Association, Inc.
11801405 "wtf", // wtf Hidden Way, LLC
11811406 "xbox", // xbox Microsoft Corporation
11821407 "xerox", // xerox Xerox DNHC LLC
1408 "xfinity", // xfinity Comcast IP Holdings I, LLC
11831409 "xihuan", // xihuan QIHOO 360 TECHNOLOGY CO. LTD.
11841410 "xin", // xin Elegant Leader Limited
11851411 "xn--11b4c3d", // कॉम VeriSign Sarl
11881414 "xn--30rr7y", // 慈善 Excellent First Limited
11891415 "xn--3bst00m", // 集团 Eagle Horizon Limited
11901416 "xn--3ds443g", // 在线 TLD REGISTRY LIMITED
1417 "xn--3oq18vl8pn36a", // 大众汽车 Volkswagen (China) Investment Co., Ltd.
11911418 "xn--3pxu8k", // 点看 VeriSign Sarl
11921419 "xn--42c2d9a", // คอม VeriSign Sarl
11931420 "xn--45q11c", // 八卦 Zodiac Scorpio Limited
11941421 "xn--4gbrim", // موقع Suhub Electronic Establishment
11951422 "xn--55qw42g", // 公益 China Organizational Name Administration Center
11961423 "xn--55qx5d", // 公司 Computer Network Information Center of Chinese Academy of Sciences (China Internet Network Information Center)
1424 "xn--5su34j936bgsg", // 香格里拉 Shangri‐La International Hotel Management Limited
11971425 "xn--5tzm5g", // 网站 Global Website TLD Asia Limited
11981426 "xn--6frz82g", // 移动 Afilias Limited
11991427 "xn--6qq986b3xl", // 我爱你 Tycoon Treasure Limited
12001428 "xn--80adxhks", // москва Foundation for Assistance for Internet Technologies and Infrastructure Development (FAITID)
1429 "xn--80aqecdr1a", // католик Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication)
12011430 "xn--80asehdb", // онлайн CORE Association
12021431 "xn--80aswg", // сайт CORE Association
12031432 "xn--8y0a063a", // 联通 China United Network Communications Corporation Limited
1433 "xn--90ae", // бг Imena.BG Plc (NAMES.BG Plc)
12041434 "xn--9dbq2a", // קום VeriSign Sarl
12051435 "xn--9et52u", // 时尚 RISE VICTORY LIMITED
12061436 "xn--9krt00a", // 微博 Sina Corporation
12231453 "xn--fiq64b", // 中信 CITIC Group Corporation
12241454 "xn--fjq720a", // 娱乐 Will Bloom, LLC
12251455 "xn--flw351e", // 谷歌 Charleston Road Registry Inc.
1456 "xn--fzys8d69uvgm", // 電訊盈科 PCCW Enterprises Limited
12261457 "xn--g2xx48c", // 购物 Minds + Machines Group Limited
12271458 "xn--gckr3f0f", // クラウド Amazon Registry Services, Inc.
1459 "xn--gk3at1e", // 通販 Amazon Registry Services, Inc.
12281460 "xn--hxt814e", // 网店 Zodiac Libra Limited
12291461 "xn--i1b6b1a6a2e", // संगठन Public Interest Registry
12301462 "xn--imr513n", // 餐厅 HU YI GLOBAL INFORMATION RESOURCES (HOLDING) COMPANY. HONGKONG LIMITED
12361468 "xn--kpu716f", // 手表 Richemont DNS Inc.
12371469 "xn--kput3i", // 手机 Beijing RITT-Net Technology Development Co., Ltd
12381470 "xn--mgba3a3ejt", // ارامكو Aramco Services Company
1471 "xn--mgba7c0bbn0a", // العليان Crescent Holding GmbH
12391472 "xn--mgbab2bd", // بازار CORE Association
12401473 "xn--mgbb9fbpob", // موبايلي GreenTech Consultancy Company W.L.L.
12411474 "xn--mgbca7dzdo", // ابوظبي Abu Dhabi Systems and Information Centre
1475 "xn--mgbi4ecexp", // كاثوليك Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication)
12421476 "xn--mgbt3dhd", // همراه Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti.
12431477 "xn--mk1bu44c", // 닷컴 VeriSign Sarl
12441478 "xn--mxtq1m", // 政府 Net-Chinese Co., Ltd.
12571491 "xn--ses554g", // 网址 KNET Co., Ltd
12581492 "xn--t60b56a", // 닷넷 VeriSign Sarl
12591493 "xn--tckwe", // コム VeriSign Sarl
1494 "xn--tiq49xqyj", // 天主教 Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication)
12601495 "xn--unup4y", // 游戏 Spring Fields, LLC
12611496 "xn--vermgensberater-ctb", // VERMöGENSBERATER Deutsche Vermögensberatung Aktiengesellschaft DVAG
12621497 "xn--vermgensberatung-pwb", // VERMöGENSBERATUNG Deutsche Vermögensberatung Aktiengesellschaft DVAG
12631498 "xn--vhquv", // 企业 Dash McCook, LLC
12641499 "xn--vuq861b", // 信息 Beijing Tele-info Network Technology Co., Ltd.
12651500 "xn--w4r85el8fhu5dnra", // 嘉里大酒店 Kerry Trading Co. Limited
1501 "xn--w4rs40l", // 嘉里 Kerry Trading Co. Limited
12661502 "xn--xhq521b", // 广东 Guangzhou YU Wei Information Technology Co., Ltd.
12671503 "xn--zfr164b", // 政务 China Organizational Name Administration Center
12681504 "xperia", // xperia Sony Mobile Communications AB
12781514 "you", // you Amazon Registry Services, Inc.
12791515 "youtube", // youtube Charleston Road Registry Inc.
12801516 "yun", // yun QIHOO 360 TECHNOLOGY CO. LTD.
1517 "zappos", // zappos Amazon Registry Services, Inc.
12811518 "zara", // zara Industria de Diseño Textil, S.A. (INDITEX, S.A.)
12821519 "zero", // zero Amazon Registry Services, Inc.
12831520 "zip", // zip Charleston Road Registry Inc.
1521 "zippo", // zippo Zadco Company
12841522 "zone", // zone Outer Falls, LLC
12851523 "zuerich", // zuerich Kanton Zürich (Canton of Zurich)
12861524 };
15331771 "ws", // Samoa (formerly Western Samoa)
15341772 "xn--3e0b707e", // 한국 KISA (Korea Internet &amp; Security Agency)
15351773 "xn--45brj9c", // ভারত National Internet Exchange of India
1774 "xn--54b7fta0cc", // বাংলা Posts and Telecommunications Division
15361775 "xn--80ao21a", // қаз Association of IT Companies of Kazakhstan
15371776 "xn--90a3ac", // срб Serbian National Internet Domain Registry (RNIDS)
15381777 "xn--90ais", // ??? Reliable Software Inc.
9393 */
9494
9595 private static final Validator[] DEFAULT_FORMATS = {
96 new Validator("AD", 24, "AD\\d{10}[A-Z0-9]{12}" ), // Andorra
97 new Validator("AE", 23, "AE\\d{21}" ), // United Arab Emirates
9698 new Validator("AL", 28, "AL\\d{10}[A-Z0-9]{16}" ), // Albania
97 new Validator("AD", 24, "AD\\d{10}[A-Z0-9]{12}" ), // Andorra
9899 new Validator("AT", 20, "AT\\d{18}" ), // Austria
99100 new Validator("AZ", 28, "AZ\\d{2}[A-Z]{4}[A-Z0-9]{20}" ), // Republic of Azerbaijan
101 new Validator("BA", 20, "BA\\d{18}" ), // Bosnia and Herzegovina
102 new Validator("BE", 16, "BE\\d{14}" ), // Belgium
103 new Validator("BG", 22, "BG\\d{2}[A-Z]{4}\\d{6}[A-Z0-9]{8}" ), // Bulgaria
100104 new Validator("BH", 22, "BH\\d{2}[A-Z]{4}[A-Z0-9]{14}" ), // Bahrain (Kingdom of)
101 new Validator("BE", 16, "BE\\d{14}" ), // Belgium
102 new Validator("BA", 20, "BA\\d{18}" ), // Bosnia and Herzegovina
103105 new Validator("BR", 29, "BR\\d{25}[A-Z]{1}[A-Z0-9]{1}" ), // Brazil
104 new Validator("BG", 22, "BG\\d{2}[A-Z]{4}\\d{6}[A-Z0-9]{8}" ), // Bulgaria
105 new Validator("CR", 21, "CR\\d{19}" ), // Costa Rica
106 new Validator("HR", 21, "HR\\d{19}" ), // Croatia
106 new Validator("BY", 28, "BY\\d{2}[A-Z0-9]{4}\\d{4}[A-Z0-9]{16}" ), // Republic of Belarus
107 new Validator("CH", 21, "CH\\d{7}[A-Z0-9]{12}" ), // Switzerland
108 new Validator("CR", 22, "CR\\d{20}" ), // Costa Rica
107109 new Validator("CY", 28, "CY\\d{10}[A-Z0-9]{16}" ), // Cyprus
108110 new Validator("CZ", 24, "CZ\\d{22}" ), // Czech Republic
111 new Validator("DE", 22, "DE\\d{20}" ), // Germany
109112 new Validator("DK", 18, "DK\\d{16}" ), // Denmark
110 new Validator("FO", 18, "FO\\d{16}" ), // Denmark (Faroes)
111 new Validator("GL", 18, "GL\\d{16}" ), // Denmark (Greenland)
112113 new Validator("DO", 28, "DO\\d{2}[A-Z0-9]{4}\\d{20}" ), // Dominican Republic
113114 new Validator("EE", 20, "EE\\d{18}" ), // Estonia
115 new Validator("ES", 24, "ES\\d{22}" ), // Spain
114116 new Validator("FI", 18, "FI\\d{16}" ), // Finland
117 new Validator("FO", 18, "FO\\d{16}" ), // Denmark (Faroes)
115118 new Validator("FR", 27, "FR\\d{12}[A-Z0-9]{11}\\d{2}" ), // France
119 new Validator("GB", 22, "GB\\d{2}[A-Z]{4}\\d{14}" ), // United Kingdom
116120 new Validator("GE", 22, "GE\\d{2}[A-Z]{2}\\d{16}" ), // Georgia
117 new Validator("DE", 22, "DE\\d{20}" ), // Germany
118121 new Validator("GI", 23, "GI\\d{2}[A-Z]{4}[A-Z0-9]{15}" ), // Gibraltar
122 new Validator("GL", 18, "GL\\d{16}" ), // Denmark (Greenland)
119123 new Validator("GR", 27, "GR\\d{9}[A-Z0-9]{16}" ), // Greece
120124 new Validator("GT", 28, "GT\\d{2}[A-Z0-9]{24}" ), // Guatemala
125 new Validator("HR", 21, "HR\\d{19}" ), // Croatia
121126 new Validator("HU", 28, "HU\\d{26}" ), // Hungary
122 new Validator("IS", 26, "IS\\d{24}" ), // Iceland
123127 new Validator("IE", 22, "IE\\d{2}[A-Z]{4}\\d{14}" ), // Ireland
124128 new Validator("IL", 23, "IL\\d{21}" ), // Israel
129 new Validator("IS", 26, "IS\\d{24}" ), // Iceland
125130 new Validator("IT", 27, "IT\\d{2}[A-Z]{1}\\d{10}[A-Z0-9]{12}" ), // Italy
131 new Validator("IQ", 23, "IQ\\d{2}[A-Z]{4}\\d{15}" ), // Iraq
126132 new Validator("JO", 30, "JO\\d{2}[A-Z]{4}\\d{4}[A-Z0-9]{18}" ), // Jordan
133 new Validator("KW", 30, "KW\\d{2}[A-Z]{4}[A-Z0-9]{22}" ), // Kuwait
127134 new Validator("KZ", 20, "KZ\\d{5}[A-Z0-9]{13}" ), // Kazakhstan
128 new Validator("XK", 20, "XK\\d{18}" ), // Republic of Kosovo
129 new Validator("KW", 30, "KW\\d{2}[A-Z]{4}[A-Z0-9]{22}" ), // Kuwait
130 new Validator("LV", 21, "LV\\d{2}[A-Z]{4}[A-Z0-9]{13}" ), // Latvia
131135 new Validator("LB", 28, "LB\\d{6}[A-Z0-9]{20}" ), // Lebanon
136 new Validator("LC", 32, "LC\\d{2}[A-Z]{4}[A-Z0-9]{24}" ), // Saint Lucia
132137 new Validator("LI", 21, "LI\\d{7}[A-Z0-9]{12}" ), // Liechtenstein (Principality of)
133138 new Validator("LT", 20, "LT\\d{18}" ), // Lithuania
134139 new Validator("LU", 20, "LU\\d{5}[A-Z0-9]{13}" ), // Luxembourg
140 new Validator("LV", 21, "LV\\d{2}[A-Z]{4}[A-Z0-9]{13}" ), // Latvia
141 new Validator("MC", 27, "MC\\d{12}[A-Z0-9]{11}\\d{2}" ), // Monaco
142 new Validator("MD", 24, "MD\\d{2}[A-Z0-9]{20}" ), // Moldova
143 new Validator("ME", 22, "ME\\d{20}" ), // Montenegro
135144 new Validator("MK", 19, "MK\\d{5}[A-Z0-9]{10}\\d{2}" ), // Macedonia, Former Yugoslav Republic of
145 new Validator("MR", 27, "MR\\d{25}" ), // Mauritania
136146 new Validator("MT", 31, "MT\\d{2}[A-Z]{4}\\d{5}[A-Z0-9]{18}" ), // Malta
137 new Validator("MR", 27, "MR13\\d{23}" ), // Mauritania
138147 new Validator("MU", 30, "MU\\d{2}[A-Z]{4}\\d{19}[A-Z]{3}" ), // Mauritius
139 new Validator("MD", 24, "MD\\d{2}[A-Z0-9]{20}" ), // Moldova
140 new Validator("MC", 27, "MC\\d{12}[A-Z0-9]{11}\\d{2}" ), // Monaco
141 new Validator("ME", 22, "ME\\d{20}" ), // Montenegro
142148 new Validator("NL", 18, "NL\\d{2}[A-Z]{4}\\d{10}" ), // The Netherlands
143149 new Validator("NO", 15, "NO\\d{13}" ), // Norway
144150 new Validator("PK", 24, "PK\\d{2}[A-Z]{4}[A-Z0-9]{16}" ), // Pakistan
151 new Validator("PL", 28, "PL\\d{26}" ), // Poland
145152 new Validator("PS", 29, "PS\\d{2}[A-Z]{4}[A-Z0-9]{21}" ), // Palestine, State of
146 new Validator("PL", 28, "PL\\d{26}" ), // Poland
147153 new Validator("PT", 25, "PT\\d{23}" ), // Portugal
148154 new Validator("QA", 29, "QA\\d{2}[A-Z]{4}[A-Z0-9]{21}" ), // Qatar
149155 new Validator("RO", 24, "RO\\d{2}[A-Z]{4}[A-Z0-9]{16}" ), // Romania
150 new Validator("LC", 32, "LC\\d{2}[A-Z]{4}\\d{24}" ), // Saint Lucia
156 new Validator("RS", 22, "RS\\d{20}" ), // Serbia
157 new Validator("SA", 24, "SA\\d{4}[A-Z0-9]{18}" ), // Saudi Arabia
158 new Validator("SC", 31, "SC\\d{2}[A-Z]{4}\\d{20}[A-Z]{3}" ), // Seychelles
159 new Validator("SE", 24, "SE\\d{22}" ), // Sweden
160 new Validator("SI", 19, "SI\\d{17}" ), // Slovenia
161 new Validator("SK", 24, "SK\\d{22}" ), // Slovak Republic
151162 new Validator("SM", 27, "SM\\d{2}[A-Z]{1}\\d{10}[A-Z0-9]{12}" ), // San Marino
152 new Validator("ST", 25, "ST\\d{23}" ), // Sao Tome And Principe
153 new Validator("SA", 24, "SA\\d{4}[A-Z0-9]{18}" ), // Saudi Arabia
154 new Validator("RS", 22, "RS\\d{20}" ), // Serbia
155 new Validator("SK", 24, "SK\\d{22}" ), // Slovak Republic
156 new Validator("SI", 19, "SI\\d{17}" ), // Slovenia
157 new Validator("ES", 24, "ES\\d{22}" ), // Spain
158 new Validator("SE", 24, "SE\\d{22}" ), // Sweden
159 new Validator("CH", 21, "CH\\d{7}[A-Z0-9]{12}" ), // Switzerland
163 new Validator("ST", 25, "ST\\d{23}" ), // Sao Tome and Principe
160164 new Validator("TL", 23, "TL\\d{21}" ), // Timor-Leste
161 new Validator("TN", 24, "TN59\\d{20}" ), // Tunisia
165 new Validator("TN", 24, "TN\\d{22}" ), // Tunisia
162166 new Validator("TR", 26, "TR\\d{8}[A-Z0-9]{16}" ), // Turkey
163 new Validator("AE", 23, "AE\\d{21}" ), // United Arab Emirates
164 new Validator("GB", 22, "GB\\d{2}[A-Z]{4}\\d{14}" ), // United Kingdom
167 new Validator("UA", 29, "UA\\d{8}[A-Z0-9]{19}" ), // Ukraine
165168 new Validator("VG", 24, "VG\\d{2}[A-Z]{4}\\d{16}" ), // Virgin Islands, British
169 new Validator("XK", 20, "XK\\d{18}" ), // Republic of Kosovo
166170 };
167171
168172 /** The singleton instance which uses the default formats */
4747 *
4848 * </pre>
4949 * <p>
50 * Note: the {@link #isValid(String)} and {@link } methods strip off any leading
50 * Note: the {@link #isValid(String)} and {@link #validate(String)} methods strip off any leading
5151 * or trailing spaces before doing the validation.
5252 * To ensure that only a valid code (without 'ISSN ' prefix) is passed to a method,
5353 * use the following code:
3030 * This class is a Singleton; you can retrieve the instance via the {@link #getInstance()} method.
3131 * </p>
3232 *
33 * @version $Revision: 1739361 $
33 * @version $Revision: 1783032 $
3434 * @since Validator 1.4
3535 */
3636 public class InetAddressValidator implements Serializable {
148148 return false;
149149 }
150150 int validOctets = 0;
151 int emptyOctets = 0;
151 int emptyOctets = 0; // consecutive empty chunks
152152 for (int index = 0; index < octets.length; index++) {
153153 String octet = octets[index];
154154 if (octet.length() == 0) {
158158 }
159159 } else {
160160 emptyOctets = 0;
161 if (octet.contains(".")) { // contains is Java 1.5+
162 if (!inet6Address.endsWith(octet)) {
163 return false;
164 }
165 if (index > octets.length - 1 || index > 6) { // CHECKSTYLE IGNORE MagicNumber
166 // IPV4 occupies last two octets
167 return false;
168 }
161 // Is last chunk an IPv4 address?
162 if (index == octets.length - 1 && octet.contains(".")) {
169163 if (!isValidInet4Address(octet)) {
170164 return false;
171165 }
177171 }
178172 int octetInt = 0;
179173 try {
180 octetInt = Integer.valueOf(octet, BASE_16).intValue();
174 octetInt = Integer.parseInt(octet, BASE_16);
181175 } catch (NumberFormatException e) {
182176 return false;
183177 }
187181 }
188182 validOctets++;
189183 }
190 if (validOctets < IPV6_MAX_HEX_GROUPS && !containsCompressedZeroes) {
184 if (validOctets > IPV6_MAX_HEX_GROUPS || (validOctets < IPV6_MAX_HEX_GROUPS && !containsCompressedZeroes)) {
191185 return false;
192186 }
193187 return true;
5858 * <li>using a specified pattern with a specified <code>Locale</code></li>
5959 * </ul>
6060 *
61 * @version $Revision: 1739356 $
61 * @version $Revision: 1782756 $
6262 * @since Validator 1.3.0
6363 */
6464 public class IntegerValidator extends AbstractNumberValidator {
249249 longValue > Integer.MAX_VALUE) {
250250 return null;
251251 }
252 return new Integer((int)longValue);
252 return Integer.valueOf((int)longValue);
253253 }
254254 }
7070 * Uniform Resource Identifiers (URI): Generic Syntax
7171 * </a>
7272 *
73 * @version $Revision: 1715435 $
73 * @version $Revision: 1783203 $
7474 * @since Validator 1.4
7575 */
7676 public class UrlValidator implements Serializable {
7777
7878 private static final long serialVersionUID = 7557161713937335013L;
79
80 private static final int MAX_UNSIGNED_16_BIT_INT = 0xFFFF; // port max
7981
8082 /**
8183 * Allows all validly formatted schemes to pass validation instead of
144146 private static final String USERINFO_CHARS_REGEX = "[a-zA-Z0-9%-._~!$&'()*+,;=]";
145147 // since neither ':' nor '@' are allowed chars, we don't need to use non-greedy matching
146148 private static final String USERINFO_FIELD_REGEX =
147 USERINFO_CHARS_REGEX + "+:" + // At least one character for the name
148 USERINFO_CHARS_REGEX + "*@"; // password may be absent
149 USERINFO_CHARS_REGEX + "+" + // At least one character for the name
150 "(?::" + USERINFO_CHARS_REGEX + "*)?@"; // colon and password may be absent
149151 private static final String AUTHORITY_REGEX =
150 "(?:\\[("+IPV6_REGEX+")\\]|(?:(?:"+USERINFO_FIELD_REGEX+")?([" + AUTHORITY_CHARS_REGEX + "]*)))(:\\d*)?(.*)?";
151 // 1 e.g. user:pass@ 2 3 4
152 "(?:\\[("+IPV6_REGEX+")\\]|(?:(?:"+USERINFO_FIELD_REGEX+")?([" + AUTHORITY_CHARS_REGEX + "]*)))(?::(\\d*))?(.*)?";
153 // 1 e.g. user:pass@ 2 3 4
152154 private static final Pattern AUTHORITY_PATTERN = Pattern.compile(AUTHORITY_REGEX);
153155
154156 private static final int PARSE_AUTHORITY_IPV6 = 1;
155157
156158 private static final int PARSE_AUTHORITY_HOST_IP = 2; // excludes userinfo, if present
157159
158 // Not needed, because it is validated by AUTHORITY_REGEX
159 // private static final int PARSE_AUTHORITY_PORT = 3;
160 private static final int PARSE_AUTHORITY_PORT = 3; // excludes leading colon
160161
161162 /**
162163 * Should always be empty. The code currently allows spaces.
166167 private static final String PATH_REGEX = "^(/[-\\w:@&?=+,.!/~*'%$_;\\(\\)]*)?$";
167168 private static final Pattern PATH_PATTERN = Pattern.compile(PATH_REGEX);
168169
169 private static final String QUERY_REGEX = "^(.*)$";
170 private static final String QUERY_REGEX = "^(\\S*)$";
170171 private static final Pattern QUERY_PATTERN = Pattern.compile(QUERY_REGEX);
171172
172173 /**
311312
312313 String authority = urlMatcher.group(PARSE_URL_AUTHORITY);
313314 if ("file".equals(scheme)) {// Special case - file: allows an empty authority
314 if (!"".equals(authority)) {
315 if (authority != null) {
315316 if (authority.contains(":")) { // but cannot allow trailing :
316317 return false;
317318 }
412413 return false;
413414 }
414415 }
416 String port = authorityMatcher.group(PARSE_AUTHORITY_PORT);
417 if (port != null && port.length() > 0) {
418 try {
419 int iPort = Integer.parseInt(port);
420 if (iPort < 0 || iPort > MAX_UNSIGNED_16_BIT_INT) {
421 return false;
422 }
423 } catch (NumberFormatException nfe) {
424 return false; // this can happen for big numbers
425 }
426 }
415427 }
416428
417429 String extra = authorityMatcher.group(PARSE_AUTHORITY_EXTRA);
0 /*
1 * Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.apache.commons.validator.routines.checkdigit;
17
18 import java.util.Arrays;
19
20 import org.apache.commons.validator.routines.CodeValidator;
21
22 /**
23 * General Modulus 10 Check Digit calculation/validation.
24 *
25 * <h3>How if Works</h3>
26 * <p>
27 * This implementation calculates/validates the check digit in the following
28 * way:
29 * <ul>
30 * <li>Converting each character to an integer value using
31 * <code>Character.getNumericValue(char)</code> - negative integer values from
32 * that method are invalid.</li>
33 * <li>Calculating a <i>weighted value</i> by multiplying the character's
34 * integer value by a <i>weighting factor</i>. The <i>weighting factor</i> is
35 * selected from the configured <code>postitionWeight</code> array based on its
36 * position. The <code>postitionWeight</code> values are used either
37 * left-to-right (when <code>useRightPos=false</code>) or right-to-left (when
38 * <code>useRightPos=true</code>).</li>
39 * <li>If <code>sumWeightedDigits=true</code>, the <i>weighted value</i> is
40 * re-calculated by summing its digits.</li>
41 * <li>The <i>weighted values</i> of each character are totalled.</li>
42 * <li>The total modulo 10 will be zero for a code with a valid Check Digit.</li>
43 * </ul>
44 * <h3>Limitations</h3>
45 * <p>
46 * This implementation has the following limitations:
47 * <ul>
48 * <li>It assumes the last character in the code is the Check Digit and
49 * validates that it is a numeric character.</li>
50 * <li>The only limitation on valid characters are those that
51 * <code>Character.getNumericValue(char)</code> returns a positive value. If,
52 * for example, the code should only contain numbers, this implementation does
53 * not check that.</li>
54 * <li>There are no checks on code length.</li>
55 * </ul>
56 * <p>
57 * <b>Note:</b> This implementation can be combined with the
58 * {@link CodeValidator} in order to ensure the length and characters are valid.
59 *
60 * <h3>Example Usage</h3>
61 * <p>
62 * This implementation was added after a number of Modulus 10 routines and these
63 * are shown re-implemented using this routine below:
64 *
65 * <p>
66 * <b>ABA Number</b> Check Digit Routine (equivalent of
67 * {@link ABANumberCheckDigit}). Weighting factors are <code>[1, 7, 3]</code>
68 * applied from right to left.
69 *
70 * <pre>
71 * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 7, 3 }, true);
72 * </pre>
73 *
74 * <p>
75 * <b>CUSIP</b> Check Digit Routine (equivalent of {@link CUSIPCheckDigit}).
76 * Weighting factors are <code>[1, 2]</code> applied from right to left and the
77 * digits of the <i>weighted value</i> are summed.
78 *
79 * <pre>
80 * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 2 }, true, true);
81 * </pre>
82 *
83 * <p>
84 * <b>EAN-13 / UPC</b> Check Digit Routine (equivalent of
85 * {@link EAN13CheckDigit}). Weighting factors are <code>[1, 3]</code> applied
86 * from right to left.
87 *
88 * <pre>
89 * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 3 }, true);
90 * </pre>
91 *
92 * <p>
93 * <b>Luhn</b> Check Digit Routine (equivalent of {@link LuhnCheckDigit}).
94 * Weighting factors are <code>[1, 2]</code> applied from right to left and the
95 * digits of the <i>weighted value</i> are summed.
96 *
97 * <pre>
98 * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 2 }, true, true);
99 * </pre>
100 *
101 * <p>
102 * <b>SEDOL</b> Check Digit Routine (equivalent of {@link SedolCheckDigit}).
103 * Weighting factors are <code>[1, 3, 1, 7, 3, 9, 1]</code> applied from left to
104 * right.
105 *
106 * <pre>
107 * CheckDigit routine = new ModulusTenCheckDigit(new int[] { 1, 3, 1, 7, 3, 9, 1 });
108 * </pre>
109 *
110 * @since Validator 1.6
111 * @version $Revision: 1739356 $
112 */
113 public final class ModulusTenCheckDigit extends ModulusCheckDigit {
114
115 private static final long serialVersionUID = -3752929983453368497L;
116
117 private final int[] postitionWeight;
118 private final boolean useRightPos;
119 private final boolean sumWeightedDigits;
120
121 /**
122 * Construct a modulus 10 Check Digit routine with the specified weighting
123 * from left to right.
124 *
125 * @param postitionWeight the weighted values to apply based on the
126 * character position
127 */
128 public ModulusTenCheckDigit(int[] postitionWeight) {
129 this(postitionWeight, false, false);
130 }
131
132 /**
133 * Construct a modulus 10 Check Digit routine with the specified weighting,
134 * indicating whether its from the left or right.
135 *
136 * @param postitionWeight the weighted values to apply based on the
137 * character position
138 * @param useRightPos <code>true</code> if use positionWeights from right to
139 * left
140 */
141 public ModulusTenCheckDigit(int[] postitionWeight, boolean useRightPos) {
142 this(postitionWeight, useRightPos, false);
143 }
144
145 /**
146 * Construct a modulus 10 Check Digit routine with the specified weighting,
147 * indicating whether its from the left or right and whether the weighted
148 * digits should be summed.
149 *
150 * @param postitionWeight the weighted values to apply based on the
151 * character position
152 * @param useRightPos <code>true</code> if use positionWeights from right to
153 * left
154 * @param sumWeightedDigits <code>true</code> if sum the digits of the
155 * weighted value
156 */
157 public ModulusTenCheckDigit(int[] postitionWeight, boolean useRightPos, boolean sumWeightedDigits) {
158 super(10); // CHECKSTYLE IGNORE MagicNumber
159 this.postitionWeight = Arrays.copyOf(postitionWeight, postitionWeight.length);
160 this.useRightPos = useRightPos;
161 this.sumWeightedDigits = sumWeightedDigits;
162 }
163
164 /**
165 * Validate a modulus check digit for a code.
166 * <p>
167 * Note: assumes last digit is the check digit
168 *
169 * @param code The code to validate
170 * @return <code>true</code> if the check digit is valid, otherwise
171 * <code>false</code>
172 */
173 @Override
174 public boolean isValid(String code) {
175 if (code == null || code.length() == 0) {
176 return false;
177 }
178 if (!Character.isDigit(code.charAt(code.length() - 1))) {
179 return false;
180 }
181
182 return super.isValid(code);
183 }
184
185 /**
186 * Convert a character at a specified position to an integer value.
187 * <p>
188 * <b>Note:</b> this implementation only handlers values that
189 * Character.getNumericValue(char) returns a non-negative number.
190 *
191 * @param character The character to convert
192 * @param leftPos The position of the character in the code, counting from
193 * left to right (for identifying the position in the string)
194 * @param rightPos The position of the character in the code, counting from
195 * right to left (not used here)
196 * @return The integer value of the character
197 * @throws CheckDigitException if Character.getNumericValue(char) returns a
198 * negative number
199 */
200 @Override
201 protected int toInt(char character, int leftPos, int rightPos) throws CheckDigitException {
202 int num = Character.getNumericValue(character);
203 if (num < 0) {
204 throw new CheckDigitException("Invalid Character[" + leftPos + "] = '" + character + "'");
205 }
206 return num;
207 }
208
209 /**
210 * Calculates the <i>weighted</i> value of a character in the code at a
211 * specified position.
212 *
213 * @param charValue The numeric value of the character.
214 * @param leftPos The position of the character in the code, counting from
215 * left to right
216 * @param rightPos The position of the character in the code, counting from
217 * right to left
218 * @return The weighted value of the character.
219 */
220 @Override
221 protected int weightedValue(int charValue, int leftPos, int rightPos) {
222 int pos = useRightPos ? rightPos : leftPos;
223 int weight = postitionWeight[(pos - 1) % postitionWeight.length];
224 int weightedValue = charValue * weight;
225 if (sumWeightedDigits) {
226 weightedValue = ModulusCheckDigit.sumDigits(weightedValue);
227 }
228 return weightedValue;
229 }
230
231 /**
232 * Return a string representation of this implementation.
233 *
234 * @return a string representation
235 */
236 @Override
237 public String toString() {
238 return getClass().getSimpleName() + "[postitionWeight=" + Arrays.toString(postitionWeight) + ", useRightPos="
239 + useRightPos + ", sumWeightedDigits=" + sumWeightedDigits + "]";
240 }
241
242 }
3737 <item name="Wiki" href="http://wiki.apache.org/commons/Validator"/>
3838 </menu>
3939
40 <menu name="JavaDocs">
41 <item name="1.5.1 Release" href="javadocs/api-1.5.1/"/>
42 <item name="1.5.0 Release" href="javadocs/api-1.5.0/"/>
43 <item name="1.4.1 Release" href="javadocs/api-1.4.1/"/>
44 <item name="1.4.0 Release" href="javadocs/api-1.4.0/"/>
45 <item name="1.3.1 Release" href="javadocs/api-1.3.1/"/>
46 <item name="1.3.0 Release" href="javadocs/api-1.3.0/"/>
47 <item name="1.2.0 Release" href="javadocs/api-1.2.0/"/>
48 <item name="1.1.4 Release" href="javadocs/api-1.1.4/"/>
49 <item name="1.0.2 Release" href="javadocs/api-1.0.2/"/>
50 </menu>
51
5240 <menu name="Development">
5341 <item name="JavaDocs" href="/apidocs/index.html"/>
5442 <item name="Mailing Lists" href="/mail-lists.html"/>
3030 | 2) Set the following properties in the component's pom: |
3131 | - commons.componentid (required, alphabetic, lower case) |
3232 | - commons.release.version (required) |
33 | - commons.binary.suffix (optional) |
33 | - commons.release.name (required) |
34 | - commons.binary.suffix (optional) |
3435 | (defaults to "-bin", set to "" for pre-maven2 releases) |
36 | - commons.release.desc (optional) |
37 | - commons.release.subdir (optional) |
38 | |
39 | - commons.release.2/3.version (conditional) |
40 | - commons.release.2/3.name (conditional) |
41 | - commons.release.2/3.binary.suffix (optional) |
42 | - commons.release.2/3.desc (optional) |
43 | - commons.release.2/3.subdir (optional) |
3544 | |
3645 | 3) Example Properties |
46 | (commons.release.name inherited by parent: |
47 | ${project.artifactId}-${commons.release.version} |
3748 | |
3849 | <properties> |
3950 | <commons.componentid>math</commons.componentid> |
4556 <document>
4657 <properties>
4758 <title>Download Apache Commons Validator</title>
48 <author email="dev@commons.apache.org">Commons Documentation Team</author>
59 <author email="dev@commons.apache.org">Apache Commons Documentation Team</author>
4960 </properties>
5061 <body>
5162 <section name="Download Apache Commons Validator">
5263 <subsection name="Using a Mirror">
5364 <p>
5465 We recommend you use a mirror to download our release
55 builds, but you <strong>must</strong> verify the integrity of
66 builds, but you <strong>must</strong> <a href="http://www.apache.org/info/verification.html">verify the integrity</a> of
5667 the downloaded files using signatures downloaded from our main
5768 distribution directories. Recent releases (48 hours) may not yet
58 be available from the mirrors.
69 be available from all the mirrors.
5970 </p>
6071
6172 <p>
8798 </form>
8899
89100 <p>
90 The <a href="http://www.apache.org/dist/commons/KEYS">KEYS</a>
91 link links to the code signing keys used to sign the product.
92 The <code>PGP</code> link downloads the OpenPGP compatible signature from our main site.
93 The <code>MD5</code> link downloads the checksum from the main site.
101 It is essential that you
102 <a href="https://www.apache.org/info/verification.html">verify the integrity</a>
103 of downloaded files, preferably using the <code>PGP</code> signature (<code>*.asc</code> files);
104 failing that using the <code>MD5</code> hash (<code>*.md5</code> checksum files).
105 </p>
106 <p>
107 The <a href="https://www.apache.org/dist/commons/KEYS">KEYS</a>
108 file contains the public PGP keys used by Apache Commons developers
109 to sign releases.
94110 </p>
95111 </subsection>
96112 </section>
97 <section name="Apache Commons Validator 1.5.1 (requires JDK 1.6)">
113 <section name="Apache Commons Validator 1.6 (requires JDK 1.6)">
98114 <subsection name="Binaries">
99115 <table>
100116 <tr>
101 <td><a href="[preferred]/commons/validator/binaries/commons-validator-1.5.1-bin.tar.gz">commons-validator-1.5.1-bin.tar.gz</a></td>
102 <td><a href="http://www.apache.org/dist/commons/validator/binaries/commons-validator-1.5.1-bin.tar.gz.md5">md5</a></td>
103 <td><a href="http://www.apache.org/dist/commons/validator/binaries/commons-validator-1.5.1-bin.tar.gz.asc">pgp</a></td>
117 <td><a href="[preferred]/commons/validator/binaries/commons-validator-1.6-bin.tar.gz">commons-validator-1.6-bin.tar.gz</a></td>
118 <td><a href="https://www.apache.org/dist/commons/validator/binaries/commons-validator-1.6-bin.tar.gz.md5">md5</a></td>
119 <td><a href="https://www.apache.org/dist/commons/validator/binaries/commons-validator-1.6-bin.tar.gz.asc">pgp</a></td>
104120 </tr>
105121 <tr>
106 <td><a href="[preferred]/commons/validator/binaries/commons-validator-1.5.1-bin.zip">commons-validator-1.5.1-bin.zip</a></td>
107 <td><a href="http://www.apache.org/dist/commons/validator/binaries/commons-validator-1.5.1-bin.zip.md5">md5</a></td>
108 <td><a href="http://www.apache.org/dist/commons/validator/binaries/commons-validator-1.5.1-bin.zip.asc">pgp</a></td>
122 <td><a href="[preferred]/commons/validator/binaries/commons-validator-1.6-bin.zip">commons-validator-1.6-bin.zip</a></td>
123 <td><a href="https://www.apache.org/dist/commons/validator/binaries/commons-validator-1.6-bin.zip.md5">md5</a></td>
124 <td><a href="https://www.apache.org/dist/commons/validator/binaries/commons-validator-1.6-bin.zip.asc">pgp</a></td>
109125 </tr>
110126 </table>
111127 </subsection>
112128 <subsection name="Source">
113129 <table>
114130 <tr>
115 <td><a href="[preferred]/commons/validator/source/commons-validator-1.5.1-src.tar.gz">commons-validator-1.5.1-src.tar.gz</a></td>
116 <td><a href="http://www.apache.org/dist/commons/validator/source/commons-validator-1.5.1-src.tar.gz.md5">md5</a></td>
117 <td><a href="http://www.apache.org/dist/commons/validator/source/commons-validator-1.5.1-src.tar.gz.asc">pgp</a></td>
131 <td><a href="[preferred]/commons/validator/source/commons-validator-1.6-src.tar.gz">commons-validator-1.6-src.tar.gz</a></td>
132 <td><a href="https://www.apache.org/dist/commons/validator/source/commons-validator-1.6-src.tar.gz.md5">md5</a></td>
133 <td><a href="https://www.apache.org/dist/commons/validator/source/commons-validator-1.6-src.tar.gz.asc">pgp</a></td>
118134 </tr>
119135 <tr>
120 <td><a href="[preferred]/commons/validator/source/commons-validator-1.5.1-src.zip">commons-validator-1.5.1-src.zip</a></td>
121 <td><a href="http://www.apache.org/dist/commons/validator/source/commons-validator-1.5.1-src.zip.md5">md5</a></td>
122 <td><a href="http://www.apache.org/dist/commons/validator/source/commons-validator-1.5.1-src.zip.asc">pgp</a></td>
123 </tr>
124 </table>
125 </subsection>
126 </section>
127 <section name="Apache Commons Validator 1.4.1 (requires JDK 1.4)">
128 <subsection name="Binaries">
129 <table>
130 <tr>
131 <td><a href="[preferred]/commons/validator/binaries/commons-validator-1.4.1.tar.gz">commons-validator-1.4.1.tar.gz</a></td>
132 <td><a href="http://www.apache.org/dist/commons/validator/binaries/commons-validator-1.4.1.tar.gz.md5">md5</a></td>
133 <td><a href="http://www.apache.org/dist/commons/validator/binaries/commons-validator-1.4.1.tar.gz.asc">pgp</a></td>
134 </tr>
135 <tr>
136 <td><a href="[preferred]/commons/validator/binaries/commons-validator-1.4.1.zip">commons-validator-1.4.1.zip</a></td>
137 <td><a href="http://www.apache.org/dist/commons/validator/binaries/commons-validator-1.4.1.zip.md5">md5</a></td>
138 <td><a href="http://www.apache.org/dist/commons/validator/binaries/commons-validator-1.4.1.zip.asc">pgp</a></td>
139 </tr>
140 </table>
141 </subsection>
142 <subsection name="Source">
143 <table>
144 <tr>
145 <td><a href="[preferred]/commons/validator/source/commons-validator-1.4.1-src.tar.gz">commons-validator-1.4.1-src.tar.gz</a></td>
146 <td><a href="http://www.apache.org/dist/commons/validator/source/commons-validator-1.4.1-src.tar.gz.md5">md5</a></td>
147 <td><a href="http://www.apache.org/dist/commons/validator/source/commons-validator-1.4.1-src.tar.gz.asc">pgp</a></td>
148 </tr>
149 <tr>
150 <td><a href="[preferred]/commons/validator/source/commons-validator-1.4.1-src.zip">commons-validator-1.4.1-src.zip</a></td>
151 <td><a href="http://www.apache.org/dist/commons/validator/source/commons-validator-1.4.1-src.zip.md5">md5</a></td>
152 <td><a href="http://www.apache.org/dist/commons/validator/source/commons-validator-1.4.1-src.zip.asc">pgp</a></td>
136 <td><a href="[preferred]/commons/validator/source/commons-validator-1.6-src.zip">commons-validator-1.6-src.zip</a></td>
137 <td><a href="https://www.apache.org/dist/commons/validator/source/commons-validator-1.6-src.zip.md5">md5</a></td>
138 <td><a href="https://www.apache.org/dist/commons/validator/source/commons-validator-1.6-src.zip.asc">pgp</a></td>
153139 </tr>
154140 </table>
155141 </subsection>
160146 </p>
161147 <ul>
162148 <li class="download"><a href="[preferred]/commons/validator/">browse download area</a></li>
163 <li><a href="http://archive.apache.org/dist/commons/validator/">archives...</a></li>
149 <li><a href="https://archive.apache.org/dist/commons/validator/">archives...</a></li>
164150 </ul>
165151 </section>
166152 </body>
2323 /**
2424 * Performs Validation Test for locale validations.
2525 *
26 * @version $Revision: 1739356 $
26 * @version $Revision: 1747121 $
2727 */
2828 public class LocaleTest extends AbstractCommonTest {
2929
4747 /**
4848 * Load <code>ValidatorResources</code> from validator-locale.xml.
4949 *
50 * @exception IOException If something goes wrong
51 * @exception SAXException If something goes wrong
50 * @throws IOException If something goes wrong
51 * @throws SAXException If something goes wrong
5252 */
5353 @Override
5454 protected void setUp()
6666 * See what happens when we try to validate with a Locale, Country and
6767 * variant. Also check if the added locale validation field is getting used.
6868 *
69 * @exception ValidatorException If something goes wrong
69 * @throws ValidatorException If something goes wrong
7070 */
7171 public void testLocale1()
7272 throws ValidatorException {
8282 * See what happens when we try to validate with a Locale, Country and
8383 * variant
8484 *
85 * @exception ValidatorException If something goes wrong
85 * @throws ValidatorException If something goes wrong
8686 */
8787 public void testLocale2()
8888 throws ValidatorException {
9898 * See what happens when we try to validate with a Locale, Country and
9999 * variant
100100 *
101 * @exception ValidatorException If something goes wrong
101 * @throws ValidatorException If something goes wrong
102102 */
103103 public void testLocale3()
104104 throws ValidatorException {
115115 * set. Bug #16920 states that this isn't happening, even though it is
116116 * passing this test. see #16920.
117117 *
118 * @exception ValidatorException If something goes wrong
118 * @throws ValidatorException If something goes wrong
119119 */
120120 public void testLocale4()
121121 throws ValidatorException {
130130 /**
131131 * See if a locale of language=en falls back to default form set.
132132 *
133 * @exception ValidatorException If something goes wrong
133 * @throws ValidatorException If something goes wrong
134134 */
135135 public void testLocale5()
136136 throws ValidatorException {
150150 * @param firstGood param
151151 * @param lastGood param
152152 * @param middleGood param
153 * @exception ValidatorException If something goes wrong
153 * @throws ValidatorException If something goes wrong
154154 */
155155 private void valueTest(Object name, Locale loc, boolean firstGood, boolean lastGood, boolean middleGood)
156156 throws ValidatorException {
1717
1818 import junit.framework.TestCase;
1919 import org.apache.commons.validator.routines.checkdigit.LuhnCheckDigit;
20 import org.apache.commons.validator.routines.CreditCardValidator.CreditCardRange;
2021
2122 /**
2223 * Test the CreditCardValidator class.
2324 *
24 * @version $Revision: 1739207 $
25 * @version $Revision: 1782740 $
2526 */
2627 public class CreditCardValidatorTest extends TestCase {
2728
28 private static final String VALID_VISA = "4417123456789113";
29 private static final String ERROR_VISA = "4417123456789112";
30 private static final String VALID_SHORT_VISA = "4222222222222";
29 private static final String VALID_VISA = "4417123456789113"; // 16
30 private static final String ERROR_VISA = "4417123456789112";
31 private static final String VALID_SHORT_VISA = "4222222222222"; // 13
3132 private static final String ERROR_SHORT_VISA = "4222222222229";
32 private static final String VALID_AMEX = "378282246310005";
33 private static final String ERROR_AMEX = "378282246310001";
33 private static final String VALID_AMEX = "378282246310005"; // 15
34 private static final String ERROR_AMEX = "378282246310001";
3435 private static final String VALID_MASTERCARD = "5105105105105100";
3536 private static final String ERROR_MASTERCARD = "5105105105105105";
36 private static final String VALID_DISCOVER = "6011000990139424";
37 private static final String ERROR_DISCOVER = "6011000990139421";
37 private static final String VALID_DISCOVER = "6011000990139424";
38 private static final String ERROR_DISCOVER = "6011000990139421";
3839 private static final String VALID_DISCOVER65 = "6534567890123458"; // FIXME need verified test data for Discover with "65" prefix
3940 private static final String ERROR_DISCOVER65 = "6534567890123450"; // FIXME need verified test data for Discover with "65" prefix
40 private static final String VALID_DINERS = "30569309025904";
41 private static final String ERROR_DINERS = "30569309025901";
42 private static final String VALID_VPAY = "4370000000000061";
43 private static final String VALID_VPAY2 = "4370000000000012";
44 private static final String ERROR_VPAY = "4370000000000069";
41 private static final String VALID_DINERS = "30569309025904"; // 14
42 private static final String ERROR_DINERS = "30569309025901";
43 private static final String VALID_VPAY = "4370000000000061"; // 16
44 private static final String VALID_VPAY2 = "4370000000000012";
45 private static final String ERROR_VPAY = "4370000000000069";
46
47 private static final String [] VALID_CARDS = {
48 VALID_VISA,
49 VALID_SHORT_VISA,
50 VALID_AMEX,
51 VALID_MASTERCARD,
52 VALID_DISCOVER,
53 VALID_DISCOVER65,
54 VALID_DINERS,
55 VALID_VPAY,
56 VALID_VPAY2,
57 };
58
59 private static final String [] ERROR_CARDS = {
60 ERROR_VISA,
61 ERROR_SHORT_VISA,
62 ERROR_AMEX,
63 ERROR_MASTERCARD,
64 ERROR_DISCOVER,
65 ERROR_DISCOVER65,
66 ERROR_DINERS,
67 ERROR_VPAY,
68 // ERROR_VPAY2,
69 "",
70 "12345678901", // too short (11)
71 "12345678901234567890", // too long (20)
72 "4417123456789112", // invalid check digit
73 };
4574
4675 /**
4776 * Constructor for CreditCardValidatorTest.
521550 assertEquals("Valid-D", "5123456789012346", validator.validate("5123456789012346"));
522551 }
523552
553 public void testGeneric() {
554 CreditCardValidator ccv = CreditCardValidator.genericCreditCardValidator();
555 for(String s : VALID_CARDS) {
556 assertTrue(s, ccv.isValid(s));
557 }
558 for(String s : ERROR_CARDS) {
559 assertFalse(s, ccv.isValid(s));
560 }
561 }
562
563 public void testRangeGeneratorNoLuhn() {
564 CodeValidator cv = CreditCardValidator.createRangeValidator(
565 new CreditCardRange[]{
566 new CreditCardRange("1",null,6,7),
567 new CreditCardRange("644","65", 8, 8)
568 },
569 null);
570 assertTrue(cv.isValid("1990000"));
571 assertTrue(cv.isValid("199000"));
572 assertFalse(cv.isValid("000000"));
573 assertFalse(cv.isValid("099999"));
574 assertFalse(cv.isValid("200000"));
575
576 assertFalse(cv.isValid("64399999"));
577 assertTrue(cv.isValid("64400000"));
578 assertTrue(cv.isValid("64900000"));
579 assertTrue(cv.isValid("65000000"));
580 assertTrue(cv.isValid("65999999"));
581 assertFalse(cv.isValid("66000000"));
582 }
583
584 public void testRangeGenerator() {
585 CreditCardValidator ccv = new CreditCardValidator(
586 new CodeValidator[] {
587 CreditCardValidator.AMEX_VALIDATOR,
588 CreditCardValidator.VISA_VALIDATOR,
589 CreditCardValidator.MASTERCARD_VALIDATOR,
590 CreditCardValidator.DISCOVER_VALIDATOR,
591 },
592 // Add missing validator
593 new CreditCardRange[]{
594 new CreditCardRange("300", "305", 14, 14), // Diners
595 new CreditCardRange("3095", null, 14, 14), // Diners
596 new CreditCardRange("36", null, 14, 14), // Diners
597 new CreditCardRange("38", "39", 14, 14), // Diners
598 }
599 // we don't have any VPAY examples yet that aren't handled by VISA
600 );
601 for(String s : VALID_CARDS) {
602 assertTrue(s, ccv.isValid(s));
603 }
604 for(String s : ERROR_CARDS) {
605 assertFalse(s, ccv.isValid(s));
606 }
607 }
608
609 public void testValidLength() {
610 assertTrue(CreditCardValidator.validLength(14, new CreditCardRange("", "", 14, 14)));
611 assertFalse(CreditCardValidator.validLength(15, new CreditCardRange("", "", 14, 14)));
612 assertFalse(CreditCardValidator.validLength(13, new CreditCardRange("", "", 14, 14)));
613
614 assertFalse(CreditCardValidator.validLength(14, new CreditCardRange("", "", 15, 17)));
615 assertTrue(CreditCardValidator.validLength(15, new CreditCardRange("", "", 15, 17)));
616 assertTrue(CreditCardValidator.validLength(16, new CreditCardRange("", "", 15, 17)));
617 assertTrue(CreditCardValidator.validLength(17, new CreditCardRange("", "", 15, 17)));
618 assertFalse(CreditCardValidator.validLength(18, new CreditCardRange("", "", 15, 17)));
619
620 assertFalse(CreditCardValidator.validLength(14, new CreditCardRange("", "", new int[]{15, 17})));
621 assertTrue(CreditCardValidator.validLength(15, new CreditCardRange("", "", new int[]{15, 17})));
622 assertFalse(CreditCardValidator.validLength(16, new CreditCardRange("", "", new int[]{15, 17})));
623 assertTrue(CreditCardValidator.validLength(17, new CreditCardRange("", "", new int[]{15, 17})));
624 assertFalse(CreditCardValidator.validLength(18, new CreditCardRange("", "", new int[]{15, 17})));
625 }
626
627 public void testDisjointRange() {
628 CreditCardValidator ccv = new CreditCardValidator(
629 new CreditCardRange[]{
630 new CreditCardRange("305", "4", new int[]{13, 16}),
631 }
632 );
633 assertEquals(13, VALID_SHORT_VISA.length());
634 assertEquals(16, VALID_VISA.length());
635 assertEquals(14, VALID_DINERS.length());
636 assertTrue(ccv.isValid(VALID_SHORT_VISA));
637 assertTrue(ccv.isValid(VALID_VISA));
638 assertFalse(ccv.isValid(ERROR_SHORT_VISA));
639 assertFalse(ccv.isValid(ERROR_VISA));
640 assertFalse(ccv.isValid(VALID_DINERS));
641 ccv = new CreditCardValidator(
642 new CreditCardRange[]{
643 // add 14 as a valid length
644 new CreditCardRange("305", "4", new int[]{13, 14, 16}),
645 }
646 );
647 assertTrue(ccv.isValid(VALID_DINERS));
648 }
524649 }
4646 /**
4747 * Tests for the DomainValidator.
4848 *
49 * @version $Revision: 1739361 $
49 * @version $Revision: 1781829 $
5050 */
5151 public class DomainValidatorTest extends TestCase {
5252
367367 assertTrue(validator.isValidGenericTld("com"));
368368 }
369369
370 public void testVALIDATOR_412() {
371 assertFalse(validator.isValidGenericTld("local"));
372 assertFalse(validator.isValid("abc.local"));
373 assertFalse(validator.isValidGenericTld("pvt"));
374 assertFalse(validator.isValid("abc.pvt"));
375 DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"local", "pvt"});
376 assertTrue(validator.isValidGenericTld("local"));
377 assertTrue(validator.isValid("abc.local"));
378 assertTrue(validator.isValidGenericTld("pvt"));
379 assertTrue(validator.isValid("abc.pvt"));
380 }
381
370382 public void testCannotUpdate() {
371383 DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"}); // OK
372384 DomainValidator dv = DomainValidator.getInstance();
395407 Set<String> ianaTlds = new HashSet<String>(); // keep for comparison with array contents
396408 DomainValidator dv = DomainValidator.getInstance();
397409 File txtFile = new File("target/tlds-alpha-by-domain.txt");
398 long timestamp = download(txtFile, "http://data.iana.org/TLD/tlds-alpha-by-domain.txt", 0L);
410 long timestamp = download(txtFile, "https://data.iana.org/TLD/tlds-alpha-by-domain.txt", 0L);
399411 final File htmlFile = new File("target/tlds-alpha-by-domain.html");
400412 // N.B. sometimes the html file may be updated a day or so after the txt file
401413 // if the txt file contains entries not found in the html file, try again in a day or two
402 download(htmlFile,"http://www.iana.org/domains/root/db", timestamp);
414 download(htmlFile,"https://www.iana.org/domains/root/db", timestamp);
403415
404416 BufferedReader br = new BufferedReader(new FileReader(txtFile));
405417 String line;
3333 // so we test for both where possible
3434 // Note that the BIC near the start of the code is always upper case or digits
3535 private final String[] validIBANFormat = new String[] {
36 "AD1200012030200359100100",
37 "AE070331234567890123456",
3638 "AL47212110090000000235698741",
37 "AD1200012030200359100100",
3839 "AT611904300234573201",
3940 "AZ21NABZ00000000137010001944",
41 "BA391290079401028494",
42 "BE68539007547034",
43 "BG80BNBG96611020345678",
4044 "BH67BMAG00001299123456",
41 "BE68539007547034",
42 "BA391290079401028494",
45 "BR1800000000141455123924100C2",
46 "BR1800360305000010009795493C1",
4347 "BR9700360305000010009795493P1",
44 "BR1800000000141455123924100C2",
45 "BG80BNBG96611020345678",
46 "CR0515202001026284066",
47 "HR1210010051863000160",
48 // TODO add BY valid example
49 "CH9300762011623852957",
50 "CR05015202001026284066",
4851 "CY17002001280000001200527600",
4952 "CZ6508000000192000145399",
5053 "CZ9455000000001011038930",
54 "DE89370400440532013000",
5155 "DK5000400440116243",
52 "FO6264600001631634",
53 "GL8964710001000206",
5456 "DO28BAGR00000001212453611324",
5557 "EE382200221020145685",
58 "ES9121000418450200051332",
5659 "FI2112345600000785",
5760 "FI5542345670000081",
61 "FO6264600001631634",
5862 "FR1420041010050500013M02606",
63 "GB29NWBK60161331926819",
5964 "GE29NB0000000101904917",
60 "DE89370400440532013000",
6165 "GI75NWBK000000007099453",
66 "GL8964710001000206",
6267 "GR1601101250000000012300695",
6368 "GT82TRAJ01020000001210029690",
69 "HR1210010051863000160",
6470 "HU42117730161111101800000000",
65 "IS140159260076545510730339",
6671 "IE29AIBK93115212345678",
6772 "IL620108000000099999999",
73 "IQ98NBIQ850123456789012",
74 "IS140159260076545510730339",
6875 "IT60X0542811101000000123456",
6976 "JO94CBJO0010000000000131000302",
77 "KW81CBKU0000000000001234560101",
7078 "KZ86125KZT5004100100",
71 "XK051212012345678906",
72 "KW81CBKU0000000000001234560101",
73 "LV80BANK0000435195001",
7479 "LB62099900000001001901229114",
80 "LC55HEMM000100010012001200023015",
7581 "LI21088100002324013AA",
7682 "LT121000011101001000",
7783 "LU280019400644750000",
84 "LV80BANK0000435195001",
85 "MC5811222000010123456789030",
86 "MD24AG000225100013104168",
87 "ME25505000012345678951",
7888 "MK07250120000058984",
89 "MR1300020001010000123456753",
7990 "MT84MALT011000012345MTLCAST001S",
80 "MR1300020001010000123456753",
8191 "MU17BOMM0101101030300200000MUR",
82 "MD24AG000225100013104168",
83 "MC5811222000010123456789030",
84 "ME25505000012345678951",
8592 "NL91ABNA0417164300",
8693 "NO9386011117947",
8794 "PK36SCBL0000001123456702",
95 "PL61109010140000071219812874",
8896 "PS92PALS000000000400123456702",
89 "PL61109010140000071219812874",
9097 "PT50000201231234567890154",
9198 "QA58DOHB00001234567890ABCDEFG",
9299 "RO49AAAA1B31007593840000",
93 "LC55HEMM000100010012001200023015", // the SWIFT docs have LC62...
100 "RS35260005601001611379",
101 "SA0380000000608010167519",
102 "SC18SSCB11010000000000001497USD",
103 "SE4550000000058398257466",
104 "SI56191000000123438",
105 "SI56263300012039086",
106 "SK3112000000198742637541",
94107 "SM86U0322509800000000270100",
95108 "ST68000100010051845310112",
96 "SA0380000000608010167519",
97 "RS35260005601001611379",
98 "SK3112000000198742637541",
99 "SI56191000000123438",
100 "ES9121000418450200051332",
101 "SE4550000000058398257466",
102 "CH9300762011623852957",
103109 "TL380080012345678910157",
104110 "TN5910006035183598478831",
105111 "TR330006100519786457841326",
106 "AE070331234567890123456",
107 "GB29NWBK60161331926819",
112 "UA213223130000026007233566001",
113 "UA213996220000026007233566001",
108114 "VG96VPVG0000012345678901",
109 };
115 "XK051212012345678906",
116 };
110117
111118 private final String[] invalidIBANFormat = new String[] {
112119 "", // empty
119126 "QA58DOHB00001234567890abcdefg", // lowercase version
120127 "RO49AAAA1b31007593840000", // lowercase version
121128 "LC62HEMM000100010012001200023015", // wrong in SWIFT
129 "BY00NBRB3600000000000Z00AB00", // Wrong in SWIFT v73
130 "ST68000200010192194210112", // ditto
131 "SV62CENR0000000000000700025", // ditto
122132 };
123133
124134 private static final IBANValidator VALIDATOR = IBANValidator.getInstance();
2121 /**
2222 * Test cases for InetAddressValidator.
2323 *
24 * @version $Revision: 1739356 $
24 * @version $Revision: 1783032 $
2525 */
2626 public class InetAddressValidatorTest extends TestCase {
2727
5454 assertTrue("2001:0438:FFFE:0000:0000:0000:0000:0A35 should be valid", validator.isValid("2001:0438:FFFE:0000:0000:0000:0000:0A35"));
5555 }
5656
57 public void testVALIDATOR_419() {
58 String addr;
59 addr = "0:0:0:0:0:0:13.1.68.3";
60 assertTrue(addr, validator.isValid(addr));
61 addr = "0:0:0:0:0:FFFF:129.144.52.38";
62 assertTrue(addr, validator.isValid(addr));
63 addr = "::13.1.68.3";
64 assertTrue(addr, validator.isValid(addr));
65 addr = "::FFFF:129.144.52.38";
66 assertTrue(addr, validator.isValid(addr));
67
68 addr = "::ffff:192.168.1.1:192.168.1.1";
69 assertFalse(addr, validator.isValid(addr));
70 addr = "::192.168.1.1:192.168.1.1";
71 assertFalse(addr, validator.isValid(addr));
72 }
73
5774 /**
5875 * Test valid and invalid IPs from each address class.
5976 */
87104 */
88105 public void testBrokenInetAddresses() {
89106 assertFalse("IP with characters should be invalid", validator.isValid("124.14.32.abc"));
90 assertFalse("IP with leading zeroes should be invalid", validator.isValid("124.14.32.01"));
107 // assertFalse("IP with leading zeroes should be invalid", validator.isValid("124.14.32.01"));
91108 assertFalse("IP with three groups should be invalid", validator.isValid("23.64.12"));
92109 assertFalse("IP with five groups should be invalid", validator.isValid("26.34.23.77.234"));
93110 }
101118 public void testIPv6() {
102119 // The original Perl script contained a lot of duplicate tests.
103120 // I removed the duplicates I noticed, but there may be more.
104 assertFalse("IPV6 empty string should be invalid", validator.isValidInet6Address(""));// empty string
121 // assertFalse("IPV6 empty string should be invalid", validator.isValidInet6Address(""));// empty string
105122 assertTrue("IPV6 ::1 should be valid", validator.isValidInet6Address("::1"));// loopback, compressed, non-routable
106123 assertTrue("IPV6 :: should be valid", validator.isValidInet6Address("::"));// unspecified, compressed, non-routable
107124 assertTrue("IPV6 0:0:0:0:0:0:0:1 should be valid", validator.isValidInet6Address("0:0:0:0:0:0:0:1"));// loopback, full
2222 /**
2323 * Performs Validation Test for url validations.
2424 *
25 * @version $Revision: 1739356 $
25 * @version $Revision: 1783203 $
2626 */
2727 public class UrlValidatorTest extends TestCase {
2828
176176
177177 // Now check using options
178178 validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);
179
179
180180 assertTrue("localhost URL should validate",
181181 validator.isValid("http://localhost/test/index.html"));
182
182
183183 assertTrue("machinename URL should validate",
184184 validator.isValid("http://machinename/test/index.html"));
185
185
186186 assertTrue("www.apache.org should still validate",
187187 validator.isValid("http://www.apache.org/test/index.html"));
188188 }
195195
196196 assertTrue("hostname with path should validate",
197197 validator.isValid("http://hostname/test/index.html"));
198
198
199199 assertTrue("localhost URL should validate",
200200 validator.isValid("http://localhost/test/index.html"));
201
201
202202 assertFalse("first.my-testing should not validate",
203203 validator.isValid("http://first.my-testing/test/index.html"));
204204
216216
217217 assertFalse("localhost URL should no longer validate",
218218 validator.isValid("http://localhost/test/index.html"));
219
219
220220 assertTrue("www.apache.org should still validate",
221221 validator.isValid("http://www.apache.org/test/index.html"));
222222 }
223
223
224224 public void testValidator276() {
225225 // file:// isn't allowed by default
226226 UrlValidator validator = new UrlValidator();
227
227
228228 assertTrue("http://apache.org/ should be allowed by default",
229229 validator.isValid("http://www.apache.org/test/index.html"));
230
230
231231 assertFalse("file:///c:/ shouldn't be allowed by default",
232232 validator.isValid("file:///C:/some.file"));
233
233
234234 assertFalse("file:///c:\\ shouldn't be allowed by default",
235235 validator.isValid("file:///C:\\some.file"));
236
236
237237 assertFalse("file:///etc/ shouldn't be allowed by default",
238238 validator.isValid("file:///etc/hosts"));
239
239
240240 assertFalse("file://localhost/etc/ shouldn't be allowed by default",
241241 validator.isValid("file://localhost/etc/hosts"));
242
242
243243 assertFalse("file://localhost/c:/ shouldn't be allowed by default",
244244 validator.isValid("file://localhost/c:/some.file"));
245
245
246246 // Turn it on, and check
247247 // Note - we need to enable local urls when working with file:
248248 validator = new UrlValidator(new String[] {"http","file"}, UrlValidator.ALLOW_LOCAL_URLS);
249
249
250250 assertTrue("http://apache.org/ should be allowed by default",
251251 validator.isValid("http://www.apache.org/test/index.html"));
252
252
253253 assertTrue("file:///c:/ should now be allowed",
254254 validator.isValid("file:///C:/some.file"));
255
255
256256 // Currently, we don't support the c:\ form
257257 assertFalse("file:///c:\\ shouldn't be allowed",
258258 validator.isValid("file:///C:\\some.file"));
259
259
260260 assertTrue("file:///etc/ should now be allowed",
261261 validator.isValid("file:///etc/hosts"));
262
262
263263 assertTrue("file://localhost/etc/ should now be allowed",
264264 validator.isValid("file://localhost/etc/hosts"));
265
265
266266 assertTrue("file://localhost/c:/ should now be allowed",
267267 validator.isValid("file://localhost/c:/some.file"));
268
268
269269 // These are never valid
270270 assertFalse("file://c:/ shouldn't ever be allowed, needs file:///c:/",
271271 validator.isValid("file://C:/some.file"));
272
272
273273 assertFalse("file://c:\\ shouldn't ever be allowed, needs file:///c:/",
274274 validator.isValid("file://C:\\some.file"));
275275 }
276276
277
277 public void testValidator391OK() {
278 String[] schemes = {"file"};
279 UrlValidator urlValidator = new UrlValidator(schemes);
280 assertTrue(urlValidator.isValid("file:///C:/path/to/dir/"));
281 }
282
283 public void testValidator391FAILS() {
284 String[] schemes = {"file"};
285 UrlValidator urlValidator = new UrlValidator(schemes);
286 assertTrue(urlValidator.isValid("file:/C:/path/to/dir/"));
287 }
288
278289 public void testValidator309() {
279290 UrlValidator urlValidator = new UrlValidator();
280291 assertTrue(urlValidator.isValid("http://sample.ondemand.com/"));
310321 assertTrue(urlValidator.isValid("http://example.rocks"));
311322 }
312323
324 public void testValidator411(){
325 UrlValidator urlValidator = new UrlValidator();
326 assertTrue(urlValidator.isValid("http://example.rocks:/"));
327 assertTrue(urlValidator.isValid("http://example.rocks:0/"));
328 assertTrue(urlValidator.isValid("http://example.rocks:65535/"));
329 assertFalse(urlValidator.isValid("http://example.rocks:65536/"));
330 assertFalse(urlValidator.isValid("http://example.rocks:100000/"));
331 }
332
313333 static boolean incrementTestPartsIndex(int[] testPartsIndex, Object[] testParts) {
314334 boolean carry = true; //add 1 to lowest order part.
315335 boolean maxIndex = true;
316336 for (int testPartsIndexIndex = testPartsIndex.length - 1; testPartsIndexIndex >= 0; --testPartsIndexIndex) {
317337 int index = testPartsIndex[testPartsIndexIndex];
318338 ResultPair[] part = (ResultPair[]) testParts[testPartsIndexIndex];
339 maxIndex &= (index == (part.length - 1));
319340 if (carry) {
320341 if (index < part.length - 1) {
321342 index++;
326347 carry = true;
327348 }
328349 }
329 maxIndex &= (index == (part.length - 1));
330350 }
331351
332352
450470 assertTrue(validator.isValid("http://www.apache.org:80/path"));
451471 assertTrue(validator.isValid("http://user:pass@www.apache.org:80/path"));
452472 assertTrue(validator.isValid("http://user:@www.apache.org:80/path"));
473 assertTrue(validator.isValid("http://user@www.apache.org:80/path"));
453474 assertTrue(validator.isValid("http://us%00er:-._~!$&'()*+,;=@www.apache.org:80/path"));
454475 assertFalse(validator.isValid("http://:pass@www.apache.org:80/path"));
455476 assertFalse(validator.isValid("http://:@www.apache.org:80/path"));
464485
465486 public void testValidator380() {
466487 UrlValidator validator = new UrlValidator();
467 assertTrue(validator.isValid("http://www.apache.org:80/path"));
468 assertTrue(validator.isValid("http://www.apache.org:8/path"));
488 assertTrue(validator.isValid("http://www.apache.org:80/path"));
489 assertTrue(validator.isValid("http://www.apache.org:8/path"));
469490 assertTrue(validator.isValid("http://www.apache.org:/path"));
470491 }
471492
472 /**
473 * Only used to debug the unit tests.
474 * @param argv
475 */
476 public static void main(String[] argv) {
477
478 UrlValidatorTest fct = new UrlValidatorTest("url test");
479 fct.setUp();
480 fct.testIsValid();
481 fct.testIsValidScheme();
482 }
493 public void testValidator420() {
494 UrlValidator validator = new UrlValidator();
495 assertFalse(validator.isValid("http://example.com/serach?address=Main Avenue"));
496 assertTrue(validator.isValid("http://example.com/serach?address=Main%20Avenue"));
497 assertTrue(validator.isValid("http://example.com/serach?address=Main+Avenue"));
498 }
499
483500 //-------------------- Test data for creating a composite URL
484501 /**
485502 * The data given below approximates the 4 parts of a URL
496513 new ResultPair("http:/", false),
497514 new ResultPair("http:", false),
498515 new ResultPair("http/", false),
499 new ResultPair("://", false),
500 new ResultPair("", true)};
516 new ResultPair("://", false)};
501517
502518 ResultPair[] testUrlAuthority = {new ResultPair("www.google.com", true),
519 new ResultPair("www.google.com.", true),
503520 new ResultPair("go.com", true),
504521 new ResultPair("go.au", true),
505522 new ResultPair("0.0.0.0", true),
520537 new ResultPair("", false)
521538 };
522539 ResultPair[] testUrlPort = {new ResultPair(":80", true),
523 new ResultPair(":65535", true),
540 new ResultPair(":65535", true), // max possible
541 new ResultPair(":65536", false), // max possible +1
524542 new ResultPair(":0", true),
525543 new ResultPair("", true),
526544 new ResultPair(":-1", false),
527 new ResultPair(":65636", true),
545 new ResultPair(":65636", false),
546 new ResultPair(":999999999999999999", false),
528547 new ResultPair(":65a", false)
529548 };
530549 ResultPair[] testPath = {new ResultPair("/test1", true),
0 /*
1 * Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.apache.commons.validator.routines.checkdigit;
17
18
19 /**
20 * ModulusTenCheckDigit ABA Number Check Digit Test.
21 *
22 * @version $Revision: 1748035 $
23 */
24 public class ModulusTenABACheckDigitTest extends AbstractCheckDigitTest {
25
26 /**
27 * Constructor
28 * @param name test name
29 */
30 public ModulusTenABACheckDigitTest(String name) {
31 super(name);
32 }
33
34 /**
35 * Set up routine & valid codes.
36 */
37 @Override
38 protected void setUp() throws Exception {
39 super.setUp();
40 routine = new ModulusTenCheckDigit(new int[] { 1, 7, 3 }, true);
41 valid = new String[] {
42 "123456780",
43 "123123123",
44 "011000015",
45 "111000038",
46 "231381116",
47 "121181976"
48 };
49 }
50
51 }
0 /*
1 * Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.apache.commons.validator.routines.checkdigit;
17
18
19 /**
20 * ModulusTenCheckDigit CUSIP Test.
21 *
22 * @version $Revision: 1748035 $
23 */
24 public class ModulusTenCUSIPCheckDigitTest extends AbstractCheckDigitTest {
25
26 /**
27 * Construct a new test.
28 * @param name test name
29 */
30 public ModulusTenCUSIPCheckDigitTest(String name) {
31 super(name);
32 }
33
34 /**
35 * Set up routine & valid codes.
36 */
37 @Override
38 protected void setUp() throws Exception {
39 super.setUp();
40 routine = new ModulusTenCheckDigit(new int[] { 1, 2}, true, true);
41 valid = new String[] {"037833100",
42 "931142103",
43 "837649128",
44 "392690QT3",
45 "594918104",
46 "86770G101",
47 "Y8295N109",
48 "G8572F100"
49 };
50 invalid = new String[] {"0378#3100"};
51 }
52
53 private static String invalidCheckDigits[] = {"DUS0421CW",
54 "DUS0421CN",
55 "DUS0421CE"
56 };
57
58 public void testVALIDATOR_336_InvalidCheckDigits() {
59 for (int i = 0; i < invalidCheckDigits.length; i++) {
60 String invalidCheckDigit = invalidCheckDigits[i];
61 assertFalse("Should fail: " + invalidCheckDigit, routine.isValid(invalidCheckDigit));
62 }
63 }
64
65 private static String validCheckDigits[] = {"DUS0421C5"};
66
67 public void testVALIDATOR_336_ValidCheckDigits() {
68 for (int i = 0; i < validCheckDigits.length; i++) {
69 String validCheckDigit = validCheckDigits[i];
70 assertTrue("Should fail: " + validCheckDigit, routine.isValid(validCheckDigit));
71 }
72 }
73 }
0 /*
1 * Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.apache.commons.validator.routines.checkdigit;
17
18
19 /**
20 * ModulusTenCheckDigit EAN-13 Test.
21 *
22 * @version $Revision: 1748035 $
23 */
24 public class ModulusTenEAN13CheckDigitTest extends AbstractCheckDigitTest {
25
26 /**
27 * Constructor
28 * @param name test name
29 */
30 public ModulusTenEAN13CheckDigitTest(String name) {
31 super(name);
32 }
33
34 /**
35 * Set up routine & valid codes.
36 */
37 @Override
38 protected void setUp() throws Exception {
39 super.setUp();
40 routine = new ModulusTenCheckDigit(new int[] { 1, 3 }, true);
41 valid = new String[] {
42 "9780072129519",
43 "9780764558313",
44 "4025515373438",
45 "0095673400332"};
46 }
47
48 }
0 /*
1 * Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.apache.commons.validator.routines.checkdigit;
17
18
19 /**
20 * ModulusTenCheckDigit Luhn Test.
21 *
22 * @version $Revision: 1748035 $
23 */
24 public class ModulusTenLuhnCheckDigitTest extends AbstractCheckDigitTest {
25
26 private static final String VALID_VISA = "4417123456789113";
27 private static final String VALID_SHORT_VISA = "4222222222222";
28 private static final String VALID_AMEX = "378282246310005";
29 private static final String VALID_MASTERCARD = "5105105105105100";
30 private static final String VALID_DISCOVER = "6011000990139424";
31 private static final String VALID_DINERS = "30569309025904";
32
33 /**
34 * Constructor
35 * @param name test name
36 */
37 public ModulusTenLuhnCheckDigitTest(String name) {
38 super(name);
39 }
40
41 /**
42 * Set up routine & valid codes.
43 */
44 @Override
45 protected void setUp() throws Exception {
46 super.setUp();
47
48 routine = new ModulusTenCheckDigit(new int[] {1, 2}, true, true);
49
50 valid = new String[] {
51 VALID_VISA,
52 VALID_SHORT_VISA,
53 VALID_AMEX,
54 VALID_MASTERCARD,
55 VALID_DISCOVER,
56 VALID_DINERS};
57 }
58 }
0 /*
1 * Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.apache.commons.validator.routines.checkdigit;
17
18
19 /**
20 * ModulusTenCheckDigit SEDOL Test.
21 *
22 * @version $Revision: 1748035 $
23 */
24 public class ModulusTenSedolCheckDigitTest extends AbstractCheckDigitTest {
25
26 /**
27 * Constructor
28 * @param name test name
29 */
30 public ModulusTenSedolCheckDigitTest(String name) {
31 super(name);
32 }
33
34 /**
35 * Set up routine & valid codes.
36 */
37 @Override
38 protected void setUp() throws Exception {
39 super.setUp();
40 routine = new ModulusTenCheckDigit(new int[] { 1, 3, 1, 7, 3, 9, 1 });
41 valid = new String[] {
42 "0263494",
43 "0870612",
44 "B06LQ97",
45 "3437575",
46 "B07LF55",
47 };
48 invalid = new String[] {"123#567"};
49 zeroSum = "0000000";
50 }
51
52 private static String invalidCheckDigits[] = {
53 "026349E", // proper check digit is '4', see above
54 "087061C", // proper check digit is '2', see above
55 "B06LQ9H", // proper check digit is '7', see above
56 "343757F", // proper check digit is '5', see above
57 "B07LF5F", // proper check digit is '5', see above
58 };
59
60 public void testVALIDATOR_346() {
61 for (int i = 0; i < invalidCheckDigits.length; i++) {
62 String invalidCheckDigit = invalidCheckDigits[i];
63 assertFalse("Should fail: " + invalidCheckDigit, routine.isValid(invalidCheckDigit));
64 }
65 }
66
67 }