Added check for null in SyndTypeUtils
This commit is contained in:
parent
164ca08123
commit
3f8f9be652
@ -15,8 +15,12 @@ public class SyndTypeUtils {
|
||||
}
|
||||
|
||||
public static boolean typeValid(String type) {
|
||||
if (type == null) {
|
||||
return false;
|
||||
} else {
|
||||
return type.matches(VALID_MIMETYPE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be used if mime-type of enclosure tag is not supported. This
|
||||
@ -24,14 +28,16 @@ public class SyndTypeUtils {
|
||||
* the type is not supported, this method will return null.
|
||||
*/
|
||||
public static String getValidMimeTypeFromUrl(String url) {
|
||||
if (url != null) {
|
||||
String extension = FilenameUtils.getExtension(url);
|
||||
if (extension != null) {
|
||||
String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
|
||||
extension);
|
||||
String type = MimeTypeMap.getSingleton()
|
||||
.getMimeTypeFromExtension(extension);
|
||||
if (type != null && typeValid(type)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user