Fix Java 9 @Deprecated warnings

This commit is contained in:
Reinhard Pointner 2017-10-16 21:09:25 +02:00
parent 0251364870
commit 9f2aaa6ca8
12 changed files with 28 additions and 28 deletions

View File

@ -444,7 +444,7 @@ public class MediaBindingBean {
// collect value from Video Stream 0 or Image Stream 0 // collect value from Video Stream 0 or Image Stream 0
return Stream.of(StreamKind.Video, StreamKind.Image).map(k -> { return Stream.of(StreamKind.Video, StreamKind.Image).map(k -> {
// collect Width and Height as Integer List // collect Width and Height as Integer List
return Stream.of("Width", "Height").map(p -> getMediaInfo().get(k, 0, p)).filter(s -> s.length() > 0).map(Integer::new).collect(toList()); return Stream.of("Width", "Height").map(p -> getMediaInfo().get(k, 0, p)).filter(s -> s.length() > 0).map(Integer::parseInt).collect(toList());
}).filter(d -> d.size() == 2).findFirst().orElse(null); }).filter(d -> d.size() == 2).findFirst().orElse(null);
} }
@ -800,7 +800,7 @@ public class MediaBindingBean {
@Define("bitrate") @Define("bitrate")
public Long getOverallBitRate() { public Long getOverallBitRate() {
return new Double(getMediaInfo(StreamKind.General, 0, "OverallBitRate")).longValue(); return (long) Double.parseDouble(getMediaInfo(StreamKind.General, 0, "OverallBitRate"));
} }
@Define("kbps") @Define("kbps")
@ -820,7 +820,7 @@ public class MediaBindingBean {
@Define("duration") @Define("duration")
public Duration getDuration() { public Duration getDuration() {
long d = new Double(getMediaInfo(StreamKind.General, 0, "Duration")).longValue(); long d = (long) Double.parseDouble(getMediaInfo(StreamKind.General, 0, "Duration"));
return Duration.ofMillis(d); return Duration.ofMillis(d);
} }

View File

@ -310,7 +310,7 @@ public class AutoDetection {
return getChildren(f.getParentFile(), VIDEO_FILES, HUMAN_NAME_ORDER).stream().filter(it -> { return getChildren(f.getParentFile(), VIDEO_FILES, HUMAN_NAME_ORDER).stream().filter(it -> {
return find(dn, snm) || find(normalize(it.getName()), snm); return find(dn, snm) || find(normalize(it.getName()), snm);
}).map(it -> { }).map(it -> {
return streamMatches(it.getName(), EPISODE_NUMBERS).map(Integer::new).collect(toSet()); return streamMatches(it.getName(), EPISODE_NUMBERS).map(Integer::parseInt).collect(toSet());
}).filter(it -> it.size() > 0).distinct().count() >= 10; }).filter(it -> it.size() > 0).distinct().count() >= 10;
} }

View File

@ -1287,13 +1287,13 @@ public class MediaDetection {
public static List<Integer> grepImdbId(CharSequence text) { public static List<Integer> grepImdbId(CharSequence text) {
// scan for imdb id patterns like tt1234567 // scan for imdb id patterns like tt1234567
Pattern imdbId = Pattern.compile("(?<!\\p{Alnum})tt(\\d{7})(?!\\p{Alnum})", Pattern.CASE_INSENSITIVE); Pattern imdbId = Pattern.compile("(?<!\\p{Alnum})tt(\\d{7})(?!\\p{Alnum})", Pattern.CASE_INSENSITIVE);
return streamMatches(text, imdbId, m -> m.group(1)).map(Integer::new).collect(toList()); return streamMatches(text, imdbId, m -> m.group(1)).map(Integer::parseInt).collect(toList());
} }
public static List<Integer> grepTheTvdbId(CharSequence text) { public static List<Integer> grepTheTvdbId(CharSequence text) {
// scan for thetvdb id patterns like http://www.thetvdb.com/?tab=series&id=78874&lid=14 // scan for thetvdb id patterns like http://www.thetvdb.com/?tab=series&id=78874&lid=14
Pattern tvdbUrl = Pattern.compile("thetvdb.com[\\p{Graph}]*?[\\p{Punct}]id=(\\d+)", Pattern.CASE_INSENSITIVE); Pattern tvdbUrl = Pattern.compile("thetvdb.com[\\p{Graph}]*?[\\p{Punct}]id=(\\d+)", Pattern.CASE_INSENSITIVE);
return streamMatches(text, tvdbUrl, m -> m.group(1)).map(Integer::new).collect(toList()); return streamMatches(text, tvdbUrl, m -> m.group(1)).map(Integer::parseInt).collect(toList());
} }
public static Movie grepMovie(File nfo, MovieIdentificationService resolver, Locale locale) throws Exception { public static Movie grepMovie(File nfo, MovieIdentificationService resolver, Locale locale) throws Exception {

View File

@ -42,7 +42,7 @@ public class NumericSimilarityMetric implements SimilarityMetric {
Matcher m = DIGIT.matcher(s); Matcher m = DIGIT.matcher(s);
while (m.find()) { while (m.find()) {
// remove leading zeros // remove leading zeros
tokens.add(new Integer(m.group()).toString()); tokens.add(String.valueOf(Integer.parseInt(m.group())));
} }
return tokens; return tokens;

View File

@ -116,7 +116,7 @@ class BDecoder {
return null; return null;
case 'i': case 'i':
return new Long(getNumberFromStream(bais, 'e')); return getNumberFromStream(bais, 'e');
case '0': case '0':
case '1': case '1':

View File

@ -31,7 +31,7 @@ public final class StringUtilities {
Matcher matcher = DIGIT.matcher(s); Matcher matcher = DIGIT.matcher(s);
while (matcher.find()) { while (matcher.find()) {
try { try {
numbers.add(new Integer(matcher.group())); numbers.add(Integer.parseInt(matcher.group()));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// ignore // ignore
} }
@ -47,7 +47,7 @@ public final class StringUtilities {
Matcher matcher = DIGIT.matcher(s); Matcher matcher = DIGIT.matcher(s);
if (matcher.find()) { if (matcher.find()) {
try { try {
return new Integer(matcher.group()); return Integer.parseInt(matcher.group());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// ignore // ignore
} }

View File

@ -127,7 +127,7 @@ public final class XPathUtilities {
public static Double getDecimal(String textContent) { public static Double getDecimal(String textContent) {
try { try {
return new Double(textContent); return Double.parseDouble(textContent);
} catch (NumberFormatException | NullPointerException e) { } catch (NumberFormatException | NullPointerException e) {
return null; return null;
} }

View File

@ -149,11 +149,11 @@ public class EpisodeFormat extends Format {
} }
if ((m = sxePattern.matcher(source)).find()) { if ((m = sxePattern.matcher(source)).find()) {
season = (m.group(1) == null) ? null : new Integer(m.group(1)); season = (m.group(1) == null) ? null : Integer.parseInt(m.group(1));
if (m.group(2) == null) if (m.group(2) == null)
episode = new Integer(m.group(3)); episode = Integer.parseInt(m.group(3));
else else
special = new Integer(m.group(3)); special = Integer.parseInt(m.group(3));
source.replace(m.start(), m.end(), ""); // remove matched part from text source.replace(m.start(), m.end(), ""); // remove matched part from text

View File

@ -103,19 +103,19 @@ public class MovieInfo implements Crew, Serializable {
} }
public Integer getId() { public Integer getId() {
return get(Property.id, Integer::new); return get(Property.id, Integer::parseInt);
} }
public Integer getImdbId() { public Integer getImdbId() {
return get(Property.imdb_id, s -> new Integer(s.substring(2))); // e.g. tt0379786 return get(Property.imdb_id, s -> Integer.parseInt(s.substring(2))); // e.g. tt0379786
} }
public Integer getVotes() { public Integer getVotes() {
return get(Property.vote_count, Integer::new); return get(Property.vote_count, Integer::parseInt);
} }
public Double getRating() { public Double getRating() {
return get(Property.vote_average, Double::new); return get(Property.vote_average, Double::parseDouble);
} }
public SimpleDate getReleased() { public SimpleDate getReleased() {
@ -123,19 +123,19 @@ public class MovieInfo implements Crew, Serializable {
} }
public Integer getRuntime() { public Integer getRuntime() {
return get(Property.runtime, Integer::new); return get(Property.runtime, Integer::parseInt);
} }
public Long getBudget() { public Long getBudget() {
return get(Property.budget, Long::new); return get(Property.budget, Long::parseLong);
} }
public Long getRevenue() { public Long getRevenue() {
return get(Property.revenue, Long::new); return get(Property.revenue, Long::parseLong);
} }
public Double getPopularity() { public Double getPopularity() {
return get(Property.popularity, Double::new); return get(Property.popularity, Double::parseDouble);
} }
public URL getHomepage() { public URL getHomepage() {

View File

@ -108,9 +108,9 @@ public class TMDbTVClient extends AbstractEpisodeListProvider {
info.setStatus(getString(tv, "status")); info.setStatus(getString(tv, "status"));
info.setLanguage(getString(tv, "original_language")); info.setLanguage(getString(tv, "original_language"));
info.setStartDate(getStringValue(tv, "first_air_date", SimpleDate::parse)); info.setStartDate(getStringValue(tv, "first_air_date", SimpleDate::parse));
info.setRating(getStringValue(tv, "vote_average", Double::new)); info.setRating(getStringValue(tv, "vote_average", Double::parseDouble));
info.setRatingCount(getStringValue(tv, "vote_count", Integer::new)); info.setRatingCount(getStringValue(tv, "vote_count", Integer::parseInt));
info.setRuntime(stream(getArray(tv, "episode_run_time")).map(Object::toString).map(Integer::new).findFirst().orElse(null)); info.setRuntime(stream(getArray(tv, "episode_run_time")).map(Object::toString).map(Integer::parseInt).findFirst().orElse(null));
info.setGenres(streamJsonObjects(tv, "genres").map(it -> getString(it, "name")).collect(toList())); info.setGenres(streamJsonObjects(tv, "genres").map(it -> getString(it, "name")).collect(toList()));
info.setNetwork(streamJsonObjects(tv, "networks").map(it -> getString(it, "name")).findFirst().orElse(null)); info.setNetwork(streamJsonObjects(tv, "networks").map(it -> getString(it, "name")).findFirst().orElse(null));

View File

@ -65,9 +65,9 @@ public class TVMazeClient extends AbstractEpisodeListProvider {
String status = getStringValue(response, "status", String::new); String status = getStringValue(response, "status", String::new);
SimpleDate premiered = getStringValue(response, "premiered", SimpleDate::parse); SimpleDate premiered = getStringValue(response, "premiered", SimpleDate::parse);
Integer runtime = getStringValue(response, "runtime", Integer::new); Integer runtime = getStringValue(response, "runtime", Integer::parseInt);
Object[] genres = getArray(response, "genres"); Object[] genres = getArray(response, "genres");
Double rating = getStringValue(getMap(response, "rating"), "average", Double::new); Double rating = getStringValue(getMap(response, "rating"), "average", Double::parseDouble);
SeriesInfo seriesInfo = new SeriesInfo(this, sortOrder, locale, show.getId()); SeriesInfo seriesInfo = new SeriesInfo(this, sortOrder, locale, show.getId());
seriesInfo.setName(show.getName()); seriesInfo.setName(show.getName());

View File

@ -175,7 +175,7 @@ public class TheTVDBClient extends AbstractEpisodeListProvider implements Artwor
info.setAirsDayOfWeek(getString(data, "airsDayOfWeek")); info.setAirsDayOfWeek(getString(data, "airsDayOfWeek"));
info.setAirsTime(getString(data, "airsTime")); info.setAirsTime(getString(data, "airsTime"));
info.setBannerUrl(getStringValue(data, "banner", this::resolveImage)); info.setBannerUrl(getStringValue(data, "banner", this::resolveImage));
info.setLastUpdated(getStringValue(data, "lastUpdated", Long::new)); info.setLastUpdated(getStringValue(data, "lastUpdated", Long::parseLong));
return info; return info;
} }