From 2f9142419a538fc05a9d3509f19a25d13acccc73 Mon Sep 17 00:00:00 2001 From: Faisal Hameed Date: Sat, 12 Mar 2016 02:01:47 +0500 Subject: [PATCH] Fixing squid:S1155, squid:S2293, squid:S1488 --- .../newpipe/extractor/youtube/YoutubeSearchEngineTest.java | 2 +- app/src/main/java/org/schabi/newpipe/DownloadDialog.java | 2 +- app/src/main/java/org/schabi/newpipe/extractor/StreamInfo.java | 2 +- .../extractor/services/youtube/YoutubeStreamExtractor.java | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java b/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java index 39f04f4a0..3e91e1309 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java +++ b/app/src/androidTest/java/org/schabi/newpipe/extractor/youtube/YoutubeSearchEngineTest.java @@ -101,7 +101,7 @@ public class YoutubeSearchEngineTest extends AndroidTestCase { } public void testIfSuggestionsAreReplied() { - assertEquals(suggestionReply.size() > 0, true); + assertEquals(!suggestionReply.isEmpty(), true); } public void testIfSuggestionsAreValid() { diff --git a/app/src/main/java/org/schabi/newpipe/DownloadDialog.java b/app/src/main/java/org/schabi/newpipe/DownloadDialog.java index 18d97185d..b528dfef3 100644 --- a/app/src/main/java/org/schabi/newpipe/DownloadDialog.java +++ b/app/src/main/java/org/schabi/newpipe/DownloadDialog.java @@ -130,7 +130,7 @@ public class DownloadDialog extends DialogFragment { private String createFileName(String fName) { // from http://eng-przemelek.blogspot.de/2009/07/how-to-create-valid-file-name.html - List forbiddenCharsPatterns = new ArrayList (); + List forbiddenCharsPatterns = new ArrayList<> (); forbiddenCharsPatterns.add("[:]+"); // Mac OS, but it looks that also Windows XP forbiddenCharsPatterns.add("[\\*\"/\\\\\\[\\]\\:\\;\\|\\=\\,]+"); // Windows forbiddenCharsPatterns.add("[^\\w\\d\\.]+"); // last chance... only latin letters and digits diff --git a/app/src/main/java/org/schabi/newpipe/extractor/StreamInfo.java b/app/src/main/java/org/schabi/newpipe/extractor/StreamInfo.java index baf513187..465d6887a 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/StreamInfo.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/StreamInfo.java @@ -127,7 +127,7 @@ public class StreamInfo extends AbstractVideoInfo { // also try to get streams from the dashMpd if(streamInfo.dashMpdUrl != null && !streamInfo.dashMpdUrl.isEmpty()) { if(streamInfo.audio_streams == null) { - streamInfo.audio_streams = new Vector(); + streamInfo.audio_streams = new Vector<>(); } //todo: make this quick and dirty solution a real fallback // same as the quick and dirty aboth diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index 8574b71b4..96ff0daa8 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -569,9 +569,8 @@ public class YoutubeStreamExtractor extends StreamExtractor { int hours = (hoursString.isEmpty() ? 0 : Integer.parseInt(hoursString)); //don't trust BODMAS! - int ret = seconds + (60 * minutes) + (3600 * hours); + return seconds + (60 * minutes) + (3600 * hours); //Log.d(TAG, "derived timestamp value:"+ret); - return ret; //the ordering varies internationally } catch (ParsingException e) { throw new ParsingException("Could not get timestamp.", e);