Ignore:
Timestamp:
2016-07-24T14:48:47+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S1166 - Exception handlers should preserve the original exceptions

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

Legend:

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

    r10620 r10627  
    145145                    ProxyPreference.removeProxyPreferenceListener(GettingStarted.this);
    146146                } catch (IOException ex) {
    147                     Main.warn(tr("Failed to read MOTD. Exception was: {0}", ex.toString()));
     147                    Main.warn(ex, tr("Failed to read MOTD. Exception was: {0}", ex.toString()));
    148148                    content = "<html>" + STYLE + "<h1>" + "JOSM - " + tr("Java OpenStreetMap Editor")
    149149                            + "</h1>\n<h2 align=\"center\">(" + tr("Message of the day not available") + ")</h2></html>";
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r10611 r10627  
    536536                    Main.setOffline(OnlineResource.valueOf(s.toUpperCase(Locale.ENGLISH)));
    537537                } catch (IllegalArgumentException e) {
    538                     Main.error(tr("''{0}'' is not a valid value for argument ''{1}''. Possible values are {2}, possibly delimited by commas.",
     538                    Main.error(e, tr("''{0}'' is not a valid value for argument ''{1}''. Possible values are {2}, possibly delimited by commas.",
    539539                            s.toUpperCase(Locale.ENGLISH), Option.OFFLINE.getName(), Arrays.toString(OnlineResource.values())));
    540540                    System.exit(1);
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r10611 r10627  
    361361        } catch (IllegalArgumentException e) {
    362362            // Ignored in old implementation
    363             if (Main.isDebugEnabled()) {
    364                 Main.debug(e.getMessage());
    365             }
     363            Main.debug(e);
    366364        }
    367365        try {
     
    369367        } catch (IllegalArgumentException e) {
    370368            // Ignored in old implementation
    371             if (Main.isDebugEnabled()) {
    372                 Main.debug(e.getMessage());
    373             }
     369            Main.debug(e);
    374370        }
    375371    }
     
    389385        } catch (IllegalArgumentException e) {
    390386            // Ignored in old implementation
    391             if (Main.isDebugEnabled()) {
    392                 Main.debug(e.getMessage());
    393             }
     387            Main.debug(e);
    394388        }
    395389    }
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r10611 r10627  
    7575                    }
    7676                } catch (IllegalArgumentException ex) {
     77                    Main.warn(ex);
    7778                    if (ex.getMessage() != null && !ex.getMessage().isEmpty()) {
    7879                        JOptionPane.showMessageDialog(Main.parent,
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java

    r10446 r10627  
    6464                filterMatcher.add(filter);
    6565            } catch (ParseError e) {
     66                Main.error(e);
    6667                JOptionPane.showMessageDialog(
    6768                        Main.parent,
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java

    r10611 r10627  
    236236            }
    237237        } catch (IllegalArgumentException e) {
     238            Main.trace(e);
    238239            latLon = null;
    239240        }
     
    254255            en = parseEastNorth(tfEastNorth.getText());
    255256        } catch (IllegalArgumentException e) {
     257            Main.trace(e);
    256258            en = null;
    257259        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r10611 r10627  
    656656                }
    657657            } catch (IOException ex) {
     658                Main.error(ex);
    658659                txtSource.append("<ERROR: failed to read file!>");
    659660            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r10611 r10627  
    110110            } catch (IllegalArgumentException e) {
    111111                // Legacy settings
     112                Main.trace(e);
    112113                return Boolean.parseBoolean(s) ? ButtonHidingType.DYNAMIC : ButtonHidingType.ALWAYS_SHOWN;
    113114            }
     
    699700                new WindowGeometry(preferencePrefix+".geometry").applySafe(this);
    700701            } catch (WindowGeometryException e) {
     702                Main.debug(e);
    701703                ToggleDialog.this.setPreferredSize(ToggleDialog.this.getDefaultDetachedSize());
    702704                pack();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManager.java

    r10611 r10627  
    393393                    }
    394394                } catch (IllegalStateException e) {
     395                    Main.error(e);
    395396                    JOptionPane.showMessageDialog(parent, e.getMessage(), tr("Error"), JOptionPane.ERROR_MESSAGE);
    396397                }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java

    r10378 r10627  
    195195                q = BasicQuery.valueOf(BasicQuery.class, value);
    196196            } catch (IllegalArgumentException e) {
    197                 Main.warn(tr("Unexpected value for preference ''{0}'', got ''{1}''. Resetting to default query.",
     197                Main.warn(e, tr("Unexpected value for preference ''{0}'', got ''{1}''. Resetting to default query.",
    198198                        "changeset-query.basic.query", value));
    199199                q = BasicQuery.MOST_RECENT_CHANGESETS;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryDialog.java

    r10479 r10627  
    2323import javax.swing.KeyStroke;
    2424
     25import org.openstreetmap.josm.Main;
    2526import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    2627import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction;
     
    192193                setVisible(false);
    193194            } catch (IllegalStateException e) {
     195                Main.error(e);
    194196                JOptionPane.showMessageDialog(ChangesetQueryDialog.this, e.getMessage(), tr("Error"), JOptionPane.ERROR_MESSAGE);
    195197            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java

    r10611 r10627  
    134134            return ChangesetQuery.buildFromUrlQuery(url.getQuery());
    135135        } catch (ChangesetQueryUrlException e) {
    136             Main.warn(e.getMessage());
     136            Main.warn(e);
    137137            return null;
    138138        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r10611 r10627  
    935935            return modified ? new ChangeCommand(orig, relation) : null;
    936936        } catch (AddAbortException ign) {
     937            Main.trace(ign);
    937938            return null;
    938939        }
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java

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

    r10611 r10627  
    138138            tpDownloadAreaSelectors.setSelectedIndex(Main.pref.getInteger("download.tab", 0));
    139139        } catch (IndexOutOfBoundsException ex) {
     140            Main.trace(ex);
    140141            Main.pref.putInteger("download.tab", 0);
    141142        }
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r10611 r10627  
    301301            content = reader.fetchHelpTopicContent(url, true);
    302302        } catch (MissingHelpContentException e) {
     303            Main.trace(e);
    303304            url = getHelpTopicUrl(buildAbsoluteHelpTopic(relativeHelpTopic, LocaleType.BASELANGUAGE));
    304305            try {
    305306                content = reader.fetchHelpTopicContent(url, true);
    306307            } catch (MissingHelpContentException e1) {
     308                Main.trace(e1);
    307309                url = getHelpTopicUrl(buildAbsoluteHelpTopic(relativeHelpTopic, LocaleType.ENGLISH));
    308310                try {
    309311                    content = reader.fetchHelpTopicContent(url, true);
    310312                } catch (MissingHelpContentException e2) {
     313                    Main.debug(e2);
    311314                    this.url = url;
    312315                    handleMissingHelpContent(relativeHelpTopic);
     
    344347            content = reader.fetchHelpTopicContent(url, true);
    345348        } catch (MissingHelpContentException e) {
     349            Main.debug(e);
    346350            this.url = url;
    347351            handleMissingHelpContent(absoluteHelpTopic);
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r10413 r10627  
    144144            HistoryOsmPrimitive.forOsmPrimitive(primitive);
    145145        } catch (IllegalArgumentException ign) {
     146            Main.trace(ign);
    146147            return false;
    147148        }
  • trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java

    r10179 r10627  
    110110            setAlwaysOnTop(true);
    111111        } catch (SecurityException e) {
    112             Main.warn(tr("Failed to put Credential Dialog always on top. Caught security exception."));
     112            Main.warn(e, tr("Failed to put Credential Dialog always on top. Caught security exception."));
    113113        }
    114114        build();
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTask.java

    r10611 r10627  
    110110                im.setPartiallyIdentified(im.getUserName());
    111111            }
    112             Main.warn(tr("Failed to retrieve user infos for the current JOSM user. Exception was: {0}", e.toString()));
     112            Main.warn(e, tr("Failed to retrieve user infos for the current JOSM user. Exception was: {0}", e.toString()));
    113113        }
    114114    }
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r10611 r10627  
    493493                    currentFuture.get();
    494494                } catch (CancellationException e) {
     495                    Main.trace(e);
    495496                    model.setUploadState(layer, UploadOrSaveState.CANCELED);
    496497                } catch (InterruptedException | ExecutionException e) {
     
    534535                    currentFuture.get();
    535536                } catch (CancellationException e) {
     537                    Main.trace(e);
    536538                    model.setSaveState(layerInfo.getLayer(), UploadOrSaveState.CANCELED);
    537539                } catch (InterruptedException | ExecutionException e) {
  • trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java

    r10611 r10627  
    228228            SwingUtilities.invokeAndWait(r);
    229229        } catch (InterruptedException e) {
     230            Main.trace(e);
    230231            lastException = e;
    231232        } catch (InvocationTargetException e) {
     233            Main.trace(e);
    232234            lastException = new OsmTransferException(e.getCause());
    233235        }
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r10619 r10627  
    942942                sldSeconds.setValue((int) (deciSeconds % 60));
    943943            } catch (RuntimeException e) {
     944                Main.warn(e);
    944945                JOptionPane.showMessageDialog(Main.parent,
    945946                        tr("An error occurred while trying to match the photos to the GPX track."
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r10611 r10627  
    183183                addRecursiveFiles(files, selection);
    184184            } catch (IllegalStateException e) {
     185                Main.debug(e);
    185186                rememberError(e.getMessage());
    186187            }
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java

    r10611 r10627  
    152152                return new TemplateParser(s).parse();
    153153            } catch (ParseError e) {
     154                Main.debug(e);
    154155                Main.warn("Unable to parse template engine pattern ''{0}'' for property {1}. Using default (''{2}'') instead",
    155156                        s, getKey(), super.getDefaultValueAsString());
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r10611 r10627  
    261261                return new Color(r, g, b);
    262262            } catch (IllegalArgumentException e) {
     263                Main.trace(e);
    263264                return null;
    264265            }
     
    279280                return new Color(r, g, b, alpha);
    280281            } catch (IllegalArgumentException e) {
     282                Main.trace(e);
    281283                return null;
    282284            }
     
    294296                return Color.getHSBColor(h, s, b);
    295297            } catch (IllegalArgumentException e) {
     298                Main.trace(e);
    296299                return null;
    297300            }
     
    628631                return RotationAngle.parseCardinalRotation(cardinal);
    629632            } catch (IllegalArgumentException ignore) {
     633                Main.trace(ignore);
    630634                return null;
    631635            }
     
    668672                m = SearchCompiler.compile(searchStr);
    669673            } catch (ParseError ex) {
     674                Main.trace(ex);
    670675                return null;
    671676            }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r10300 r10627  
    331331                    };
    332332                } catch (NoSuchElementException ignore) {
     333                    Main.trace(ignore);
    333334                    containsFinder = new ContainsFinder(e);
    334335                }
     
    468469                    if (!c.applies(env)) return false;
    469470                } catch (PatternSyntaxException e) {
    470                     Main.error("PatternSyntaxException while applying condition" + c +": "+e.getMessage());
     471                    Main.error(e, "PatternSyntaxException while applying condition" + c + ':');
    471472                    return false;
    472473                }
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r10378 r10627  
    343343                        userName));
    344344        } catch (OsmOAuthAuthorizationException e) {
     345            Main.debug(e);
    345346            throw new OsmLoginFailedException(e.getCause());
    346347        } catch (IOException e) {
  • trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveAccessTokenTask.java

    r10611 r10627  
    8787            accessToken = client.getAccessToken(getProgressMonitor().createSubTaskMonitor(0, false));
    8888        } catch (OsmTransferCanceledException e) {
     89            Main.trace(e);
    8990            return;
    9091        } catch (final OsmOAuthAuthorizationException e) {
  • trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveRequestTokenTask.java

    r10611 r10627  
    8181            requestToken = client.getRequestToken(getProgressMonitor().createSubTaskMonitor(0, false));
    8282        } catch (OsmTransferCanceledException e) {
     83            Main.trace(e);
    8384            return;
    8485        } catch (final OsmOAuthAuthorizationException e) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r10619 r10627  
    338338                        Main.pref.save();
    339339                    } catch (IOException e) {
    340                         Main.warn("IOException while saving preferences: "+e.getMessage());
     340                        Main.warn(e, "IOException while saving preferences:");
    341341                    }
    342342                    readPreferences(Main.pref);
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java

    r10611 r10627  
    453453            parser.parse();
    454454        } catch (ParseError e) {
     455            Main.warn(e);
    455456            JOptionPane.showMessageDialog(Main.parent,
    456457                    tr("Incorrect waypoint label pattern: {0}", e.getMessage()), tr("Incorrect pattern"), JOptionPane.ERROR_MESSAGE);
     
    462463            parser.parse();
    463464        } catch (ParseError e) {
     465            Main.warn(e);
    464466            JOptionPane.showMessageDialog(Main.parent,
    465467                    tr("Incorrect audio waypoint label pattern: {0}", e.getMessage()), tr("Incorrect pattern"), JOptionPane.ERROR_MESSAGE);
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java

    r10212 r10627  
    8686            } catch (ReflectiveOperationException ex) {
    8787                // just debug, Quaqua may not even be installed...
    88                 Main.debug(ex.getMessage());
     88                Main.debug(ex);
    8989            }
    9090        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java

    r10611 r10627  
    764764                    htmlPane = new JosmEditorPane(url);
    765765                } catch (IOException e1) {
     766                    Main.trace(e1);
    766767                    // give a second chance with a default Locale 'en'
    767768                    try {
     
    769770                        htmlPane = new JosmEditorPane(url);
    770771                    } catch (IOException e2) {
     772                        Main.debug(e2);
    771773                        JOptionPane.showMessageDialog(gui, tr("EULA license URL not available: {0}", eulaUrl));
    772774                        return false;
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java

    r10626 r10627  
    5757                            canLoad = true;
    5858                        } catch (IOException e) {
    59                             Main.warn(tr("Could not read tagging preset source: {0}", source));
     59                            Main.warn(e, tr("Could not read tagging preset source: {0}", source));
    6060                            ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Error"),
    6161                                    new String[] {tr("Yes"), tr("No"), tr("Cancel")});
     
    8282                            // Should not happen, but at least show message
    8383                            String msg = tr("Could not read tagging preset source {0}", source);
    84                             Main.error(msg);
     84                            Main.error(e, msg);
    8585                            JOptionPane.showMessageDialog(Main.parent, msg);
    8686                            return false;
     
    9595                                        source, e.getLineNumber(), e.getColumnNumber(), e.getMessage());
    9696                            }
     97                            Main.warn(e, errorMessage);
    9798                        } catch (SAXException e) {
    9899                            if (canLoad) {
     
    105106                                        source, e.getMessage());
    106107                            }
     108                            Main.warn(e, errorMessage);
    107109                        }
    108110
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java

    r10611 r10627  
    9797                        test.update(input.getText());
    9898                    } catch (ProjectionConfigurationException ex) {
     99                        Main.warn(ex);
    99100                        error = ex.getMessage();
    100101                        valStatus.setIcon(ImageProvider.get("data", "error"));
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java

    r10173 r10627  
    191191                Capabilities.CapabilitiesParser.parse(new InputSource(connection.getResponse().getContent()));
    192192            } catch (SAXException | ParserConfigurationException e) {
    193                 Main.warn(e.getMessage());
     193                Main.warn(e);
    194194                alertInvalidCapabilities();
    195195                return;
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java

    r10611 r10627  
    222222                    PRESET_TAG_CACHE.putAll(ki.key, ki.getValues());
    223223                } catch (NullPointerException e) {
    224                     Main.error(p + ": Unable to cache " + ki);
     224                    Main.error(e, p + ": Unable to cache " + ki);
    225225                }
    226226            }
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmPasswordField.java

    r8419 r10627  
    126126                        pasteAction.actionPerformed(e);
    127127                    } catch (NullPointerException npe) {
    128                         Main.error("NullPointerException occured because of JDK bug 6322854. "
     128                        Main.error(npe, "NullPointerException occured because of JDK bug 6322854. "
    129129                                +"Copy/Paste operation has not been performed. Please complain to Oracle: "+
    130130                                "https://bugs.openjdk.java.net/browse/JDK-6322854");
  • trunk/src/org/openstreetmap/josm/gui/widgets/OsmIdTextField.java

    r8496 r10627  
    1010import javax.swing.text.JTextComponent;
    1111
     12import org.openstreetmap.josm.Main;
    1213import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1314import org.openstreetmap.josm.data.osm.PrimitiveId;
     
    110111                    } catch (IllegalArgumentException ex) {
    111112                        try {
     113                            Main.trace(ex);
    112114                            long id = Long.parseLong(s);
    113115                            if (id <= 0) {
     
    123125                            }
    124126                        } catch (IllegalArgumentException ex2) {
     127                            Main.trace(ex2);
    125128                            return false;
    126129                        }
Note: See TracChangeset for help on using the changeset viewer.