diff --git a/core/src/net/sf/openrocket/file/motor/RASPMotorLoader.java b/core/src/net/sf/openrocket/file/motor/RASPMotorLoader.java index 26c102f71..57bae283c 100644 --- a/core/src/net/sf/openrocket/file/motor/RASPMotorLoader.java +++ b/core/src/net/sf/openrocket/file/motor/RASPMotorLoader.java @@ -94,7 +94,8 @@ public class RASPMotorLoader extends AbstractMotorLoader { // desig diam len delays prop.w tot.w manufacturer pieces = split(line); if (pieces.length != 7) { - throw new IOException("Illegal file format."); + throw new IOException("Illegal file format. Motor header line must contain 7 fields:
" + + "  designation diameter length delays propellantWeight totalWeight manufacturer"); } designation = pieces[0]; @@ -140,7 +141,8 @@ public class RASPMotorLoader extends AbstractMotorLoader { thrust.add(Double.parseDouble(buf[1])); } else { - throw new IOException("Illegal file format."); + throw new IOException("Illegal file format.
" + + "Data should only have 2 entries: a time and thrust value."); } } @@ -158,7 +160,8 @@ public class RASPMotorLoader extends AbstractMotorLoader { } catch (NumberFormatException e) { - throw new IOException("Illegal file format."); + throw new IOException("Illegal file format. Could not convert value to a number.Verify that each number is correctly formatted."); } diff --git a/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java b/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java index 279f0cf92..24fd7e4c4 100644 --- a/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java +++ b/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java @@ -27,6 +27,7 @@ import net.sf.openrocket.util.Pair; import javax.swing.JDialog; import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; /** * An asynchronous database loader that loads the internal thrust curves @@ -140,21 +141,26 @@ public class MotorDatabaseLoader extends AsynchronousDatabaseLoader { */ private void loadFile(GeneralMotorLoader loader, Pair f) { try { - List motors = loader.load(f.getV(), f.getU().getName()); try { + List motors = loader.load(f.getV(), f.getU().getName()); addMotorsFromBuilders(motors); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException | IOException e) { Translator trans = Application.getTranslator(); String fullPath = f.getU().getPath(); String message = "

" + e.getMessage() + ".

" + MessageFormat.format( trans.get("MotorDbLoaderDlg.message1"), fullPath) + "
" + trans.get("MotorDbLoaderDlg.message2") + "

"; - JOptionPane pane = new JOptionPane(message, JOptionPane.WARNING_MESSAGE); - JDialog dialog = pane.createDialog(null, trans.get("MotorDbLoaderDlg.title")); - dialog.setModalityType(Dialog.ModalityType.MODELESS); - dialog.setAlwaysOnTop(true); - dialog.setVisible(true); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + JOptionPane pane = new JOptionPane(message, JOptionPane.WARNING_MESSAGE); + JDialog dialog = pane.createDialog(null, trans.get("MotorDbLoaderDlg.title")); + dialog.setModalityType(Dialog.ModalityType.MODELESS); + dialog.setAlwaysOnTop(true); + dialog.setVisible(true); + } + }); } f.getV().close(); } catch (Exception e) {