Index: trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java	(revision 558)
+++ trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java	(revision 559)
@@ -12,4 +12,5 @@
 import javax.sound.sampled.DataLine;
 import javax.sound.sampled.SourceDataLine;
+import java.io.IOException;
 import javax.swing.JOptionPane;
 
@@ -196,5 +197,4 @@
 		playingUrl = null;
 		AudioInputStream audioInputStream = null;
-		int nBytesRead = 0;
 		SourceDataLine audioOutputLine = null;
 		AudioFormat	audioFormat = null;
@@ -214,4 +214,5 @@
 				case PLAYING:
 					for(;;) {
+						int nBytesRead = 0;
 						nBytesRead = audioInputStream.read(abData, 0, abData.length);
 						position += nBytesRead / bytesPerSecond;
@@ -252,5 +253,5 @@
 							audioFormat = audioInputStream.getFormat();
 							DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
-							nBytesRead = 0;
+							long nBytesRead = 0;
 							position = 0.0;
 							double adjustedOffset = (offset - leadIn) * calibration;
@@ -265,5 +266,8 @@
 								// audioInputStream.skip(bytesToSkip);
 								while (bytesToSkip > chunk) {
-									bytesToSkip -= audioInputStream.skip(chunk);
+									nBytesRead = audioInputStream.skip(chunk);
+									if (nBytesRead <= 0)
+										throw new IOException(tr("This is after the end of the recording"));
+									bytesToSkip -= nBytesRead;
 								}
 								if (bytesToSkip > 0)
@@ -295,7 +299,5 @@
 	public static void audioMalfunction(Exception ex) {
 		JOptionPane.showMessageDialog(Main.parent, 
-				"<html><b>" + 
-				tr("There was an error while trying to play the sound file for this marker.") +
-				"</b><br>" + ex.getClass().getName() + ":<br><i>" + ex.getMessage() + "</i></html>",
+				"<html><p>" + ex.getMessage() + "</p></html>",
 				tr("Error playing sound"), JOptionPane.ERROR_MESSAGE);
 	}
