Remove potential cast exception

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 6 years ago
parent 30b767955e
commit 995d1fa667
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 5
      airsonic-main/src/main/java/org/airsonic/player/service/metadata/FFmpegParser.java

@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
/** /**
* Parses meta data from video files using FFmpeg (http://ffmpeg.org/). * Parses meta data from video files using FFmpeg (http://ffmpeg.org/).
@ -77,12 +78,12 @@ public class FFmpegParser extends MetaDataParser {
ffprobe = "ffprobe"; ffprobe = "ffprobe";
} }
ArrayList<String> command = new ArrayList<>(FFPROBE_OPTIONS.length + 2); List<String> command = new ArrayList<>();
command.add(ffprobe); command.add(ffprobe);
command.addAll(Arrays.asList(FFPROBE_OPTIONS)); command.addAll(Arrays.asList(FFPROBE_OPTIONS));
command.add(file.getAbsolutePath()); command.add(file.getAbsolutePath());
Process process = Runtime.getRuntime().exec((String[])command.toArray()); Process process = Runtime.getRuntime().exec(command.toArray(new String[0]));
final JsonNode result = objectMapper.readTree(process.getInputStream()); final JsonNode result = objectMapper.readTree(process.getInputStream());
metaData.setDurationSeconds(result.at("/format/duration").asInt()); metaData.setDurationSeconds(result.at("/format/duration").asInt());

Loading…
Cancel
Save