Index: /trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/Main.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/Main.java	(revision 11374)
@@ -100,4 +100,5 @@
 import org.openstreetmap.josm.tools.I18n;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.OpenBrowser;
@@ -560,5 +561,5 @@
             service.shutdown();
         } catch (InterruptedException | ExecutionException ex) {
-            throw new RuntimeException(ex);
+            throw new JosmRuntimeException(ex);
         }
 
Index: /trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 11374)
@@ -45,4 +45,5 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.tools.Geometry;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.Pair;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -1125,5 +1126,5 @@
                 WayInPolygon nextWay = traverser.walk();
                 if (nextWay == null)
-                    throw new RuntimeException("Join areas internal error.");
+                    throw new JosmRuntimeException("Join areas internal error.");
                 if (path.get(0) == nextWay) {
                     // path is closed -> stop here
@@ -1180,5 +1181,5 @@
                 while ((nextWay = traverser.walk()) != startWay) {
                     if (nextWay == null)
-                        throw new RuntimeException("Join areas internal error.");
+                        throw new JosmRuntimeException("Join areas internal error.");
                     simpleRingWays.add(nextWay);
                 }
@@ -1254,5 +1255,5 @@
         //should not happen
         if (joinedWay == null || !joinedWay.isClosed())
-            throw new RuntimeException("Join areas internal error.");
+            throw new JosmRuntimeException("Join areas internal error.");
 
         return joinedWay;
Index: /trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java	(revision 11374)
@@ -31,4 +31,5 @@
 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
 import org.openstreetmap.josm.gui.Notification;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.Shortcut;
 
@@ -294,5 +295,5 @@
                     w.calcDirections(Direction.RIGHT.changeBy(directionOffset));
                     if (angleToDirectionChange(refHeading - w.heading, TOLERANCE2) != 0)
-                        throw new RuntimeException();
+                        throw new JosmRuntimeException("orthogonalize error");
                     totSum = EN.sum(totSum, w.segSum);
                 }
@@ -403,5 +404,5 @@
                 }
             }
-            if (!s.isEmpty()) throw new RuntimeException();
+            if (!s.isEmpty()) throw new JosmRuntimeException("orthogonalize error");
         }
 
Index: /trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java	(revision 11374)
@@ -12,4 +12,5 @@
 
 import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 
 public class PushbackTokenizer {
@@ -74,5 +75,5 @@
             c = search.read();
         } catch (IOException e) {
-            throw new RuntimeException(e.getMessage(), e);
+            throw new JosmRuntimeException(e.getMessage(), e);
         }
     }
Index: /trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 11374)
@@ -55,4 +55,5 @@
 import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
 import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.Shortcut;
 import org.openstreetmap.josm.tools.Utils;
@@ -229,5 +230,5 @@
                             tf.getDocument().insertString(tf.getCaretPosition(), ' ' + insertText, null);
                         } catch (BadLocationException ex) {
-                            throw new RuntimeException(ex.getMessage(), ex);
+                            throw new JosmRuntimeException(ex.getMessage(), ex);
                         }
                     }
