Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit a8eb02d

Browse files
author
sowerstl
committed
Trim certain inputs before validation, in prep for some data normalizing upon storage.
1 parent 23bcd4d commit a8eb02d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/gov/osti/services/Validation.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public static boolean isValidEmail(String value) {
271271
public static boolean isValidUrl(String value) {
272272
return ( null==value ) ?
273273
false :
274-
URL_PATTERN.matcher(value).matches();
274+
URL_PATTERN.matcher(value.trim()).matches();
275275
}
276276

277277
/**
@@ -350,8 +350,8 @@ public static boolean isValidRepositoryLink(String value) {
350350
return false;
351351

352352
// check what we consider "valid" for repository info
353-
return (GitRepository.isValid(value) ||
354-
SubversionRepository.isValid(value));
353+
return (GitRepository.isValid(value.trim())) ||
354+
SubversionRepository.isValid(value.trim());
355355
}
356356

357357
/**
@@ -363,7 +363,7 @@ public static boolean isValidRepositoryLink(String value) {
363363
*/
364364
public static boolean isValidDoi(String value) {
365365
// make sure the value, if present, conforms to DOI pattern.
366-
return (null==value) ? false : DOI_PATTERN.matcher(value).find();
366+
return (null==value) ? false : DOI_PATTERN.matcher(value.trim()).find();
367367
}
368368

369369
/**

0 commit comments

Comments
 (0)