Changeset 6643 in josm


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
Files:
96 edited

Legend:

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

    r6642 r6643  
    227227        if (logLevel < 1)
    228228            return;
    229         System.err.println(tr("ERROR: {0}", msg));
     229        if (msg != null && !msg.isEmpty()) {
     230            System.err.println(tr("ERROR: {0}", msg));
     231        }
    230232    }
    231233
     
    237239        if (logLevel < 2)
    238240            return;
    239         System.err.println(tr("WARNING: {0}", msg));
     241        if (msg != null && !msg.isEmpty()) {
     242            System.err.println(tr("WARNING: {0}", msg));
     243        }
    240244    }
    241245
     
    247251        if (logLevel < 3)
    248252            return;
    249         System.out.println(tr("INFO: {0}", msg));
     253        if (msg != null && !msg.isEmpty()) {
     254            System.out.println(tr("INFO: {0}", msg));
     255        }
    250256    }
    251257
     
    257263        if (logLevel < 4)
    258264            return;
    259         System.out.println(tr("DEBUG: {0}", msg));
     265        if (msg != null && !msg.isEmpty()) {
     266            System.out.println(tr("DEBUG: {0}", msg));
     267        }
    260268    }
    261269
     
    323331     * @param t The throwable object causing the error
    324332     * @param stackTrace {@code true}, if the stacktrace should be displayed
    325      * @since 6442
     333     * @since 6642
    326334     */
    327335    public static void error(Throwable t, boolean stackTrace) {
     
    336344     * @param t The throwable object causing the error
    337345     * @param stackTrace {@code true}, if the stacktrace should be displayed
    338      * @since 6442
     346     * @since 6642
    339347     */
    340348    public static void warn(Throwable t, boolean stackTrace) {
     
    13951403     * @param t The network error
    13961404     * @return The previous error associated to the given resource, if any. Can be {@code null}
    1397      * @since 6639
     1405     * @since 6642
    13981406     */
    13991407    public static Throwable addNetworkError(URL url, Throwable t) {
     
    14151423     * @param t The network error
    14161424     * @return The previous error associated to the given resource, if any. Can be {@code null}
    1417      * @since 6639
     1425     * @since 6642
    14181426     */
    14191427    public static Throwable addNetworkError(String url, Throwable t) {
  • trunk/src/org/openstreetmap/josm/actions/DownloadAlongAction.java

    r6054 r6643  
    111111                    future.get();
    112112                } catch (Exception e) {
    113                     e.printStackTrace();
     113                    Main.error(e);
    114114                    return;
    115115                }
  • trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java

    r6380 r6643  
    8686                try {
    8787                    exporter.exportData(file, layer);
    88                 } catch (IOException e1) {
    89                     e1.printStackTrace();
     88                } catch (IOException e) {
     89                    Main.error(e);
    9090                }
    9191            }
  • trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java

    r6474 r6643  
    143143                    }
    144144                } catch (Exception e) {
    145                     e.printStackTrace();
     145                    Main.error(e);
    146146                }
    147147            }
     
    163163                    result.append(task.acceptsDocumentationSummary());
    164164                } catch (Exception e) {
    165                     e.printStackTrace();
     165                    Main.error(e);
    166166                }
    167167            }
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r6234 r6643  
    5454            restartJOSM();
    5555        } catch (IOException ex) {
    56             ex.printStackTrace();
     56            Main.error(ex);
    5757        }
    5858    }
     
    123123                        Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()]));
    124124                    } catch (IOException e) {
    125                         e.printStackTrace();
     125                        Main.error(e);
    126126                    }
    127127                }
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r6380 r6643  
    8787            Main.parent.repaint();
    8888        } catch (IOException e) {
    89             e.printStackTrace();
     89            Main.error(e);
    9090            return false;
    9191        }
  • trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java

    r6271 r6643  
    4747    @Override
    4848    public void actionPerformed(ActionEvent e) {
    49         JFileChooser fc = createAndOpenFileChooser(true, false, tr("Open session"), 
    50                 Arrays.asList(SessionImporter.FILE_FILTER, FileFilterAllFiles.getInstance()), 
     49        JFileChooser fc = createAndOpenFileChooser(true, false, tr("Open session"),
     50                Arrays.asList(SessionImporter.FILE_FILTER, FileFilterAllFiles.getInstance()),
    5151                SessionImporter.FILE_FILTER, JFileChooser.FILES_ONLY, "lastDirectory");
    5252        if (fc == null) return;
     
    174174                }
    175175            } catch (IllegalDataException e) {
    176                 e.printStackTrace();
     176                Main.error(e);
    177177                HelpAwareOptionPane.showMessageDialogInEDT(
    178178                        Main.parent,
     
    184184                cancel();
    185185            } catch (IOException e) {
    186                 e.printStackTrace();
     186                Main.error(e);
    187187                HelpAwareOptionPane.showMessageDialogInEDT(
    188188                        Main.parent,
  • trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java

    r6271 r6643  
    134134            sw.write(file);
    135135        } catch (IOException ex) {
    136             ex.printStackTrace();
     136            Main.error(ex);
    137137            HelpAwareOptionPane.showMessageDialogInEDT(
    138138                    Main.parent,
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r6103 r6643  
    165165            }
    166166        } catch (Exception x) {
    167             x.printStackTrace();
     167            Main.error(x);
    168168        }
    169169
  • trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java

    r6053 r6643  
    9797                                future.get();
    9898                            } catch(Exception e) {
    99                                 e.printStackTrace();
     99                                Main.error(e);
    100100                                return;
    101101                            }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadSessionTask.java

    r6245 r6643  
    5555                return Main.worker.submit(loader);
    5656            } catch (URISyntaxException e) {
    57                 e.printStackTrace();
     57                Main.error(e);
    5858            } catch (MalformedURLException e) {
    59                 e.printStackTrace();
     59                Main.error(e);
    6060            } catch (IOException e) {
    61                 e.printStackTrace();
     61                Main.error(e);
    6262            }
    6363        }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java

    r6524 r6643  
    249249                    future.get();
    250250                } catch (Exception e) {
    251                     e.printStackTrace();
     251                    Main.error(e);
    252252                    return;
    253253                }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandler.java

    r6524 r6643  
    7070                future.get();
    7171            } catch(Exception e) {
    72                 e.printStackTrace();
     72                Main.error(e);
    7373                return;
    7474            }
  • trunk/src/org/openstreetmap/josm/command/ConflictAddCommand.java

    r6248 r6643  
    4141            getLayer().getConflicts().add(conflict);
    4242        } catch(IllegalStateException e) {
    43             e.printStackTrace();
     43            Main.error(e);
    4444            warnBecauseOfDoubleConflict();
    4545        }
  • trunk/src/org/openstreetmap/josm/data/AutosaveTask.java

    r6357 r6643  
    216216                Main.error("Autosave failed:");
    217217                Main.error(t);
    218                 t.printStackTrace();
    219218            }
    220219        }
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r6578 r6643  
    274274            ts.transform(new DOMSource(exportDocument), new StreamResult(f.toURI().getPath()));
    275275        } catch (Exception ex) {
    276             Main.warn("Error saving preferences part: " +ex.getMessage());
    277             ex.printStackTrace();
     276            Main.warn("Error saving preferences part:");
     277            Main.error(ex);
    278278        }
    279279    }
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r6626 r6643  
    781781            }
    782782        } catch(IOException e) {
    783             e.printStackTrace();
     783            Main.error(e);
    784784            JOptionPane.showMessageDialog(
    785785                    Main.parent,
     
    793793            load();
    794794        } catch (Exception e) {
    795             e.printStackTrace();
     795            Main.error(e);
    796796            File backupFile = new File(prefDir,"preferences.xml.bak");
    797797            JOptionPane.showMessageDialog(
     
    806806                save();
    807807            } catch(IOException e1) {
    808                 e1.printStackTrace();
     808                Main.error(e1);
    809809                Main.warn(tr("Failed to initialize preferences. Failed to reset preference file to default: {0}", getPreferenceFile()));
    810810            }
  • trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java

    r6578 r6643  
    7878            } catch (IOException e) {
    7979                Main.error(e);
    80                 e.printStackTrace();
    8180            }
    8281            return null;
     
    107106                        );
    108107            } catch (Exception e) {
    109                 e.printStackTrace();
     108                Main.error(e);
    110109                JOptionPane.showMessageDialog(
    111110                        Main.parent,
     
    123122            connection = new Connection(new URL(serverUrl+"user/preferences"));
    124123        } catch (MalformedURLException e) {
    125             e.printStackTrace();
     124            Main.error(e);
    126125            JOptionPane.showMessageDialog(
    127126                    Main.parent,
     
    173172            fromXML(in);
    174173        } catch (RuntimeException e) {
    175             e.printStackTrace();
     174            Main.error(e);
    176175        } catch (XMLStreamException e) {
    177             e.printStackTrace();
     176            Main.error(e);
    178177        }
    179178        return res;
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r6421 r6643  
    5050        } catch (IOException e) {
    5151            Main.error(tr("Failed to load resource ''{0}'', error is {1}.", resource.toString(), e.toString()));
    52             e.printStackTrace();
     52            Main.error(e);
    5353        }
    5454        return s;
  • trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java

    r6248 r6643  
    126126            } catch (IOException e) {
    127127                Main.error("Unable to load layers index for wms cache");
    128                 e.printStackTrace();
     128                Main.error(e);
    129129            }
    130130
     
    152152                } catch (IOException e) {
    153153                    Main.error("Unable to save layer index for wms cache");
    154                     e.printStackTrace();
     154                    Main.error(e);
    155155                }
    156156            }
     
    201201        } catch (Exception e) {
    202202            if (indexFile.exists()) {
    203                 e.printStackTrace();
     203                Main.error(e);
    204204                Main.info("Unable to load index for wms-cache, new file will be created");
    205205            } else {
     
    298298        } catch (Exception e) {
    299299            Main.error("Failed to save wms-cache file");
    300             e.printStackTrace();
     300            Main.error(e);
    301301        }
    302302    }
     
    365365            } catch (IOException e) {
    366366                Main.error("Unable to load file from wms cache");
    367                 e.printStackTrace();
     367                Main.error(e);
    368368                return null;
    369369            }
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r6380 r6643  
    791791    }
    792792
    793 
    794793    /**
    795794     * Show message and stack trace in log in case primitive is not found
     
    803802                    + "at http://josm.openstreetmap.de/. This is not a critical error, it should be safe to continue in your work.",
    804803                    primitiveId.getType(), Long.toString(primitiveId.getUniqueId())));
    805             new Exception().printStackTrace();
     804            Main.error(new Exception());
    806805        }
    807806
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r6629 r6643  
    160160            }
    161161        } catch (Exception e){
    162             e.printStackTrace();
     162            Main.error(e);
    163163        }
    164164    }
     
    174174                }
    175175            } catch (final FileNotFoundException e) {
    176                 // Ignore
     176                Main.debug(Main.getErrorMessage(e));
    177177            } catch (final IOException e) {
    178                 e.printStackTrace();
     178                Main.error(e);
    179179            } finally {
    180180                Utils.close(in);
     
    199199            }
    200200        } catch (IOException e) {
    201             e.printStackTrace();
     201            Main.error(e);
    202202        } finally {
    203203            Utils.close(out);
     
    291291                }
    292292            } catch (Exception e) {
    293                 e.printStackTrace();
     293                Main.error(e);
    294294                JOptionPane.showMessageDialog(Main.parent,
    295295                        tr("Error initializing test {0}:\n {1}", test.getClass()
  • 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        }
  • trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java

    r6552 r6643  
    173173            output.flush();
    174174        } catch(Exception e) {
    175             e.printStackTrace();
     175            Main.error(e);
    176176        } finally {
    177177            Utils.close(output);
  • trunk/src/org/openstreetmap/josm/io/ChangesetClosedException.java

    r6248 r6643  
    8484            } catch(ParseException ex) {
    8585                Main.error(tr("Failed to parse date ''{0}'' replied by server.", m.group(2)));
    86                 ex.printStackTrace();
     86                Main.error(ex);
    8787            }
    8888        } else {
  • trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java

    r6440 r6643  
    1919import java.util.Map.Entry;
    2020
     21import org.openstreetmap.josm.Main;
    2122import org.openstreetmap.josm.data.Bounds;
    2223import org.openstreetmap.josm.data.coor.LatLon;
     
    259260                sb.append("display_name").append("=").append(URLEncoder.encode(userName, "UTF-8"));
    260261            } catch (UnsupportedEncodingException e) {
    261                 e.printStackTrace();
     262                Main.error(e);
    262263            }
    263264        }
  • trunk/src/org/openstreetmap/josm/io/FileImporter.java

    r6634 r6643  
    8383   
    8484    private static void displayError(File f, Exception e) {
    85         e.printStackTrace();
     85        Main.error(e);
    8686        HelpAwareOptionPane.showMessageDialogInEDT(
    8787                Main.parent,
     
    110110            return true;
    111111        } catch (Exception e) {
    112             e.printStackTrace();
     112            Main.error(e);
    113113            HelpAwareOptionPane.showMessageDialogInEDT(
    114114                    Main.parent,
  • trunk/src/org/openstreetmap/josm/io/GpxExporter.java

    r6084 r6643  
    179179            fo.flush();
    180180        } catch (IOException x) {
    181             x.printStackTrace();
     181            Main.error(x);
    182182            JOptionPane.showMessageDialog(Main.parent, tr("Error while exporting {0}:\n{1}", fn, x.getMessage()),
    183183                    tr("Error"), JOptionPane.ERROR_MESSAGE);
  • trunk/src/org/openstreetmap/josm/io/GpxImporter.java

    r6084 r6643  
    9292            addLayers(loadLayers(r.getGpxData(), parsedProperly, fileName, tr("Markers from {0}", fileName)));
    9393        } catch (SAXException e) {
    94             e.printStackTrace();
     94            Main.error(e);
    9595            throw new IOException(tr("Parsing data for layer ''{0}'' failed", fileName));
    9696        }
     
    167167            return loadLayers(r.getGpxData(), parsedProperly, gpxLayerName, markerLayerName);
    168168        } catch (SAXException e) {
    169             e.printStackTrace();
     169            Main.error(e);
    170170            throw new IOException(tr("Parsing data for layer ''{0}'' failed", gpxLayerName));
    171171        }
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r6380 r6643  
    467467                throw e;
    468468        } catch (ParserConfigurationException e) {
    469             e.printStackTrace(); // broken SAXException chaining
     469            Main.error(e); // broken SAXException chaining
    470470            throw new SAXException(e);
    471471        }
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r6248 r6643  
    357357                }
    358358            } catch (InterruptedException e) {
    359                 e.printStackTrace();
     359                Main.error(e);
    360360            } catch (ExecutionException e) {
    361                 e.printStackTrace();
     361                Main.error(e);
    362362            }
    363363        }
  • trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java

    r6070 r6643  
    2525            "osc,osc.bz2,osc.bz,osc.gz", "osc", tr("OsmChange File") + " (*.osc *.osc.bz2 *.osc.bz *.osc.gz)");
    2626
     27    /**
     28     * Constructs a new {@code OsmChangeImporter}.
     29     */
    2730    public OsmChangeImporter() {
    2831        super(FILE_FILTER);
     
    4649
    4750        } catch (FileNotFoundException e) {
    48             e.printStackTrace();
     51            Main.error(e);
    4952            throw new IOException(tr("File ''{0}'' does not exist.", file.getName()));
    5053        }
  • trunk/src/org/openstreetmap/josm/io/OsmConnection.java

    r6552 r6643  
    99import java.nio.CharBuffer;
    1010import java.nio.charset.CharacterCodingException;
    11 import java.nio.charset.Charset;
    1211import java.nio.charset.CharsetEncoder;
    1312
     
    4241            HttpURLConnection.setFollowRedirects(true);
    4342        } catch (SecurityException e) {
    44             e.printStackTrace();
     43            Main.error(e);
    4544        }
    4645    }
    4746
     47    /**
     48     * Cancels the connection.
     49     */
    4850    public void cancel() {
    4951        cancel = true;
  • trunk/src/org/openstreetmap/josm/io/OsmExporter.java

    r6552 r6643  
    8787            layer.onPostSaveToFile();
    8888        } catch (IOException e) {
    89             e.printStackTrace();
     89            Main.error(e);
    9090            JOptionPane.showMessageDialog(
    9191                    Main.parent,
     
    102102                }
    103103            } catch (IOException e2) {
    104                 e2.printStackTrace();
     104                Main.error(e2);
    105105                JOptionPane.showMessageDialog(
    106106                        Main.parent,
  • trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java

    r6552 r6643  
    1111import javax.xml.parsers.SAXParserFactory;
    1212
     13import org.openstreetmap.josm.Main;
    1314import org.openstreetmap.josm.data.osm.history.HistoryDataSet;
    1415import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive;
     
    4243        }
    4344
     45        @Override
    4446        protected void throwException(String message) throws SAXException {
    4547            throw new SAXException(getCurrentPosition() + message);
     
    8688            SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new Parser());
    8789        } catch (ParserConfigurationException e) {
    88             e.printStackTrace(); // broken SAXException chaining
     90            Main.error(e); // broken SAXException chaining
    8991            throw new SAXException(e);
    9092        } finally {
  • trunk/src/org/openstreetmap/josm/io/OsmImporter.java

    r6070 r6643  
    6565            importData(in, file, progressMonitor);
    6666        } catch (FileNotFoundException e) {
    67             e.printStackTrace();
     67            Main.error(e);
    6868            throw new IOException(tr("File ''{0}'' does not exist.", file.getName()));
    6969        } finally {
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r6380 r6643  
    110110                activeConnection.connect();
    111111            } catch (Exception e) {
    112                 e.printStackTrace();
     112                Main.error(e);
    113113                OsmTransferException ote = new OsmTransferException(tr("Could not connect to the OSM server. Please check your internet connection."), e);
    114114                ote.setUrl(url.toString());
     
    171171     * @param progressMonitor The progress monitor
    172172     * @return The corresponding dataset
    173      * @throws OsmTransferException if any error occurs 
     173     * @throws OsmTransferException if any error occurs
    174174     */
    175175    public abstract DataSet parseOsm(final ProgressMonitor progressMonitor) throws OsmTransferException;
     
    179179     * @param progressMonitor The progress monitor
    180180     * @return The corresponding dataset
    181      * @throws OsmTransferException if any error occurs 
     181     * @throws OsmTransferException if any error occurs
    182182     */
    183183    public DataSet parseOsmChange(final ProgressMonitor progressMonitor) throws OsmTransferException {
     
    189189     * @param progressMonitor The progress monitor
    190190     * @return The corresponding dataset
    191      * @throws OsmTransferException if any error occurs 
     191     * @throws OsmTransferException if any error occurs
    192192     */
    193193    public DataSet parseOsmChangeBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
     
    199199     * @param progressMonitor The progress monitor
    200200     * @return The corresponding dataset
    201      * @throws OsmTransferException if any error occurs 
     201     * @throws OsmTransferException if any error occurs
    202202     */
    203203    public DataSet parseOsmChangeGzip(final ProgressMonitor progressMonitor) throws OsmTransferException {
     
    230230     * @param progressMonitor The progress monitor
    231231     * @return The corresponding dataset
    232      * @throws OsmTransferException if any error occurs 
     232     * @throws OsmTransferException if any error occurs
    233233     */
    234234    public DataSet parseOsmBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
     
    240240     * @param progressMonitor The progress monitor
    241241     * @return The corresponding dataset
    242      * @throws OsmTransferException if any error occurs 
     242     * @throws OsmTransferException if any error occurs
    243243     */
    244244    public DataSet parseOsmGzip(final ProgressMonitor progressMonitor) throws OsmTransferException {
  • trunk/src/org/openstreetmap/josm/io/auth/DefaultAuthenticator.java

    r6365 r6643  
    77import java.util.Map;
    88
     9import org.openstreetmap.josm.Main;
    910import org.openstreetmap.josm.io.OsmApi;
    1011
     
    5758            return new PasswordAuthentication(response.getUsername(), response.getPassword());
    5859        } catch(CredentialsAgentException e) {
    59             e.printStackTrace();
     60            Main.error(e);
    6061            return null;
    6162        }
  • trunk/src/org/openstreetmap/josm/io/imagery/Grabber.java

    r6313 r6643  
    7070                }
    7171                if(i == maxTries) {
    72                     e.printStackTrace();
     72                    Main.error(e);
    7373                    request.finish(State.FAILED, null);
    7474                }
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r6552 r6643  
    1515import javax.xml.parsers.SAXParserFactory;
    1616
     17import org.openstreetmap.josm.Main;
    1718import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1819import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryBounds;
     
    2122import org.openstreetmap.josm.io.MirroredInputStream;
    2223import org.openstreetmap.josm.io.UTFInputStreamReader;
    23 import org.openstreetmap.josm.tools.Utils;
    2424import org.xml.sax.Attributes;
    2525import org.xml.sax.InputSource;
     
    5959            throw e;
    6060        } catch (ParserConfigurationException e) {
    61             e.printStackTrace(); // broken SAXException chaining
     61            Main.error(e); // broken SAXException chaining
    6262            throw new SAXException(e);
    6363        }
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java

    r6248 r6643  
    7272
    7373        } catch(Exception e) {
    74             e.printStackTrace();
    75             throw new Exception(e.getMessage() + "\nImage couldn't be fetched: " + (url != null ? url.toString() : ""));
     74            Main.error(e);
     75            throw new Exception(e.getMessage() + "\nImage couldn't be fetched: " + (url != null ? url.toString() : ""), e);
    7676        }
    7777    }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpServer.java

    r6248 r6643  
    4040                    Integer.toString(port), ex.getLocalizedMessage());
    4141        } catch (IOException ioe) {
    42             ioe.printStackTrace();
     42            Main.error(ioe);
    4343        }
    4444    }
     
    5454                instance = null;
    5555            } catch (IOException ioe) {
    56                 ioe.printStackTrace();
     56                Main.error(ioe);
    5757            }
    5858        }
     
    6464     * @throws IOException when connection errors
    6565     */
    66     public RemoteControlHttpServer(int port)
    67         throws IOException
    68     {
     66    public RemoteControlHttpServer(int port) throws IOException {
    6967        super("RemoteControl HTTP Server");
    7068        this.setDaemon(true);
     
    8179     */
    8280    @Override
    83     public void run()
    84     {
     81    public void run() {
    8582        Main.info(marktr("RemoteControl::Accepting connections on port {0}"),
    8683             Integer.toString(server.getLocalPort()));
    87         while (true)
    88         {
    89             try
    90             {
     84        while (true) {
     85            try {
    9186                Socket request = server.accept();
    9287                RequestProcessor.processRequest(request);
    93             }
    94             catch( SocketException se)
    95             {
     88            } catch( SocketException se) {
    9689                if( !server.isClosed() )
    97                     se.printStackTrace();
    98                 }
    99             catch (IOException ioe)
    100             {
    101                 ioe.printStackTrace();
     90                    Main.error(se);
     91            } catch (IOException ioe) {
     92                Main.error(ioe);
    10293            }
    10394        }
     
    109100     * @throws IOException
    110101     */
    111     public void stopServer() throws IOException
    112     {
     102    public void stopServer() throws IOException {
    113103        server.close();
    114104        Main.info(marktr("RemoteControl::Server stopped."));
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r6536 r6643  
    240240
    241241        } catch (IOException ioe) {
     242            Main.debug(Main.getErrorMessage(ioe));
    242243        } catch (Exception e) {
    243             e.printStackTrace();
     244            Main.error(e);
    244245            try {
    245246                sendError(out);
     
    250251                request.close();
    251252            } catch (IOException e) {
     253                Main.debug(Main.getErrorMessage(e));
    252254            }
    253255        }
     
    389391            handler = handlers.get(cmd).newInstance();
    390392        } catch (Exception ex) {
    391             ex.printStackTrace();
     393            Main.error(ex);
    392394            return null;
    393395        }
     
    450452     * @return HTML message with the description of all available commands
    451453     * @throws IllegalAccessException
    452      * @throws InstantiationException 
     454     * @throws InstantiationException
    453455     */
    454456    public static String getUsageAsHtml() throws IllegalAccessException, InstantiationException {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java

    r6536 r6643  
    3636        } catch (Exception ex) {
    3737            Main.warn("RemoteControl: Error parsing import remote control request:");
    38             ex.printStackTrace();
     38            Main.error(ex);
    3939            throw new RequestHandlerErrorException();
    4040        }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r6536 r6643  
    8989    public String[] getUsageExamples(String cmd) {
    9090        if (command.equals(cmd)) {
    91             return new String[] { 
     91            return new String[] {
    9292                    "/load_and_zoom?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5&select=way23071688,way23076176,way23076177,&left=13.740&right=13.741&top=51.05&bottom=51.049",
    9393                    "/load_and_zoom?left=8.19&right=8.20&top=48.605&bottom=48.590&select=node413602999&new_layer=true"};
    9494        } else {
    95             return new String[] { 
     95            return new String[] {
    9696            "/zoom?left=8.19&right=8.20&top=48.605&bottom=48.590&select=node413602999"};
    9797        }
     
    139139        } catch (Exception ex) {
    140140            Main.warn("RemoteControl: Error parsing load_and_zoom remote control request:");
    141             ex.printStackTrace();
     141            Main.error(ex);
    142142            throw new RequestHandlerErrorException();
    143143        }
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r6310 r6643  
    458458                }
    459459                if (exception != null) {
    460                     exception.printStackTrace();
     460                    Main.error(exception);
    461461                    CancelOrContinueDialog dialog = new CancelOrContinueDialog();
    462462                    dialog.show(
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java

    r6248 r6643  
    163163                download(d, pluginFile);
    164164            } catch(PluginDownloadException e) {
    165                 e.printStackTrace();
     165                Main.error(e);
    166166                failed.add(d);
    167167                continue;
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r6615 r6643  
    560560            msg = null;
    561561        } catch (PluginException e) {
    562             Main.error(e.getMessage());
    563             Throwable cause = e.getCause();
    564             if (cause != null) {
    565                 msg = cause.getLocalizedMessage();
    566                 if (msg != null) {
    567                     Main.error("Cause: " + cause.getClass().getName()+": " + msg);
    568                 } else {
    569                     cause.printStackTrace();
    570                 }
    571             }
     562            Main.error(e);
    572563            if (e.getCause() instanceof ClassNotFoundException) {
    573564                msg = tr("<html>Could not load plugin {0} because the plugin<br>main class ''{1}'' was not found.<br>"
     
    575566            }
    576567        }  catch (Throwable e) {
    577             e.printStackTrace();
     568            Main.error(e);
    578569        }
    579570        if (msg != null && confirmDisablePlugin(parent, msg, plugin.name)) {
     
    687678                future.get();
    688679            } catch(ExecutionException e) {
    689                 e.printStackTrace();
     680                Main.error(e);
    690681                return null;
    691682            } catch(InterruptedException e) {
     
    817808                } catch (PluginException e) {
    818809                    Main.warn(tr("Failed to find plugin {0}", name));
    819                     e.printStackTrace();
     810                    Main.error(e);
    820811                }
    821812            }
     
    858849            } catch (ExecutionException e) {
    859850                Main.warn(tr("Failed to download plugin information list")+": ExecutionException");
    860                 e.printStackTrace();
     851                Main.error(e);
    861852                // don't abort in case of error, continue with downloading plugins below
    862853            } catch (InterruptedException e) {
     
    905896                    future.get();
    906897                } catch(ExecutionException e) {
    907                     e.printStackTrace();
     898                    Main.error(e);
    908899                    alertFailedPluginUpdate(parent, pluginsToUpdate);
    909900                    return plugins;
     
    10981089                pi.updateFromJar(new PluginInformation(downloadedPluginFile, pi.name));
    10991090            } catch(PluginException e) {
    1100                 e.printStackTrace();
     1091                Main.error(e);
    11011092            }
    11021093        }
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r6615 r6643  
    248248                    }
    249249                }
    250                 catch(Exception e) { e.printStackTrace(); }
     250                catch(Exception e) { Main.error(e); }
    251251            }
    252252        }
  • trunk/src/org/openstreetmap/josm/plugins/PluginListParser.java

    r6552 r6643  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.plugins;
    3 
    4 import org.openstreetmap.josm.tools.Utils;
    53
    64import static org.openstreetmap.josm.tools.I18n.tr;
     
    1311import java.util.LinkedList;
    1412import java.util.List;
     13
     14import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.tools.Utils;
    1516
    1617/**
     
    104105            }
    105106        } catch (PluginListParseException ex) {
    106             ex.printStackTrace();
     107            Main.error(ex);
    107108        }
    108109    }
  • trunk/src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java

    r6248 r6643  
    9292            } catch(PluginListParseException e) {
    9393                Main.warn(tr("Failed to scan file ''{0}'' for plugin information. Skipping.", fname));
    94                 e.printStackTrace();
     94                Main.error(e);
    9595            }
    9696            monitor.worked(1);
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r6552 r6643  
    181181        } catch (MalformedURLException e) {
    182182            if (canceled) return null;
    183             e.printStackTrace();
     183            Main.error(e);
    184184            return null;
    185185        } catch (IOException e) {
     
    234234                    JosmTextArea area = new JosmTextArea(details);
    235235                    area.setEditable(false);
    236                     area.setLineWrap(true); 
    237                     area.setWrapStyleWord(true); 
     236                    area.setLineWrap(true);
     237                    area.setWrapStyleWord(true);
    238238                    JScrollPane scrollPane = new JScrollPane(area);
    239239                    scrollPane.setPreferredSize(new Dimension(500, 300));
     
    273273        } catch (MalformedURLException e) {
    274274            if (canceled) return;
    275             e.printStackTrace();
     275            Main.error(e);
    276276            return;
    277277        } catch (IOException e) {
     
    322322        } catch(IOException e) {
    323323            // just failed to write the cache file. No big deal, but log the exception anyway
    324             e.printStackTrace();
     324            Main.error(e);
    325325        } finally {
    326326            if (writer != null) {
     
    367367        } catch (PluginListParseException e) {
    368368            Main.error(tr("Failed to parse plugin list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString()));
    369             e.printStackTrace();
     369            Main.error(e);
    370370        }
    371371    }
  • trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java

    r6552 r6643  
    6666        exceptionCounter++;
    6767        try {
    68             e.printStackTrace();
     68            Main.error(e);
    6969            if (Main.parent != null) {
    7070                if (e instanceof OutOfMemoryError) {
     
    166166                            JOptionPane.showMessageDialog(Main.parent, p, tr("You have encountered a bug in JOSM"), JOptionPane.ERROR_MESSAGE);
    167167                        } catch (Exception e1) {
    168                             e1.printStackTrace();
     168                            Main.error(e1);
    169169                        }
    170170                    }
     
    200200                    "gdata="+Base64.encode(ByteBuffer.wrap(out.toByteArray()), true));
    201201        } catch (IOException e) {
    202             e.printStackTrace();
     202            Main.error(e);
    203203            return null;
    204204        }
  • trunk/src/org/openstreetmap/josm/tools/DateUtils.java

    r6380 r6643  
    1212import javax.xml.datatype.DatatypeFactory;
    1313import javax.xml.datatype.XMLGregorianCalendar;
     14
     15import org.openstreetmap.josm.Main;
    1416
    1517/**
     
    3739            fact = DatatypeFactory.newInstance();
    3840        } catch(DatatypeConfigurationException ce) {
    39             ce.printStackTrace();
     41            Main.error(ce);
    4042        }
    4143        XML_DATE = fact;
  • trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java

    r6582 r6643  
    4949     */
    5050    public static String explainOsmApiInitializationException(OsmApiInitializationException e) {
    51         e.printStackTrace();
     51        Main.error(e);
    5252        String msg = tr(
    5353                "<html>Failed to initialize communication with the OSM server {0}.<br>"
     
    6464     */
    6565    public static String explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e) {
    66         e.printStackTrace();
     66        Main.error(e);
    6767        String msg = tr(
    6868                "<html>Failed to authenticate at the OSM server ''{0}''.<br>"
     
    129129     */
    130130    public static String explainPreconditionFailed(OsmApiException e) {
    131         e.printStackTrace();
     131        Main.error(e);
    132132        Pair<OsmPrimitive, Collection<OsmPrimitive>> conflict = parsePreconditionFailed(e.getErrorHeader());
    133133        if (conflict != null) {
     
    247247
    248248    public static String explainFailedBasicAuthentication(OsmApiException e) {
    249         e.printStackTrace();
     249        Main.error(e);
    250250        return tr("<html>"
    251251                + "Authentication at the OSM server with the username ''{0}'' failed.<br>"
     
    257257
    258258    public static String explainFailedOAuthAuthentication(OsmApiException e) {
    259         e.printStackTrace();
     259        Main.error(e);
    260260        return tr("<html>"
    261261                + "Authentication at the OSM server with the OAuth token ''{0}'' failed.<br>"
     
    267267
    268268    public static String explainFailedAuthorisation(OsmApiException e) {
    269         e.printStackTrace();
     269        Main.error(e);
    270270        String header = e.getErrorHeader();
    271271        String body = e.getErrorBody();
     
    298298
    299299    public static String explainFailedOAuthAuthorisation(OsmApiException e) {
    300         e.printStackTrace();
     300        Main.error(e);
    301301        return tr("<html>"
    302302                + "Authorisation at the OSM server with the OAuth token ''{0}'' failed.<br>"
     
    317317     */
    318318    public static String explainClientTimeout(OsmApiException e) {
    319         e.printStackTrace();
     319        Main.error(e);
    320320        return tr("<html>"
    321321                + "Communication with the OSM server ''{0}'' timed out. Please retry later."
     
    332332     */
    333333    public static String explainGenericOsmApiException(OsmApiException e) {
    334         e.printStackTrace();
     334        Main.error(e);
    335335        String errMsg = e.getErrorHeader();
    336336        if (errMsg == null) {
     
    358358     */
    359359    public static String explainConflict(OsmApiException e) {
    360         e.printStackTrace();
     360        Main.error(e);
    361361        String msg = e.getErrorHeader();
    362362        if (msg != null) {
     
    374374                } catch (ParseException ex) {
    375375                    Main.error(tr("Failed to parse date ''{0}'' replied by server.", m.group(2)));
    376                     ex.printStackTrace();
     376                    Main.error(ex);
    377377                }
    378378                if (closeDate == null) {
     
    419419                e.getClosedOn() == null ? "?" : dateFormat.format(e.getClosedOn())
    420420        );
    421         e.printStackTrace();
     421        Main.error(e);
    422422        return msg;
    423423    }
     
    433433            msg = e.toString();
    434434        }
    435         e.printStackTrace();
     435        Main.error(e);
    436436        return escapeReservedCharactersHTML(msg);
    437437    }
     
    472472        String message = tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>"
    473473                + "Please check your internet connection.", apiUrl);
    474         e.printStackTrace();
     474        Main.error(e);
    475475        return message;
    476476    }
     
    491491                + "Details (untranslated): {1}</html>", apiUrl, ioe
    492492                .getMessage());
    493         e.printStackTrace();
     493        Main.error(e);
    494494        return message;
    495495    }
     
    506506                + "Its format is either unsupported, ill-formed, and/or inconsistent.<br>"
    507507                + "<br>Details (untranslated): {0}</html>", ide.getMessage());
    508         e.printStackTrace();
     508        Main.error(e);
    509509        return message;
    510510    }
     
    521521        String message = tr("<html>The OSM server<br>" + "''{0}''<br>" + "reported an internal server error.<br>"
    522522                + "This is most likely a temporary problem. Please try again later.", apiUrl);
    523         e.printStackTrace();
     523        Main.error(e);
    524524        return message;
    525525    }
     
    544544        }
    545545        message = "<html>" + message + "</html>";
    546         e.printStackTrace();
     546        Main.error(e);
    547547        return message;
    548548    }
     
    557557        // TODO: Write a proper error message
    558558        String message = explainGenericOsmApiException(e);
    559         e.printStackTrace();
     559        Main.error(e);
    560560        return message;
    561561    }
     
    575575                , apiUrl);
    576576        message = "<html>" + message + "</html>";
    577         e.printStackTrace();
     577        Main.error(e);
    578578        return message;
    579579    }
     
    599599                + "Host name ''{1}'' could not be resolved. <br>"
    600600                + "Please check the API URL in your preferences and your internet connection.", apiUrl, host);
    601         e.printStackTrace();
     601        Main.error(e);
    602602        return message;
    603603    }
     
    692692            msg = explainGeneric(e);
    693693        }
    694         e.printStackTrace();
     694        Main.error(e);
    695695        return msg;
    696696    }
  • trunk/src/org/openstreetmap/josm/tools/ExifReader.java

    r6380 r6643  
    77import java.util.Date;
    88
     9import org.openstreetmap.josm.Main;
    910import org.openstreetmap.josm.data.coor.LatLon;
    1011
     
    6162            throw e;
    6263        } catch (Exception e) {
    63             e.printStackTrace();
     64            Main.error(e);
    6465        }
    6566        return null;
     
    8788            return dir.getInt(ExifIFD0Directory.TAG_ORIENTATION);
    8889        } catch (JpegProcessingException e) {
    89             e.printStackTrace();
     90            Main.error(e);
    9091        } catch (MetadataException e) {
    91             e.printStackTrace();
     92            Main.error(e);
    9293        } catch (IOException e) {
    93             e.printStackTrace();
     94            Main.error(e);
    9495        }
    9596        return null;
     
    108109            return readLatLon(dirGps);
    109110        } catch (JpegProcessingException e) {
    110             e.printStackTrace();
     111            Main.error(e);
    111112        } catch (IOException e) {
    112             e.printStackTrace();
     113            Main.error(e);
    113114        } catch (MetadataException e) {
    114             e.printStackTrace();
     115            Main.error(e);
    115116        }
    116117        return null;
     
    121122     * @param dirGps The EXIF GPS directory
    122123     * @return The lat/lon read in the EXIF section, or {@code null} if {@code dirGps} is null
    123      * @throws MetadataException 
     124     * @throws MetadataException
    124125     * @since 6209
    125126     */
     
    145146            return readDirection(dirGps);
    146147        } catch (JpegProcessingException e) {
    147             e.printStackTrace();
     148            Main.error(e);
    148149        } catch (IOException e) {
    149             e.printStackTrace();
     150            Main.error(e);
    150151        }
    151152        return null;
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r6514 r6643  
    7373            }
    7474        } catch (NumberFormatException x) {
    75             x.printStackTrace();
     75            Main.error(x);
    7676        } catch (NullPointerException x) {
    77             x.printStackTrace();
     77            Main.error(x);
    7878        } catch (ArrayIndexOutOfBoundsException x) {
    79             x.printStackTrace();
     79            Main.error(x);
    8080        }
    8181        return b;
  • trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java

    r6380 r6643  
    204204                }
    205205            } catch (Exception e) {
    206                 e.printStackTrace(); // SAXException does not dump inner exceptions.
     206                Main.error(e); // SAXException does not dump inner exceptions.
    207207                throwException(e);
    208208            }
  • trunk/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTest.java

    r6289 r6643  
    8282            ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
    8383        } catch(OsmTransferException e) {
    84             e.printStackTrace();
     84            Main.error(e);
    8585            return;
    8686        }
  • trunk/test/functional/org/openstreetmap/josm/io/UploadStrategySelectionPanelTest.java

    r4311 r6643  
    1212import javax.swing.JTextField;
    1313
     14import org.openstreetmap.josm.Main;
    1415import org.openstreetmap.josm.gui.io.UploadStrategySelectionPanel;
    1516import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    4041                            n = Integer.parseInt(tf.getText());
    4142                        } catch(NumberFormatException e) {
    42                             e.printStackTrace();
     43                            Main.error(e);
    4344                            return;
    4445                        }
     
    4950        return pnl;
    5051    }
     52   
     53    /**
     54     * Constructs a new {@code UploadStrategySelectionPanelTest}.
     55     */
    5156    public UploadStrategySelectionPanelTest() {
    5257        build();
Note: See TracChangeset for help on using the changeset viewer.