Index: /trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java	(revision 11374)
@@ -19,4 +19,5 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 
 /**
@@ -170,5 +171,5 @@
             OsmPrimitive osm = getAffectedDataSet().getPrimitiveById(d);
             if (osm == null)
-                throw new RuntimeException();
+                throw new JosmRuntimeException("No primitive found for " + d);
             prims.add(osm);
         }
@@ -188,7 +189,7 @@
         AddPrimitivesCommand that = (AddPrimitivesCommand) obj;
         return Objects.equals(data, that.data) &&
-                Objects.equals(toSelect, that.toSelect) &&
-                Objects.equals(createdPrimitives, that.createdPrimitives) &&
-                Objects.equals(createdPrimitivesToSelect, that.createdPrimitivesToSelect);
+               Objects.equals(toSelect, that.toSelect) &&
+               Objects.equals(createdPrimitives, that.createdPrimitives) &&
+               Objects.equals(createdPrimitivesToSelect, that.createdPrimitivesToSelect);
     }
 }
Index: /trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 11374)
@@ -73,4 +73,5 @@
 import org.openstreetmap.josm.tools.ColorHelper;
 import org.openstreetmap.josm.tools.I18n;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.ListenerList;
 import org.openstreetmap.josm.tools.MultiMap;
@@ -1327,5 +1328,5 @@
                 }
             } catch (IllegalAccessException ex) {
-                throw new RuntimeException(ex);
+                throw new JosmRuntimeException(ex);
             }
         }
@@ -1387,5 +1388,5 @@
                 value = multiMapFromJson(key_value.getValue());
             } else
-                throw new RuntimeException("unsupported preference primitive type");
+                throw new JosmRuntimeException("unsupported preference primitive type");
 
             try {
@@ -1394,5 +1395,5 @@
                 throw new AssertionError(ex);
             } catch (IllegalAccessException ex) {
-                throw new RuntimeException(ex);
+                throw new JosmRuntimeException(ex);
             }
         }
Index: /trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 11374)
@@ -46,4 +46,5 @@
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.SubclassFilteredCollection;
 import org.openstreetmap.josm.tools.Utils;
@@ -516,5 +517,5 @@
             }
             if (!success)
-                throw new RuntimeException("failed to add primitive: "+primitive);
+                throw new JosmRuntimeException("failed to add primitive: "+primitive);
             firePrimitivesAdded(Collections.singletonList(primitive), false);
         } finally {
@@ -547,5 +548,5 @@
             }
             if (!success)
-                throw new RuntimeException("failed to remove primitive: "+primitive);
+                throw new JosmRuntimeException("failed to remove primitive: "+primitive);
             synchronized (selectionLock) {
                 selectedPrimitives.remove(primitive);
@@ -1063,8 +1064,8 @@
     private void reindexNode(Node node, LatLon newCoor, EastNorth eastNorth) {
         if (!nodes.remove(node))
-            throw new RuntimeException("Reindexing node failed to remove");
+            throw new JosmRuntimeException("Reindexing node failed to remove");
         node.setCoorInternal(newCoor, eastNorth);
         if (!nodes.add(node))
-            throw new RuntimeException("Reindexing node failed to add");
+            throw new JosmRuntimeException("Reindexing node failed to add");
         for (OsmPrimitive primitive: node.getReferrers()) {
             if (primitive instanceof Way) {
@@ -1079,8 +1080,8 @@
         BBox before = way.getBBox();
         if (!ways.remove(way))
-            throw new RuntimeException("Reindexing way failed to remove");
+            throw new JosmRuntimeException("Reindexing way failed to remove");
         way.updatePosition();
         if (!ways.add(way))
-            throw new RuntimeException("Reindexing way failed to add");
+            throw new JosmRuntimeException("Reindexing way failed to add");
         if (!way.getBBox().equals(before)) {
             for (OsmPrimitive primitive: way.getReferrers()) {
Index: /trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java	(revision 11374)
@@ -18,4 +18,5 @@
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 
 /**
@@ -143,5 +144,5 @@
         Way myWay = (Way) getMergeTarget(other);
         if (myWay == null)
-            throw new RuntimeException(tr("Missing merge target for way with id {0}", other.getUniqueId()));
+            throw new JosmRuntimeException(tr("Missing merge target for way with id {0}", other.getUniqueId()));
     }
 
@@ -178,5 +179,5 @@
                 OsmPrimitive source = sourceDataSet.getPrimitiveById(target.getPrimitiveId());
                 if (source == null)
-                    throw new RuntimeException(
+                    throw new JosmRuntimeException(
                             tr("Object of type {0} with id {1} was marked to be deleted, but it''s missing in the source dataset",
                             target.getType(), target.getUniqueId()));
Index: /trunk/src/org/openstreetmap/josm/data/projection/Projections.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/projection/Projections.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/data/projection/Projections.java	(revision 11374)
@@ -44,4 +44,5 @@
 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
 import org.openstreetmap.josm.io.CachedFile;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.Utils;
 
@@ -147,5 +148,5 @@
             pds = loadProjectionDefinitions("resource://data/projection/custom-epsg");
         } catch (IOException ex) {
-            throw new RuntimeException(ex);
+            throw new JosmRuntimeException(ex);
         }
         inits = new LinkedHashMap<>();
Index: /trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java	(revision 11374)
@@ -6,4 +6,5 @@
 
 import org.openstreetmap.josm.io.CachedFile;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 
 /**
@@ -57,5 +58,5 @@
                 instance.loadGridShiftFile(is, false);
             } catch (IOException e) {
-                throw new RuntimeException(e);
+                throw new JosmRuntimeException(e);
             }
         }
Index: /trunk/src/org/openstreetmap/josm/data/projection/proj/ClassProjFactory.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/projection/proj/ClassProjFactory.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/data/projection/proj/ClassProjFactory.java	(revision 11374)
@@ -1,4 +1,6 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.data.projection.proj;
+
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 
 /**
@@ -23,5 +25,5 @@
             proj = projClass.getConstructor().newInstance();
         } catch (ReflectiveOperationException e) {
-            throw new RuntimeException(e);
+            throw new JosmRuntimeException(e);
         }
         return proj;
Index: /trunk/src/org/openstreetmap/josm/data/projection/proj/SwissObliqueMercator.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/projection/proj/SwissObliqueMercator.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/data/projection/proj/SwissObliqueMercator.java	(revision 11374)
@@ -20,4 +20,5 @@
 import org.openstreetmap.josm.data.projection.Ellipsoid;
 import org.openstreetmap.josm.data.projection.ProjectionConfigurationException;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 
 // CHECKSTYLE.OFF: LineLength
@@ -108,5 +109,5 @@
         while (abs(phi - prevPhi) > EPSILON) {
             if (++iteration > 30)
-                throw new RuntimeException("Two many iterations");
+                throw new JosmRuntimeException("Two many iterations");
             prevPhi = phi;
             double s = 1 / alpha * (log(tan(PI / 4 + b / 2)) - k) + ellps.e
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java	(revision 11374)
@@ -1030,5 +1030,6 @@
                     l.rename((String) value);
                     break;
-                default: throw new RuntimeException();
+                default:
+                    throw new IllegalArgumentException("Wrong column: " + col);
                 }
                 fireTableCellUpdated(row, col);
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java	(revision 11374)
@@ -55,4 +55,5 @@
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.InputMapUtils;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.Shortcut;
 import org.xml.sax.SAXException;
@@ -634,5 +635,5 @@
             } catch (InterruptedException | InvocationTargetException e) {
                 // FIXME: signature of realRun should have a generic checked exception we could throw here
-                throw new RuntimeException(e);
+                throw new JosmRuntimeException(e);
             } finally {
                 monitor.finishTask();
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java	(revision 11374)
@@ -30,4 +30,5 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.ToTagConvertable;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.Utils;
 
@@ -819,5 +820,5 @@
                 return not ^ (Boolean) method.invoke(null, e);
             } catch (IllegalAccessException | InvocationTargetException ex) {
-                throw new RuntimeException(ex);
+                throw new JosmRuntimeException(ex);
             }
         }
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 11374)
@@ -40,4 +40,5 @@
 import org.openstreetmap.josm.tools.ColorHelper;
 import org.openstreetmap.josm.tools.Geometry;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.RightAndLefthandTraffic;
 import org.openstreetmap.josm.tools.SubclassFilteredCollection;
@@ -97,5 +98,5 @@
             parameterFunctions.add(Math.class.getMethod("tanh", double.class));
         } catch (NoSuchMethodException | SecurityException ex) {
-            throw new RuntimeException(ex);
+            throw new JosmRuntimeException(ex);
         }
     }
@@ -1240,5 +1241,5 @@
                 result = m.invoke(null, convertedArgs);
             } catch (IllegalAccessException | IllegalArgumentException ex) {
-                throw new RuntimeException(ex);
+                throw new JosmRuntimeException(ex);
             } catch (InvocationTargetException ex) {
                 Main.error(ex);
@@ -1306,5 +1307,5 @@
                 result = m.invoke(null, convertedArgs);
             } catch (IllegalAccessException | IllegalArgumentException ex) {
-                throw new RuntimeException(ex);
+                throw new JosmRuntimeException(ex);
             } catch (InvocationTargetException ex) {
                 Main.error(ex);
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 11374)
@@ -40,4 +40,5 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.Subpart;
 import org.openstreetmap.josm.tools.ColorHelper;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.Pair;
 import org.openstreetmap.josm.tools.Utils;
@@ -66,16 +67,18 @@
      */
     public static enum LexicalState {
-        PREPROCESSOR(0), /* the preprocessor */
-        DEFAULT(2);      /* the main parser */
-        
+        /** the preprocessor */
+        PREPROCESSOR(0),
+        /** the main parser */
+        DEFAULT(2);
+
         int idx; // the integer, which javacc assigns to this state
-        
+
         LexicalState(int idx) {
             if (!this.name().equals(MapCSSParserTokenManager.lexStateNames[idx])) {
-                throw new RuntimeException();
+                throw new JosmRuntimeException("Wrong name for index " + idx);
             }
             this.idx = idx;
         }
-    };
+    }
     
     /**
@@ -95,5 +98,5 @@
             scs = new SimpleCharStream(in, encoding, 1, 1);
         } catch (java.io.UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
+            throw new JosmRuntimeException(e);
         }
         return new MapCSSParserTokenManager(scs, initState.idx);
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 11374)
@@ -60,4 +60,5 @@
 import org.openstreetmap.josm.io.CachedFile;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.LanguageInfo;
 import org.openstreetmap.josm.tools.Utils;
@@ -108,8 +109,8 @@
                 SUPPORTED_KEYS.add((String) f.get(null));
                 if (!f.getName().toLowerCase(Locale.ENGLISH).replace('_', '-').equals(f.get(null))) {
-                    throw new RuntimeException(f.getName());
+                    throw new JosmRuntimeException(f.getName());
                 }
             } catch (IllegalArgumentException | IllegalAccessException ex) {
-                throw new RuntimeException(ex);
+                throw new JosmRuntimeException(ex);
             }
         }
@@ -468,5 +469,5 @@
                         break;
                     default:
-                        final RuntimeException e = new RuntimeException(MessageFormat.format("Unknown MapCSS base selector {0}", base));
+                        final RuntimeException e = new JosmRuntimeException(MessageFormat.format("Unknown MapCSS base selector {0}", base));
                         Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
                         Main.error(e);
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java	(revision 11374)
@@ -37,4 +37,5 @@
 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;
 import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 
 /**
@@ -479,5 +480,5 @@
         // should have been set to Mercator at JOSM start.
         if (pc == null)
-            throw new RuntimeException("Couldn't find the current projection in the list of available projections!");
+            throw new JosmRuntimeException("Couldn't find the current projection in the list of available projections!");
 
         projectionCombo.addActionListener(e -> {
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/TagCellRenderer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/TagCellRenderer.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/TagCellRenderer.java	(revision 11374)
@@ -12,4 +12,6 @@
 import javax.swing.border.EmptyBorder;
 import javax.swing.table.TableCellRenderer;
+
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 
 /**
@@ -102,5 +104,5 @@
         case 1: renderTagValue((TagModel) value); break;
 
-        default: throw new RuntimeException("unexpected index in switch statement");
+        default: throw new JosmRuntimeException("unexpected index in switch statement");
         }
         if (hasFocus && isSelected) {
Index: /trunk/src/org/openstreetmap/josm/io/GpxWriter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/GpxWriter.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/io/GpxWriter.java	(revision 11374)
@@ -27,4 +27,5 @@
 import org.openstreetmap.josm.data.gpx.IWithAttributes;
 import org.openstreetmap.josm.data.gpx.WayPoint;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 
 /**
@@ -291,5 +292,5 @@
             break;
         default:
-            throw new RuntimeException(tr("Unknown mode {0}.", mode));
+            throw new JosmRuntimeException(tr("Unknown mode {0}.", mode));
         }
         if (pnt != null) {
Index: /trunk/src/org/openstreetmap/josm/io/NmeaReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/NmeaReader.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/io/NmeaReader.java	(revision 11374)
@@ -20,4 +20,5 @@
 import org.openstreetmap.josm.data.gpx.ImmutableGpxTrack;
 import org.openstreetmap.josm.data.gpx.WayPoint;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.date.DateUtils;
 
@@ -116,5 +117,5 @@
         }
         if (d == null)
-            throw new RuntimeException("Date is malformed"); // malformed
+            throw new JosmRuntimeException("Date is malformed");
         return d;
     }
Index: /trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java	(revision 11374)
@@ -22,4 +22,5 @@
 import org.openstreetmap.josm.io.CachedFile;
 import org.openstreetmap.josm.tools.HttpClient;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.LanguageInfo;
 import org.openstreetmap.josm.tools.MultiMap;
@@ -273,5 +274,5 @@
             switch (states.pop()) {
             case INIT:
-                throw new RuntimeException("parsing error: more closing than opening elements");
+                throw new JosmRuntimeException("parsing error: more closing than opening elements");
             case ENTRY:
                 if ("entry".equals(qName)) {
Index: /trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/session/SessionReader.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/io/session/SessionReader.java	(revision 11374)
@@ -43,4 +43,5 @@
 import org.openstreetmap.josm.io.Compression;
 import org.openstreetmap.josm.io.IllegalDataException;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.MultiMap;
 import org.openstreetmap.josm.tools.Utils;
@@ -99,5 +100,5 @@
             importer = importerClass.getConstructor().newInstance();
         } catch (ReflectiveOperationException e) {
-            throw new RuntimeException(e);
+            throw new JosmRuntimeException(e);
         }
         return importer;
@@ -574,5 +575,5 @@
                 });
             } catch (InvocationTargetException | InterruptedException ex) {
-                throw new RuntimeException(ex);
+                throw new JosmRuntimeException(ex);
             }
         }
Index: /trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java	(revision 11374)
@@ -40,4 +40,5 @@
 import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer;
 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.MultiMap;
 import org.openstreetmap.josm.tools.Utils;
@@ -97,5 +98,5 @@
             return exporterClass.getConstructor(layerClass).newInstance(layer);
         } catch (ReflectiveOperationException e) {
-            throw new RuntimeException(e);
+            throw new JosmRuntimeException(e);
         }
     }
@@ -174,5 +175,5 @@
          */
         public OutputStream getOutputStreamZip(String zipPath) throws IOException {
-            if (!isZip()) throw new RuntimeException();
+            if (!isZip()) throw new JosmRuntimeException("not zip");
             ZipEntry entry = new ZipEntry(zipPath);
             zipOut.putNextEntry(entry);
@@ -277,5 +278,5 @@
             trans.transform(source, result);
         } catch (TransformerException e) {
-            throw new RuntimeException(e);
+            throw new JosmRuntimeException(e);
         }
     }
