if (value instanceof File) {
File file = (File) value;
try {
return FileUtil.toURL(file);
} catch (MalformedURLException muex) {
throw new TypeConversionException(value, muex);
}
}
if (value instanceof URI) {
URI uri = (URI) value;
try {
return uri.toURL();
} catch (MalformedURLException muex) {
throw new TypeConversionException(value, muex);
}
}
try {
return new URL(value.toString());
} catch (MalformedURLException muex) {
throw new TypeConversionException(value, muex);
}
}