Project

General

Profile

Bug #10751

Beep Sound Playback Causing Client Abend

Added by Vladimir Tsichevski 9 months ago. Updated 8 months ago.

Status:
Test
Priority:
Normal
Assignee:
Vladimir Tsichevski
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
16224
version_resolved:
reviewer:
production:
No
env_name:
topics:

History

#1 Updated by Vladimir Tsichevski 9 months ago

FWD emits a beep sound to indicate invalid user input (e.g., pressing a disallowed key in a FILL-IN widget). When the underlying audio system cannot play the sound, FWD logs warnings and ignores specific exceptions.

The relevant code is in the AbstractDriver.playBeep method:

try
{
   ...
   clip.open(audioStream);
   ...
}
catch (LineUnavailableException | IOException | UnsupportedAudioFileException e)
{
   LOG.warning("Cannot play beep sound file " + BEEP_FILE_PATH, e);
   return null;
}

On Linux (at least with Java 8), the underlying audio implementation in icedtea-sound.jar uses Java assert statement in the Stream.disconnect() method:

/**
 * Disconnect a stream from a source/sink.
 */
void disconnect() {
    int returnValue = native_pa_stream_disconnect();
    assert (returnValue == 0);
}

During automated tests, an assertion failure in disconnect() triggers a java.lang.AssertionError, causing an immediate application abend. The stack trace is as follows:

Caused by: java.lang.AssertionError
    at org.classpath.icedtea.pulseaudio.Stream.disconnect(Stream.java:560)
    at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.connect(PulseAudioDataLine.java:271)
    at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:101)
    at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:283)
    at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:402)
    at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:453)
    at com.goldencode.p2j.ui.client.driver.AbstractDriver.playBeep(AbstractDriver.java:408)
    at com.goldencode.p2j.ui.client.gui.driver.swing.SwingGuiDriver.beep(SwingGuiDriver.java:308)
    at com.goldencode.p2j.ui.client.OutputManager.beep(OutputManager.java:817)
    at com.goldencode.p2j.ui.client.FillIn.validateDisplayValue(FillIn.java:3562)
    at com.goldencode.p2j.ui.client.FillIn.processKeyEvent(FillIn.java:1709)
    at com.goldencode.p2j.ui.client.gui.FillInGuiImpl.processKeyEvent(FillInGuiImpl.java:1373)
    at com.goldencode.p2j.ui.chui.ThinClient.processProgressEvent(ThinClient.java:22455)
    at com.goldencode.p2j.ui.client.FocusManager.focusChange(FocusManager.java:1583)
    at com.goldencode.p2j.ui.chui.ThinClient.nextTabStop(ThinClient.java:25172)
    at com.goldencode.p2j.ui.client.FillIn.processKeyEvent(FillIn.java:1852)
    at com.goldencode.p2j.ui.client.gui.FillInGuiImpl.processKeyEvent(FillInGuiImpl.java:1373)

Recommended Fix

Add java.lang.AssertionError to the list of caught exceptions in AbstractDriver.playBeep.

#2 Updated by Vladimir Tsichevski 9 months ago

  • Status changed from New to WIP

#3 Updated by Vladimir Tsichevski 9 months ago

  • Status changed from WIP to Review
  • % Done changed from 0 to 100

Fixed in 10761a rev. 16225. Please, review.

#4 Updated by Hynek Cihlar 8 months ago

Greg, I know we've had a debate about the use of assertions in our code base. Was the conclusion that using assert is discouraged?

#5 Updated by Greg Shah 8 months ago

Hynek Cihlar wrote:

Greg, I know we've had a debate about the use of assertions in our code base. Was the conclusion that using assert is discouraged?

Using assert is disallowed. It must be removed.

#6 Updated by Vladimir Tsichevski 8 months ago

Greg Shah wrote:

Hynek Cihlar wrote:

Greg, I know we've had a debate about the use of assertions in our code base. Was the conclusion that using assert is discouraged?

Using assert is disallowed. It must be removed.

You cannot do this in 3-rd party software.

#7 Updated by Greg Shah 8 months ago

We would have to catch (AssertionError ae) in that case.

#8 Updated by Vladimir Tsichevski 8 months ago

Greg Shah wrote:

We would have to catch (AssertionError ae) in that case.

This is exactly what the fix does.

#9 Updated by Hynek Cihlar 8 months ago

  • Status changed from Review to Internal Test

Vladimir Tsichevski wrote:

Greg Shah wrote:

Hynek Cihlar wrote:

Greg, I know we've had a debate about the use of assertions in our code base. Was the conclusion that using assert is discouraged?

Using assert is disallowed. It must be removed.

You cannot do this in 3-rd party software.

Sorry, I was browsing the dissassembly assuming this was our code :-).

The changes are good. I suppose no more testing is needed?

#10 Updated by Vladimir Tsichevski 8 months ago

Hynek Cihlar wrote:

Vladimir Tsichevski wrote:

Greg Shah wrote:

Hynek Cihlar wrote:

Greg, I know we've had a debate about the use of assertions in our code base. Was the conclusion that using assert is discouraged?

Using assert is disallowed. It must be removed.

You cannot do this in 3-rd party software.

Sorry, I was browsing the dissassembly assuming this was our code :-).

The changes are good. I suppose no more testing is needed?

I suppose no testing is needed.

#11 Updated by Hynek Cihlar 8 months ago

  • Status changed from Internal Test to Merge Pending

Please merge 10751a to trunk.

#12 Updated by Vladimir Tsichevski 8 months ago

Hynek Cihlar wrote:

Please merge 10751a to trunk.

Branch 10751a was merged into trunk as rev. 16287 and archived.

#13 Updated by Greg Shah 8 months ago

  • Status changed from Merge Pending to Test

Also available in: Atom PDF