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/tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 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            }
Note: See TracChangeset for help on using the changeset viewer.