* defensive programming for old json data
This commit is contained in:
parent
d421a0f55f
commit
f7a99a2ede
|
@ -2,6 +2,7 @@ package net.sourceforge.filebot.web;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Movie extends SearchResult {
|
||||
|
@ -43,6 +44,10 @@ public class Movie extends SearchResult {
|
|||
|
||||
@Override
|
||||
public List<String> getEffectiveNames() {
|
||||
if (aliasNames == null || aliasNames.length == 0) {
|
||||
return Collections.singletonList(toString(name, year));
|
||||
}
|
||||
|
||||
List<String> names = new ArrayList<String>(1 + aliasNames.length);
|
||||
names.add(toString(name, year));
|
||||
for (String alias : aliasNames) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.sourceforge.filebot.web;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class SearchResult implements Serializable {
|
||||
|
@ -27,6 +28,10 @@ public abstract class SearchResult implements Serializable {
|
|||
}
|
||||
|
||||
public List<String> getEffectiveNames() {
|
||||
if (aliasNames == null || aliasNames.length == 0) {
|
||||
return Collections.singletonList(name);
|
||||
}
|
||||
|
||||
return new AbstractList<String>() {
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue