mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-11 05:41:52 +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 {
|
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,
|
private static AudioFormat mp3 = new AudioFormat(AudioFormat.CONTAINER_NONE, AudioFormat.CODEC_MP3, null, null,
|
||||||
null, null);
|
null, null);
|
||||||
@ -81,7 +81,7 @@ public class EnhancedJavaSoundAudioSink extends JavaSoundAudioSink {
|
|||||||
streamPlayer = new Player(audioStream);
|
streamPlayer = new Player(audioStream);
|
||||||
playInThread(streamPlayer);
|
playInThread(streamPlayer);
|
||||||
} catch (JavaLayerException e) {
|
} 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;
|
return;
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ public class EnhancedJavaSoundAudioSink extends JavaSoundAudioSink {
|
|||||||
try {
|
try {
|
||||||
playInThread(new Player(audioStream));
|
playInThread(new Player(audioStream));
|
||||||
} catch (JavaLayerException e) {
|
} 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 {
|
try {
|
||||||
player.play();
|
player.play();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e.getMessage());
|
LOGGER.error("An exception occurred while playing audio : '{}'", e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
player.close();
|
player.close();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user