Index: /trunk/src/org/openstreetmap/josm/tools/FontsManager.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/FontsManager.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/tools/FontsManager.java	(revision 11374)
@@ -41,5 +41,5 @@
                 ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, i));
             } catch (IOException | FontFormatException ex) {
-                throw new RuntimeException(ex);
+                throw new JosmRuntimeException(ex);
             }
         }
Index: /trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 11374)
@@ -637,5 +637,5 @@
             if (!optional) {
                 String ext = name.indexOf('.') != -1 ? "" : ".???";
-                throw new RuntimeException(
+                throw new JosmRuntimeException(
                         tr("Fatal: failed to locate image ''{0}''. This is a serious configuration problem. JOSM will stop working.",
                                 name + ext));
Index: /trunk/src/org/openstreetmap/josm/tools/JosmRuntimeException.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/JosmRuntimeException.java	(revision 11374)
+++ /trunk/src/org/openstreetmap/josm/tools/JosmRuntimeException.java	(revision 11374)
@@ -0,0 +1,54 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.tools;
+
+/**
+ * JOSM runtime exception.
+ * @since 11374
+ */
+public class JosmRuntimeException extends RuntimeException {
+
+    /**
+     * Constructs a new {@code JosmRuntimeException} with the specified detail message.
+     * The cause is not initialized, and may subsequently be initialized by a call to {@link #initCause}.
+     *
+     * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
+     */
+    public JosmRuntimeException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new {@code JosmRuntimeException} with the specified cause and a detail message of
+     * <tt>(cause==null ? null : cause.toString())</tt> (which typically contains the class and detail message of <tt>cause</tt>).
+     * This constructor is useful for runtime exceptions that are little more than wrappers for other throwables.
+     *
+     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
+     */
+    public JosmRuntimeException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Constructs a new {@code JosmRuntimeException} with the specified detail message and cause.<p>
+     * Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated in this exception's detail message.
+     *
+     * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
+     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
+     */
+    public JosmRuntimeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Constructs a new runtime exception with the specified detail message, cause,
+     * suppression enabled or disabled, and writable stack trace enabled or disabled.
+     *
+     * @param message the detail message
+     * @param cause the cause
+     * @param enableSuppression whether or not suppression is enabled or disabled
+     * @param writableStackTrace whether or not the stack trace should be writable
+     */
+    public JosmRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}
Index: /trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java	(revision 11374)
@@ -158,5 +158,5 @@
             w.footer();
         } catch (IOException ex) {
-            throw new RuntimeException(ex);
+            throw new JosmRuntimeException(ex);
         }
     }
