Ignore:
Timestamp:
2014-01-06T16:39:45+01:00 (10 years ago)
Author:
Don-vip
Message:

global replacement of e.printStackTrace() by Main.error(e)

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

Legend:

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

    r6362 r6643  
    9090     */
    9191    public static void explainGeneric(Exception e) {
    92         e.printStackTrace();
     92        Main.error(e);
    9393        BugReportExceptionHandler.handleException(e);
    9494    }
  • trunk/src/org/openstreetmap/josm/gui/FileDrop.java

    r6221 r6643  
    8585    private static Color defaultBorderColor = new Color( 0f, 0f, 1f, 0.25f );
    8686
    87     /** 
    88      * Constructor for JOSM file drop 
     87    /**
     88     * Constructor for JOSM file drop
    8989     * @param c The drop target
    9090     */
     
    226226            catch ( IOException io)
    227227            {   Main.warn("FileDrop: IOException - abort:" );
    228             io.printStackTrace();
     228            Main.error(io);
    229229            evt.rejectDrop();
    230230            }   // end catch IOException
    231231            catch (UnsupportedFlavorException ufe)
    232232            {   Main.warn("FileDrop: UnsupportedFlavorException - abort:" );
    233             ufe.printStackTrace();
     233            Main.error(ufe);
    234234            evt.rejectDrop();
    235235            }   // end catch: UnsupportedFlavorException
     
    333333        }   // end try
    334334        catch( TooManyListenersException e )
    335         {   e.printStackTrace();
     335        {   Main.error(e);
    336336        Main.warn("FileDrop: Drop will not work due to previous error. Do you have another listener attached?" );
    337337        }   // end catch
     
    413413     *
    414414     * @param c The component to unregister as a drop target
    415      * @return {@code true} if at least one item has been removed, {@code false} otherwise 
     415     * @return {@code true} if at least one item has been removed, {@code false} otherwise
    416416     */
    417417    public static boolean remove( Component c)
  • trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java

    r6362 r6643  
    6565                    instance.initFromOAuth(Main.parent);
    6666                } catch (Throwable t) {
    67                     t.printStackTrace();
     67                    Main.error(t);
    6868                    // Fall back to preferences if OAuth identification fails for any reason
    6969                    instance.initFromPreferences();
     
    218218            setFullyIdentified(info.getDisplayName(), info);
    219219        } catch (IllegalArgumentException e) {
    220             e.printStackTrace();
     220            Main.error(e);
    221221        } catch (OsmTransferException e) {
    222             e.printStackTrace();
     222            Main.error(e);
    223223        }
    224224    }
     
    277277                    instance.initFromOAuth(Main.parent);
    278278                } catch (Throwable t) {
    279                     t.printStackTrace();
     279                    Main.error(t);
    280280                }
    281281            }
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r6314 r6643  
    904904                thread.interrupt();
    905905            } catch (Exception e) {
    906                 e.printStackTrace();
     906                Main.error(e);
    907907            }
    908908        }
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r6539 r6643  
    273273            }
    274274        } catch (Exception e) {
    275             e.printStackTrace();
     275            Main.error(e);
    276276        }
    277277    }
  • trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

    r6310 r6643  
    4646import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;
    4747import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
     48import org.openstreetmap.josm.Main;
    4849import org.openstreetmap.josm.data.Bounds;
    4950import org.openstreetmap.josm.data.Version;
     
    718719                g.drawRect(x_min, y_min, w, h);
    719720            } catch (Exception e) {
    720                 e.printStackTrace();
     721                Main.error(e);
    721722            }
    722723        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java

    r6361 r6643  
    514514                        } catch(InterruptedException e) {
    515515                            Main.warn("InterruptedException in "+getClass().getSimpleName()+" while downloading changeset header");
    516                         } catch(ExecutionException e){
    517                             e.printStackTrace();
     516                        } catch(ExecutionException e) {
     517                            Main.error(e);
    518518                            BugReportExceptionHandler.handleException(e.getCause());
    519519                            return;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r6361 r6643  
    847847                    } else {
    848848                        Main.warn("Button " + button + " doesn't have action defined");
    849                         new Exception().printStackTrace();
     849                        Main.error(new Exception());
    850850                    }
    851851                }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r6380 r6643  
    223223                return getBaseUserUrl() + "/" + URLEncoder.encode(user.getName(), "UTF-8").replaceAll("\\+", "%20");
    224224            } catch(UnsupportedEncodingException e) {
    225                 e.printStackTrace();
     225                Main.error(e);
    226226                JOptionPane.showMessageDialog(
    227227                        Main.parent,
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r6623 r6643  
    10941094                            }
    10951095                        } catch (Exception e) {
    1096                             e.printStackTrace();
     1096                            Main.error(e);
    10971097                        }
    10981098                    }
    10991099                });
    11001100            } catch (Exception e1) {
    1101                 e1.printStackTrace();
     1101                Main.error(e1);
    11021102            }
    11031103        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java

    r6248 r6643  
    132132                return;
    133133            if (lastException != null) {
    134                 lastException.printStackTrace();
     134                Main.error(lastException);
    135135                return;
    136136            }
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r6552 r6643  
    246246                }
    247247            } catch (NumberFormatException x) {
    248                 x.printStackTrace(); // SAXException does not chain correctly
     248                Main.error(x); // SAXException does not chain correctly
    249249                throw new SAXException(x.getMessage(), x);
    250250            } catch (NullPointerException x) {
    251                 x.printStackTrace(); // SAXException does not chain correctly
     251                Main.error(x); // SAXException does not chain correctly
    252252                throw new SAXException(tr("Null pointer exception, possibly some missing tags."), x);
    253253            }
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r6296 r6643  
    146146        } catch(Exception e) {
    147147            Main.error(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString()));
    148             e.printStackTrace();
     148            Main.error(e);
    149149            return ss;
    150150        } finally {
     
    237237            help.getEditorKit().read(new StringReader(content), document, 0);
    238238        } catch (Exception e) {
    239             e.printStackTrace();
     239            Main.error(e);
    240240        }
    241241        help.setDocument(document);
     
    317317                    return;
    318318                } catch(HelpContentReaderException e2) {
    319                     e2.printStackTrace();
     319                    Main.error(e2);
    320320                    handleHelpContentReaderException(relativeHelpTopic, e2);
    321321                    return;
    322322                }
    323323            } catch(HelpContentReaderException e1) {
    324                 e1.printStackTrace();
     324                Main.error(e1);
    325325                handleHelpContentReaderException(relativeHelpTopic, e1);
    326326                return;
    327327            }
    328328        } catch(HelpContentReaderException e) {
    329             e.printStackTrace();
     329            Main.error(e);
    330330            handleHelpContentReaderException(relativeHelpTopic, e);
    331331            return;
     
    352352            return;
    353353        } catch(HelpContentReaderException e) {
    354             e.printStackTrace();
     354            Main.error(e);
    355355            handleHelpContentReaderException(absoluteHelpTopic, e);
    356356            return;
     
    556556                } catch (BadLocationException e) {
    557557                    Main.warn(tr("Bad location in HTML document. Exception was: {0}", e.toString()));
    558                     e.printStackTrace();
     558                    Main.error(e);
    559559                }
    560560            }
  • trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java

    r6519 r6643  
    154154                }
    155155            } catch(UnsupportedEncodingException e) {
    156                 e.printStackTrace();
     156                Main.error(e);
    157157                lblUser.setUrl(null);
    158158            }
     
    172172                    lblUser.setUrl(url);
    173173                } catch(UnsupportedEncodingException e) {
    174                     e.printStackTrace();
     174                    Main.error(e);
    175175                    lblUser.setUrl(null);
    176176                }
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java

    r6248 r6643  
    149149            download();
    150150        } catch(DownloadException e) {
    151             e.printStackTrace();
     151            Main.error(e);
    152152        }
    153153    }
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayerTask.java

    r5835 r6643  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import org.openstreetmap.josm.Main;
    67import org.openstreetmap.josm.actions.SaveAction;
    78import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    5657            }
    5758        } catch(Exception e) {
    58             e.printStackTrace();
     59            Main.error(e);
    5960            setLastException(e);
    6061        }
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r6084 r6643  
    2828import javax.swing.DefaultListCellRenderer;
    2929import javax.swing.ImageIcon;
     30import javax.swing.JButton;
    3031import javax.swing.JComponent;
    31 import javax.swing.JButton;
    3232import javax.swing.JDialog;
    3333import javax.swing.JLabel;
     
    482482                    model.setUploadState(layerInfo.getLayer(), UploadOrSaveState.CANCELED);
    483483                } catch(Exception e) {
    484                     e.printStackTrace();
     484                    Main.error(e);
    485485                    model.setUploadState(layerInfo.getLayer(), UploadOrSaveState.FAILED);
    486486                    ExceptionDialogUtil.explainException(e);
     
    489489                    model.setUploadState(layerInfo.getLayer(), UploadOrSaveState.CANCELED);
    490490                } else if (currentTask.isFailed()) {
    491                     currentTask.getLastException().printStackTrace();
     491                    Main.error(currentTask.getLastException());
    492492                    ExceptionDialogUtil.explainException(currentTask.getLastException());
    493493                    model.setUploadState(layerInfo.getLayer(), UploadOrSaveState.FAILED);
     
    516516                    model.setSaveState(layerInfo.getLayer(), UploadOrSaveState.CANCELED);
    517517                } catch(Exception e) {
    518                     e.printStackTrace();
     518                    Main.error(e);
    519519                    model.setSaveState(layerInfo.getLayer(), UploadOrSaveState.FAILED);
    520520                    ExceptionDialogUtil.explainException(e);
     
    524524                } else if (currentTask.isFailed()) {
    525525                    if (currentTask.getLastException() != null) {
    526                         currentTask.getLastException().printStackTrace();
     526                        Main.error(currentTask.getLastException());
    527527                        ExceptionDialogUtil.explainException(currentTask.getLastException());
    528528                    }
  • trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java

    r6316 r6643  
    254254                    break;
    255255                } catch(OsmTransferCanceledException e) {
    256                     e.printStackTrace();
     256                    Main.error(e);
    257257                    uploadCanceled = true;
    258258                    break uploadloop;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r6450 r6643  
    7878import org.xml.sax.SAXException;
    7979
    80 /** 
     80/**
    8181 * This class displays the window to select the GPX file and the offset (timezone + delta).
    8282 * Then it correlates the images of the layer with that GPX file.
     
    180180
    181181                } catch (SAXException x) {
    182                     x.printStackTrace();
     182                    Main.error(x);
    183183                    JOptionPane.showMessageDialog(
    184184                            Main.parent,
     
    189189                    return;
    190190                } catch (IOException x) {
    191                     x.printStackTrace();
     191                    Main.error(x);
    192192                    JOptionPane.showMessageDialog(
    193193                            Main.parent,
     
    11451145                        } catch(ParseException e) {
    11461146                            Main.error("Error while parsing date \"" + curWpTimeStr + '"');
    1147                             e.printStackTrace();
     1147                            Main.error(e);
    11481148                            prevWp = null;
    11491149                            prevWpTime = 0;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r6524 r6643  
    182182                        canonical = f.getCanonicalPath();
    183183                    } catch (IOException e) {
    184                         e.printStackTrace();
     184                        Main.error(e);
    185185                        rememberError(tr("Unable to get canonical path for directory {0}\n",
    186186                                f.getAbsolutePath()));
     
    199199                            addRecursiveFiles(files, Arrays.asList(children));
    200200                        } catch(NullPointerException npe) {
    201                             npe.printStackTrace();
     201                            Main.error(npe);
    202202                            rememberError(tr("Found null file in directory {0}\n", f.getPath()));
    203203                        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r6362 r6643  
    254254        } catch (IOException e) {
    255255            Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", entry.url, e.toString()));
    256             e.printStackTrace();
     256            Main.error(e);
    257257        } finally {
    258258            Utils.close(in);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java

    r6552 r6643  
    7979        } catch (IOException e) {
    8080            Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
    81             e.printStackTrace();
     81            Main.error(e);
    8282            logError(e);
    8383        } catch (TokenMgrError e) {
    8484            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
    85             e.printStackTrace();
     85            Main.error(e);
    8686            logError(e);
    8787        } catch (ParseException e) {
    8888            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
    89             e.printStackTrace();
     89            Main.error(e);
    9090            logError(new ParseException(e.getMessage())); // allow e to be garbage collected, it links to the entire token stream
    9191        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java

    r6579 r6643  
    8383        } catch (IOException e) {
    8484            Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
    85             e.printStackTrace();
     85            Main.error(e);
    8686            logError(e);
    8787        } catch (SAXParseException e) {
    8888            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: [{1}:{2}] {3}", url, e.getLineNumber(), e.getColumnNumber(), e.getMessage()));
    89             e.printStackTrace();
     89            Main.error(e);
    9090            logError(e);
    9191        } catch (SAXException e) {
    9292            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
    93             e.printStackTrace();
     93            Main.error(e);
    9494            logError(e);
    9595        }
  • trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java

    r6340 r6643  
    196196            }
    197197        } catch(CredentialsAgentException e) {
    198             e.printStackTrace();
     198            Main.error(e);
    199199            tfUserName.setText("");
    200200            tfPassword.setText("");
     
    525525                }
    526526            };
    527             e.printStackTrace();
     527            Main.error(e);
    528528            GuiHelper.runInEDT(r);
    529529        }
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r6599 r6643  
    111111                }
    112112            } catch (NoSuchFieldException e) {
    113                 e.printStackTrace();
     113                Main.error(e);
    114114                Main.warn(tr("Failed to cancel running OAuth operation"));
    115115            } catch (SecurityException e) {
    116                 e.printStackTrace();
     116                Main.error(e);
    117117                Main.warn(tr("Failed to cancel running OAuth operation"));
    118118            } catch (IllegalAccessException e) {
    119                 e.printStackTrace();
     119                Main.error(e);
    120120                Main.warn(tr("Failed to cancel running OAuth operation"));
    121121            }
  • trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveAccessTokenTask.java

    r5899 r6643  
    99import javax.swing.JOptionPane;
    1010
     11import org.openstreetmap.josm.Main;
    1112import org.openstreetmap.josm.data.oauth.OAuthParameters;
    1213import org.openstreetmap.josm.data.oauth.OAuthToken;
     
    8788            return;
    8889        } catch (OsmOAuthAuthorizationException e) {
    89             e.printStackTrace();
     90            Main.error(e);
    9091            alertRetrievingAccessTokenFailed(e);
    9192            accessToken = null;
  • trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveRequestTokenTask.java

    r5266 r6643  
    99import javax.swing.JOptionPane;
    1010
     11import org.openstreetmap.josm.Main;
    1112import org.openstreetmap.josm.data.oauth.OAuthParameters;
    1213import org.openstreetmap.josm.data.oauth.OAuthToken;
     
    8182            return;
    8283        } catch (OsmOAuthAuthorizationException e) {
    83             e.printStackTrace();
     84            Main.error(e);
    8485            alertRetrievingRequestTokenFailed(e);
    8586            requestToken = null;
  • trunk/src/org/openstreetmap/josm/gui/oauth/TestAccessTokenTask.java

    r6362 r6643  
    1717import oauth.signpost.exception.OAuthException;
    1818
     19import org.openstreetmap.josm.Main;
    1920import org.openstreetmap.josm.data.oauth.OAuthParameters;
    2021import org.openstreetmap.josm.data.oauth.OAuthToken;
     
    253254        }catch(OsmOAuthAuthorizationException e) {
    254255            if (canceled) return;
    255             e.printStackTrace();
     256            Main.error(e);
    256257            alertFailedSigning();
    257258        } catch(OsmApiException e) {
    258259            if (canceled) return;
    259             e.printStackTrace();
     260            Main.error(e);
    260261            if (e.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR) {
    261262                alertInternalError();
     
    271272        } catch(OsmTransferException e) {
    272273            if (canceled) return;
    273             e.printStackTrace();
     274            Main.error(e);
    274275            alertFailedConnection();
    275276        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r6529 r6643  
    552552                                    sps.addGui(this);
    553553                                } catch (SecurityException ex) {
    554                                     ex.printStackTrace();
     554                                    Main.error(ex);
    555555                                } catch (Throwable ex) {
    556556                                    BugReportExceptionHandler.handleException(ex);
     
    566566                    setSelectedIndex(index);
    567567                } catch (SecurityException ex) {
    568                     ex.printStackTrace();
     568                    Main.error(ex);
    569569                } catch (Throwable ex) {
    570570                    // allow to change most settings even if e.g. a plugin fails
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r6380 r6643  
    732732                        return true;
    733733                    } catch (Exception e) {
    734                         e.printStackTrace();
     734                        Main.error(e);
    735735                    }
    736736                    return false;
     
    751751                            }
    752752                        } catch (Exception e) {
    753                             e.printStackTrace();
     753                            Main.error(e);
    754754                        }
    755755                        movingComponent = "";
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java

    r6317 r6643  
    1212import java.util.List;
    1313import java.util.Map;
     14import java.util.Map.Entry;
    1415import java.util.Observable;
    1516import java.util.Set;
    16 import java.util.Map.Entry;
    1717
    1818import org.openstreetmap.josm.Main;
     
    359359                oldinfo.updateLocalInfo(newinfo);
    360360            } catch(PluginException e) {
    361                 e.printStackTrace();
     361                Main.error(e);
    362362            }
    363363        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java

    r6529 r6643  
    1414import javax.swing.JOptionPane;
    1515
     16import org.openstreetmap.josm.Main;
    1617import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    1718import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    211212                // ignore exceptions
    212213                return;
    213             e.printStackTrace();
     214            Main.error(e);
    214215            alertConnectionFailed();
    215216            return;
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/BasicAuthenticationPreferencesPanel.java

    r6529 r6643  
    108108            }
    109109        } catch(CredentialsAgentException e) {
    110             e.printStackTrace();
     110            Main.error(e);
    111111            Main.warn(tr("Failed to retrieve OSM credentials from credential manager."));
    112112            Main.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
     
    128128            cm.store(RequestorType.SERVER, OsmApi.getOsmApi().getHost(), pa);
    129129        } catch (CredentialsAgentException e) {
    130             e.printStackTrace();
     130            Main.error(e);
    131131            Main.warn(tr("Failed to save OSM credentials to credential manager."));
    132132            Main.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAccessTokenHolder.java

    r6529 r6643  
    154154            token = cm.lookupOAuthAccessToken();
    155155        } catch(CredentialsAgentException e) {
    156             e.printStackTrace();
     156            Main.error(e);
    157157            Main.warn(tr("Failed to retrieve OAuth Access Token from credential manager"));
    158158            Main.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
     
    185185            }
    186186        } catch(CredentialsAgentException e){
    187             e.printStackTrace();
     187            Main.error(e);
    188188            Main.warn(tr("Failed to store OAuth Access Token to credentials manager"));
    189189            Main.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/ProxyPreferencesPanel.java

    r6529 r6643  
    359359            }
    360360        } catch(CredentialsAgentException e) {
    361             e.printStackTrace();
     361            Main.error(e);
    362362            tfProxyHttpUser.setText("");
    363363            tfProxyHttpPassword.setText("");
     
    434434            cm.store(RequestorType.PROXY, tfProxyHttpHost.getText(), pa);
    435435        } catch(CredentialsAgentException e) {
    436             e.printStackTrace();
     436            Main.error(e);
    437437        }
    438438    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java

    r6529 r6643  
    8383                    }
    8484                } catch (Exception e) {
    85                     e.printStackTrace();
     85                    Main.error(e);
    8686                }
    8787            }
  • trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java

    r6362 r6643  
    8282                SwingUtilities.invokeAndWait(task);
    8383            } catch (InterruptedException e) {
    84                 e.printStackTrace();
     84                Main.error(e);
    8585            } catch (InvocationTargetException e) {
    86                 e.printStackTrace();
     86                Main.error(e);
    8787            }
    8888        }
Note: See TracChangeset for help on using the changeset viewer.