Skip to content

Commit

Permalink
#319 : Empty property value is not invalid + test.
Browse files Browse the repository at this point in the history
  • Loading branch information
flesire authored and dcoraboeuf committed May 8, 2014
1 parent c85b43c commit 97505d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.ontrack.core.support.InputException;
import net.sf.jstring.Strings;
import org.apache.commons.lang3.StringUtils;

import java.net.MalformedURLException;
import java.net.URI;
Expand All @@ -24,6 +25,11 @@ protected AbstractLinkPropertyExtensionDescriptor(String nameKey, String iconNam
*/
@Override
public void validate(String value) throws InputException {
// Empty value is allowed for property deletion
if(StringUtils.isEmpty(value)) {
return;
}

try {
// URI validation
new URI(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ public void validate_ok() {
descriptor.validate(link);
}

@Test
public void validate_empty_ok() {
String link = "";
descriptor.validate(link);
}

}

0 comments on commit 97505d7

Please sign in to comment.