Improve readablilty

This commit is contained in:
Cj Malone 2016-10-13 05:56:26 +01:00
parent 0f7fe57454
commit 2c17e03397
1 changed files with 13 additions and 16 deletions

View File

@ -37,16 +37,12 @@ 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);
if (type != null && enclosureTypeValid(type)) {
return type;
}
}
String type = getMimeTypeFromUrl(url);
if (enclosureTypeValid(type)) {
return type;
} else {
return null;
}
return null;
}
/**
@ -54,13 +50,14 @@ public class SyndTypeUtils {
* method will return the mime-type of the file extension.
*/
public static String getMimeTypeFromUrl(String url) {
if (url != null) {
String extension = FilenameUtils.getExtension(url);
if (extension != null) {
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
}
if (url == null) {
return null;
}
String extension = FilenameUtils.getExtension(url);
if (extension == null) {
return null;
}
return null;
}
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
}
}