Index: /trunk/src/org/openstreetmap/josm/tools/Territories.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Territories.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/tools/Territories.java	(revision 11374)
@@ -104,5 +104,5 @@
             }
         } catch (IOException | IllegalDataException ex) {
-            throw new RuntimeException(ex);
+            throw new JosmRuntimeException(ex);
         }
     }
Index: /trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 11374)
@@ -556,5 +556,5 @@
             md = MessageDigest.getInstance("MD5");
         } catch (NoSuchAlgorithmException e) {
-            throw new RuntimeException(e);
+            throw new JosmRuntimeException(e);
         }
         byte[] byteData = data.getBytes(StandardCharsets.UTF_8);
@@ -621,5 +621,5 @@
                 }
             }
-            if (parentless == null) throw new RuntimeException();
+            if (parentless == null) throw new JosmRuntimeException("parentless");
             sorted.add(parentless);
             deps.remove(parentless);
@@ -628,5 +628,5 @@
             }
         }
-        if (sorted.size() != size) throw new RuntimeException();
+        if (sorted.size() != size) throw new JosmRuntimeException("Wrong size");
         return sorted;
     }
Index: /trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java	(revision 11373)
+++ /trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java	(revision 11374)
@@ -258,6 +258,5 @@
             return this;
         } catch (ParserConfigurationException e) {
-            // This should never happen ;-)
-            throw new RuntimeException(e);
+            throw new JosmRuntimeException(e);
         }
     }
