Ignore:
Timestamp:
2016-05-15T00:51:10+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S2221 - "Exception" should not be caught when not required by called methods

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/FileDrop.java

    r9992 r10212  
    2323import java.io.Reader;
    2424import java.net.URI;
     25import java.net.URISyntaxException;
    2526import java.util.ArrayList;
    2627import java.util.Arrays;
     
    3435import org.openstreetmap.josm.Main;
    3536import org.openstreetmap.josm.actions.OpenFileAction;
     37import org.openstreetmap.josm.gui.FileDrop.TransferableObject;
    3638
    3739// CHECKSTYLE.OFF: HideUtilityClassConstructor
     
    138140        try {
    139141            List<File> list = new ArrayList<>();
    140             String line = null;
     142            String line;
    141143            while ((line = bReader.readLine()) != null) {
    142144                try {
     
    146148                    }
    147149
    148                     File file = new File(new URI(line));
    149                     list.add(file);
    150                 } catch (Exception ex) {
     150                    list.add(new File(new URI(line)));
     151                } catch (URISyntaxException ex) {
    151152                    Main.warn("Error with " + line + ": " + ex.getMessage());
    152153                }
  • trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java

    r9759 r10212  
    6666                try {
    6767                    instance.initFromOAuth();
    68                 } catch (Exception e) {
     68                } catch (RuntimeException e) {
    6969                    Main.error(e);
    7070                    // Fall back to preferences if OAuth identification fails for any reason
     
    304304            accessTokenSecretChanged = false;
    305305            if (OsmApi.isUsingOAuth()) {
    306                 try {
    307                     getInstance().initFromOAuth();
    308                 } catch (Exception e) {
    309                     Main.error(e);
    310                 }
     306                getInstance().initFromOAuth();
    311307            }
    312308        }
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r10200 r10212  
    403403                try (InputStream is = HttpClient.create(new URL(i)).connect().getContent()) {
    404404                    config.openAndReadXML(is);
    405                 } catch (Exception ex) {
     405                } catch (IOException ex) {
    406406                    throw new RuntimeException(ex);
    407407                }
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r10191 r10212  
    10971097            try {
    10981098                thread.interrupt();
    1099             } catch (Exception e) {
     1099            } catch (RuntimeException e) {
    11001100                Main.error(e);
    11011101            }
  • trunk/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java

    r10055 r10212  
    55import java.awt.EventQueue;
    66import java.io.IOException;
     7import java.lang.reflect.InvocationTargetException;
    78
    89import javax.swing.SwingUtilities;
     
    122123                }
    123124            }
    124         } catch (final Exception e) {
     125        } catch (final RuntimeException |
     126                OsmTransferException | IOException | SAXException | InvocationTargetException | InterruptedException e) {
    125127            if (!ignoreException) {
    126128                // Exception has to thrown in EDT to be shown to user
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r10001 r10212  
    199199    @Override
    200200    public void paint(Graphics g) {
    201         try {
    202             super.paint(g);
    203 
    204             // draw selection rectangle
    205             if (iSelectionRectStart != null && iSelectionRectEnd != null) {
    206                 Rectangle box = new Rectangle(getMapPosition(iSelectionRectStart, false));
    207                 box.add(getMapPosition(iSelectionRectEnd, false));
    208 
    209                 g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
    210                 g.fillRect(box.x, box.y, box.width, box.height);
    211 
    212                 g.setColor(Color.BLACK);
    213                 g.drawRect(box.x, box.y, box.width, box.height);
    214             }
    215         } catch (Exception e) {
    216             Main.error(e);
     201        super.paint(g);
     202
     203        // draw selection rectangle
     204        if (iSelectionRectStart != null && iSelectionRectEnd != null) {
     205            Rectangle box = new Rectangle(getMapPosition(iSelectionRectStart, false));
     206            box.add(getMapPosition(iSelectionRectEnd, false));
     207
     208            g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
     209            g.fillRect(box.x, box.y, box.width, box.height);
     210
     211            g.setColor(Color.BLACK);
     212            g.drawRect(box.x, box.y, box.width, box.height);
    217213        }
    218214    }
  • trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

    r10179 r10212  
    4545import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;
    4646import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
    47 import org.openstreetmap.josm.Main;
    4847import org.openstreetmap.josm.data.Bounds;
    4948import org.openstreetmap.josm.data.Version;
     
    694693        @Override
    695694        public void paint(Graphics g) {
    696             try {
    697                 super.paint(g);
    698                 if (min == null || max == null) return;
    699                 int zoomDiff = MAX_ZOOM - zoom;
    700                 Point tlc = getTopLeftCoordinates();
    701                 int xMin = (min.x >> zoomDiff) - tlc.x;
    702                 int yMin = (min.y >> zoomDiff) - tlc.y;
    703                 int xMax = (max.x >> zoomDiff) - tlc.x;
    704                 int yMax = (max.y >> zoomDiff) - tlc.y;
    705 
    706                 int w = xMax - xMin;
    707                 int h = yMax - yMin;
    708                 g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
    709                 g.fillRect(xMin, yMin, w, h);
    710 
    711                 g.setColor(Color.BLACK);
    712                 g.drawRect(xMin, yMin, w, h);
    713             } catch (Exception e) {
    714                 Main.error(e);
    715             }
     695            super.paint(g);
     696            if (min == null || max == null) return;
     697            int zoomDiff = MAX_ZOOM - zoom;
     698            Point tlc = getTopLeftCoordinates();
     699            int xMin = (min.x >> zoomDiff) - tlc.x;
     700            int yMin = (min.y >> zoomDiff) - tlc.y;
     701            int xMax = (max.x >> zoomDiff) - tlc.x;
     702            int yMax = (max.y >> zoomDiff) - tlc.y;
     703
     704            int w = xMax - xMin;
     705            int h = yMax - yMin;
     706            g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
     707            g.fillRect(xMin, yMin, w, h);
     708
     709            g.setColor(Color.BLACK);
     710            g.drawRect(xMin, yMin, w, h);
    716711        }
    717712    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java

    r10124 r10212  
    235235                        });
    236236                    }
    237                 } catch (final Exception e) {
     237                } catch (final RuntimeException e) {
    238238                    GuiHelper.runInEDT(new Runnable() {
    239239                        @Override
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r10106 r10212  
    1616import java.beans.PropertyChangeEvent;
    1717import java.beans.PropertyChangeListener;
     18import java.io.IOException;
    1819import java.net.URI;
    1920import java.net.URISyntaxException;
     
    12161217                                }
    12171218                            }
    1218                         } catch (Exception e) {
     1219                        } catch (URISyntaxException | IOException e) {
    12191220                            Main.error(e);
    12201221                        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java

    r9543 r10212  
    426426                    }
    427427                });
    428             } catch (Exception e) {
     428            } catch (OsmTransferException e) {
    429429                if (canceled) {
    430430                    Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
     
    475475                    refreshView(r);
    476476                }
    477             } catch (Exception e) {
     477            } catch (OsmTransferException e) {
    478478                if (canceled) {
    479479                    Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/DownloadRelationMemberTask.java

    r9241 r10212  
    143143            );
    144144
    145         } catch (Exception e) {
     145        } catch (OsmTransferException e) {
    146146            if (canceled) {
    147147                Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/DownloadRelationTask.java

    r9078 r10212  
    55
    66import java.io.IOException;
     7import java.lang.reflect.InvocationTargetException;
    78import java.util.Collection;
    89
     
    107108                    }
    108109            );
    109         } catch (Exception e) {
     110        } catch (OsmTransferException | InvocationTargetException | InterruptedException e) {
    110111            if (canceled) {
    111112                Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTransferHandler.java

    r9993 r10212  
    5454                importPrimitiveData(support, destination, insertRow);
    5555            }
    56         } catch (Exception e) {
     56        } catch (IOException | UnsupportedFlavorException e) {
    5757            Main.warn(e);
    5858            return false;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ParentRelationLoadingTask.java

    r9999 r10212  
    188188                );
    189189            }
    190         } catch (Exception e) {
     190        } catch (OsmTransferException e) {
    191191            if (canceled) {
    192192                Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java

    r10113 r10212  
    106106                    return e.getConstructor(Relation.class, Collection.class).newInstance(layer, r, selectedMembers);
    107107                }
    108             } catch (Exception ex) {
     108            } catch (ReflectiveOperationException ex) {
    109109                Main.warn(ex);
    110110            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java

    r9078 r10212  
    157157                ds = reader.parseOsm(progressMonitor
    158158                        .createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
    159             } catch (Exception e) {
     159            } catch (OsmTransferException e) {
    160160                if (canceled) {
    161161                    Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java

    r9371 r10212  
    147147                try {
    148148                    bookmarks.add(new Bookmark(entry));
    149                 } catch (Exception e) {
     149                } catch (IllegalArgumentException e) {
    150150                    Main.error(tr("Error reading bookmark entry: %s", e.getMessage()));
    151151                }
  • trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java

    r10179 r10212  
    144144        try {
    145145            tpDownloadAreaSelectors.setSelectedIndex(Main.pref.getInteger("download.tab", 0));
    146         } catch (Exception ex) {
     146        } catch (IndexOutOfBoundsException ex) {
    147147            Main.pref.putInteger("download.tab", 0);
    148148        }
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r9972 r10212  
    4141import javax.swing.table.TableCellRenderer;
    4242import javax.swing.table.TableColumn;
     43import javax.xml.parsers.ParserConfigurationException;
    4344
    4445import org.openstreetmap.josm.Main;
     
    396397                    });
    397398                }
    398             } catch (Exception e) {
     399            } catch (IOException | ParserConfigurationException e) {
    399400                if (!canceled) {
    400401                    OsmTransferException ex = new OsmTransferException(e);
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r10210 r10212  
    1616import java.awt.event.WindowEvent;
    1717import java.io.BufferedReader;
     18import java.io.IOException;
    1819import java.io.InputStreamReader;
    1920import java.io.StringReader;
     
    155156                css.append('\n');
    156157            }
    157         } catch (Exception e) {
     158        } catch (IOException e) {
    158159            Main.error(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString()));
    159160            Main.error(e);
     
    239240        try {
    240241            help.getEditorKit().read(new StringReader(content), document, 0);
    241         } catch (Exception e) {
     242        } catch (IOException | BadLocationException e) {
    242243            Main.error(e);
    243244        }
     
    376377                history.setCurrentUrl(url);
    377378                this.url = url;
    378             } catch (Exception e) {
     379            } catch (HelpContentReaderException e) {
    379380                Main.warn(e);
    380381                HelpAwareOptionPane.showOptionDialog(
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java

    r10173 r10212  
    211211                        });
    212212                    }
    213                 } catch (final Exception e) {
     213                } catch (final RuntimeException e) {
    214214                    BugReportExceptionHandler.handleException(e);
    215215                }
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r10210 r10212  
    143143        try {
    144144            HistoryOsmPrimitive.forOsmPrimitive(primitive);
    145         } catch (Exception ign) {
     145        } catch (IllegalArgumentException ign) {
    146146            return false;
    147147        }
  • trunk/src/org/openstreetmap/josm/gui/io/AbstractPrimitiveTask.java

    r10129 r10212  
    113113
    114114            loadIncompleteNodes();
    115         } catch (Exception e) {
     115        } catch (OsmTransferException e) {
    116116            if (canceled)
    117117                return;
  • trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetTask.java

    r9078 r10212  
    8080                closedChangesets.add(cs);
    8181            }
    82         } catch (Exception e) {
     82        } catch (OsmTransferException e) {
    8383            if (canceled)
    8484                return;
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTask.java

    r10035 r10212  
    154154                    getProgressMonitor().createSubTaskMonitor(1, false /* not internal */)
    155155            );
    156         } catch (Exception e) {
     156        } catch (OsmTransferException e) {
    157157            if (canceled)
    158158                return;
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayerTask.java

    r9078 r10212  
    5656                layerInfo.getLayer().onPostSaveToFile();
    5757            }
    58         } catch (Exception e) {
     58        } catch (RuntimeException e) {
    5959            Main.error(e);
    6060            setLastException(e);
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r10190 r10212  
    2121import java.util.List;
    2222import java.util.concurrent.CancellationException;
     23import java.util.concurrent.ExecutionException;
    2324import java.util.concurrent.ExecutorService;
    2425import java.util.concurrent.Executors;
     
    496497                } catch (CancellationException e) {
    497498                    model.setUploadState(layer, UploadOrSaveState.CANCELED);
    498                 } catch (Exception e) {
     499                } catch (InterruptedException | ExecutionException e) {
    499500                    Main.error(e);
    500501                    model.setUploadState(layer, UploadOrSaveState.FAILED);
     
    537538                } catch (CancellationException e) {
    538539                    model.setSaveState(layerInfo.getLayer(), UploadOrSaveState.CANCELED);
    539                 } catch (Exception e) {
     540                } catch (InterruptedException | ExecutionException e) {
    540541                    Main.error(e);
    541542                    model.setSaveState(layerInfo.getLayer(), UploadOrSaveState.FAILED);
  • trunk/src/org/openstreetmap/josm/gui/io/UploadLayerTask.java

    r9543 r10212  
    137137                }
    138138            }
    139         } catch (Exception sxe) {
     139        } catch (OsmTransferException sxe) {
    140140            if (isCanceled()) {
    141141                Main.info("Ignoring exception caught because upload is canceled. Exception is: " + sxe);
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r10209 r10212  
    465465                public void valueChanged(ListSelectionEvent arg0) {
    466466                    int index = imgList.getSelectedIndex();
    467                     Integer orientation = null;
    468                     try {
    469                         orientation = ExifReader.readOrientation(yLayer.data.get(index).getFile());
    470                     } catch (Exception e) {
    471                         Main.warn(e);
    472                     }
     467                    Integer orientation = ExifReader.readOrientation(yLayer.data.get(index).getFile());
    473468                    imgDisp.setImage(yLayer.data.get(index).getFile(), orientation);
    474469                    Date date = yLayer.data.get(index).getExifTime();
     
    500495                    File sel = fc.getSelectedFile();
    501496
    502                     Integer orientation = null;
    503                     try {
    504                         orientation = ExifReader.readOrientation(sel);
    505                     } catch (Exception e) {
    506                         Main.warn(e);
    507                     }
     497                    Integer orientation = ExifReader.readOrientation(sel);
    508498                    imgDisp.setImage(sel, orientation);
    509499
    510                     Date date = null;
    511                     try {
    512                         date = ExifReader.readTime(sel);
    513                     } catch (Exception e) {
    514                         Main.warn(e);
    515                     }
     500                    Date date = ExifReader.readTime(sel);
    516501                    if (date != null) {
    517502                        lbExifTime.setText(DateUtils.getDateTimeFormat(DateFormat.SHORT, DateFormat.MEDIUM).format(date));
     
    967952                final long deciSeconds = timezoneOffsetPair.b.getMilliseconds() / 100;
    968953                sldSeconds.setValue((int) (deciSeconds % 60));
    969             } catch (Exception e) {
     954            } catch (RuntimeException e) {
    970955                JOptionPane.showMessageDialog(Main.parent,
    971956                        tr("An error occurred while trying to match the photos to the GPX track."
     
    10151000            for (GpxTrackSegment segment : trk.getSegments()) {
    10161001                for (WayPoint curWp : segment.getWayPoints()) {
    1017                     try {
    1018                         final Date parsedTime = curWp.setTimeFromAttribute();
    1019                         if (parsedTime != null) {
    1020                             firstGPXDate = parsedTime.getTime();
    1021                             break outer;
    1022                         }
    1023                     } catch (Exception e) {
    1024                         Main.warn(e);
     1002                    final Date parsedTime = curWp.setTimeFromAttribute();
     1003                    if (parsedTime != null) {
     1004                        firstGPXDate = parsedTime.getTime();
     1005                        break outer;
    10251006                    }
    10261007                }
     
    11501131
    11511132                for (WayPoint curWp : segment.getWayPoints()) {
    1152                     try {
    1153                         final Date parsedTime = curWp.setTimeFromAttribute();
    1154                         if (parsedTime != null) {
    1155                             final long curWpTime = parsedTime.getTime() + offset;
    1156                             ret += matchPoints(images, prevWp, prevWpTime, curWp, curWpTime, offset);
    1157 
    1158                             prevWp = curWp;
    1159                             prevWpTime = curWpTime;
    1160                             continue;
    1161                         }
    1162                     } catch (Exception e) {
    1163                         Main.warn(e);
     1133                    final Date parsedTime = curWp.setTimeFromAttribute();
     1134                    if (parsedTime != null) {
     1135                        final long curWpTime = parsedTime.getTime() + offset;
     1136                        ret += matchPoints(images, prevWp, prevWpTime, curWp, curWpTime, offset);
     1137
     1138                        prevWp = curWp;
     1139                        prevWpTime = curWpTime;
     1140                        continue;
    11641141                    }
    11651142                    prevWp = null;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java

    r9383 r10212  
    492492            // default is K (km/h)
    493493            setSpeed(speed);
    494         } catch (Exception ex) {
     494        } catch (MetadataException ex) {
    495495            if (Main.isDebugEnabled()) {
    496496                Main.debug(ex.getMessage());
     
    516516            setPos(getExifCoor());
    517517
    518         } catch (Exception ex) { // (other exceptions, e.g. #5271)
     518        } catch (MetadataException | IndexOutOfBoundsException ex) { // (other exceptions, e.g. #5271)
    519519            Main.error("Error reading EXIF from file: " + ex);
    520520            setExifCoor(null);
     
    527527                setExifImgDir(direction);
    528528            }
    529         } catch (Exception ex) { // (CompoundException and other exceptions, e.g. #5271)
     529        } catch (IndexOutOfBoundsException ex) { // (other exceptions, e.g. #5271)
    530530            if (Main.isDebugEnabled()) {
    531531                Main.debug(ex.getMessage());
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r10186 r10212  
    164164            int i = Main.pref.getInteger("draw.rawgps.colors", specName(layerName), 0);
    165165            return ColorMode.fromIndex(i);
    166         } catch (Exception e) {
     166        } catch (IndexOutOfBoundsException e) {
    167167            Main.warn(e);
    168168        }
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java

    r9779 r10212  
    5151    public static PlayHeadMarker create() {
    5252        if (playHead == null) {
    53             try {
    54                 playHead = new PlayHeadMarker();
    55             } catch (Exception ex) {
    56                 Main.error(ex);
    57                 return null;
    58             }
     53            playHead = new PlayHeadMarker();
    5954        }
    6055        return playHead;
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/WebMarker.java

    r8846 r10212  
    6666            try {
    6767                setErroneous(path.isEmpty() || !new File(path).exists());
    68             } catch (Exception e) {
     68            } catch (SecurityException e) {
    6969                Main.warn(e);
    7070                setErroneous(true);
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r10055 r10212  
    622622                                } catch (SecurityException ex) {
    623623                                    Main.error(ex);
    624                                 } catch (Exception ex) {
     624                                } catch (RuntimeException ex) {
    625625                                    BugReportExceptionHandler.handleException(ex);
    626626                                } finally {
     
    636636                } catch (SecurityException ex) {
    637637                    Main.error(ex);
    638                 } catch (Exception ex) {
     638                } catch (RuntimeException ex) {
    639639                    // allow to change most settings even if e.g. a plugin fails
    640640                    BugReportExceptionHandler.handleException(ex);
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r10179 r10212  
    504504            loader.realRun();
    505505            return loader.sources;
    506         } catch (Exception ex) {
     506        } catch (IOException | SAXException | OsmTransferException ex) {
    507507            throw new RuntimeException(ex);
    508508        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r10179 r10212  
    575575                    movingComponent = "";
    576576                    return true;
    577                 } catch (Exception e) {
     577                } catch (IOException | UnsupportedFlavorException e) {
    578578                    Main.error(e);
    579579                }
     
    594594                            }
    595595                        }
    596                     } catch (Exception e) {
     596                    } catch (IOException | UnsupportedFlavorException e) {
    597597                        Main.error(e);
    598598                    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java

    r10001 r10212  
    8484                        new UIManager.LookAndFeelInfo(((LookAndFeel) oquaqua).getName(), "ch.randelshofer.quaqua.QuaquaLookAndFeel")
    8585                );
    86             } catch (Exception ex) {
     86            } catch (ReflectiveOperationException ex) {
    8787                // just debug, Quaqua may not even be installed...
    8888                Main.debug(ex.getMessage());
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java

    r10179 r10212  
    3636import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
    3737import org.openstreetmap.josm.io.OsmApi;
     38import org.openstreetmap.josm.io.OsmApiInitializationException;
     39import org.openstreetmap.josm.io.OsmTransferCanceledException;
    3840import org.openstreetmap.josm.tools.ImageProvider;
    3941import org.openstreetmap.josm.tools.Utils;
     
    157159            try {
    158160                OsmApi.getOsmApi().initialize(null);
    159             } catch (Exception x) {
     161            } catch (OsmTransferCanceledException | OsmApiInitializationException x) {
    160162                Main.warn(x);
    161163            }
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java

    r10001 r10212  
    118118        try {
    119119            return Integer.valueOf(str);
    120         } catch (Exception e) {
     120        } catch (NumberFormatException e) {
    121121            if (Main.isTraceEnabled()) {
    122122                Main.trace(e.getMessage());
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r9996 r10212  
    447447                                "public static String[] methodName()"));
    448448                    }
    449                 } catch (Exception e) {
     449                } catch (ReflectiveOperationException e) {
    450450                    Main.error(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' threw {2} ({3})", key, text,
    451451                            e.getClass().getName(), e.getMessage()));
  • trunk/src/org/openstreetmap/josm/gui/widgets/AbstractIdTextField.java

    r8308 r10212  
    3838                validator = klass.getConstructor(JTextComponent.class).newInstance(this);
    3939            }
    40         } catch (Exception e) {
     40        } catch (ReflectiveOperationException e) {
    4141            Main.error(e);
    4242        } finally {
Note: See TracChangeset for help on using the changeset viewer.