mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 21:31:53 +01:00
added proper logging in error case (#333)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
95fa29ee8a
commit
c02826f882
@ -33,7 +33,7 @@ import javazoom.jl.player.Player;
|
||||
*/
|
||||
public class EnhancedJavaSoundAudioSink extends JavaSoundAudioSink {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(EnhancedJavaSoundAudioSink.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EnhancedJavaSoundAudioSink.class);
|
||||
|
||||
private static AudioFormat mp3 = new AudioFormat(AudioFormat.CONTAINER_NONE, AudioFormat.CODEC_MP3, null, null,
|
||||
null, null);
|
||||
@ -81,7 +81,7 @@ public class EnhancedJavaSoundAudioSink extends JavaSoundAudioSink {
|
||||
streamPlayer = new Player(audioStream);
|
||||
playInThread(streamPlayer);
|
||||
} catch (JavaLayerException e) {
|
||||
logger.error("An exception occurred while playing url audio stream : '{}'", e.getMessage());
|
||||
LOGGER.error("An exception occurred while playing url audio stream : '{}'", e.getMessage());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -90,7 +90,7 @@ public class EnhancedJavaSoundAudioSink extends JavaSoundAudioSink {
|
||||
try {
|
||||
playInThread(new Player(audioStream));
|
||||
} catch (JavaLayerException e) {
|
||||
logger.error("An exception occurred while playing audio : '{}'", e.getMessage());
|
||||
LOGGER.error("An exception occurred while playing audio : '{}'", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class EnhancedJavaSoundAudioSink extends JavaSoundAudioSink {
|
||||
try {
|
||||
player.play();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
LOGGER.error("An exception occurred while playing audio : '{}'", e.getMessage());
|
||||
} finally {
|
||||
player.close();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user