Use UrlValidator to detect urls in tabular exporter
This commit is contained in:
parent
18c489855b
commit
6aa93bbc0c
@ -47,6 +47,7 @@ import java.util.Properties;
|
|||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.validator.routines.UrlValidator;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@ -228,6 +229,8 @@ abstract public class CustomizableTabularExporterUtilities {
|
|||||||
boolean date_omitTime = false;
|
boolean date_omitTime = false;
|
||||||
|
|
||||||
DateFormat dateFormatter;
|
DateFormat dateFormatter;
|
||||||
|
String[] urlSchemes = {"http","https", "ftp"};
|
||||||
|
UrlValidator urlValidator = new UrlValidator(urlSchemes);
|
||||||
|
|
||||||
Map<String, String> identifierSpaceToUrl = null;
|
Map<String, String> identifierSpaceToUrl = null;
|
||||||
|
|
||||||
@ -352,9 +355,8 @@ abstract public class CustomizableTabularExporterUtilities {
|
|||||||
text = (String) value;
|
text = (String) value;
|
||||||
|
|
||||||
if(text.contains(":")) {
|
if(text.contains(":")) {
|
||||||
try {
|
if(urlValidator.isValid(text)) {
|
||||||
link = new URL(text).toString();
|
link = text;
|
||||||
} catch (MalformedURLException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (value instanceof OffsetDateTime) {
|
} else if (value instanceof OffsetDateTime) {
|
||||||
|
Loading…
Reference in New Issue
Block a user