diff options
author | Cj Malone <Cj-Malone@users.noreply.github.com> | 2016-10-13 05:56:26 +0100 |
---|---|---|
committer | Cj Malone <Cj-Malone@users.noreply.github.com> | 2016-10-13 06:40:18 +0100 |
commit | 2c17e033972a0498a15b58f9fb206c6d8d025d5b (patch) | |
tree | 4b81ec69c3bc71b1d2b90f56ff7cb411994f7c8e /core | |
parent | 0f7fe57454c8fd3c312daa479b2e141a39d56f6b (diff) | |
download | AntennaPod-2c17e033972a0498a15b58f9fb206c6d8d025d5b.zip |
Improve readablilty
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndTypeUtils.java | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndTypeUtils.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndTypeUtils.java index 3c92805b2..5b12fa772 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndTypeUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/util/SyndTypeUtils.java @@ -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); + } } |