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

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

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
11 edited

Legend:

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

    r9144 r10627  
    4141            return naturalLength / calibration;
    4242        } catch (UnsupportedAudioFileException | IOException e) {
    43             if (Main.isDebugEnabled()) {
    44                 Main.debug(e.getMessage());
    45             }
     43            Main.debug(e);
    4644            return 0.0;
    4745        }
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r10378 r10627  
    911911            innerRings = MultipolygonBuilder.joinWays(mpm.inners);
    912912        } catch (MultipolygonBuilder.JoinedPolygonCreationException ex) {
     913            Main.trace(ex);
    913914            Main.debug("Invalid multipolygon " + multiPolygon);
    914915            return false;
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r10626 r10627  
    642642            }
    643643        } catch (IOException e) {
     644            Main.trace(e);
    644645            return false;
    645646        }
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r10616 r10627  
    959959                    img = read(Utils.fileToURL(cf.getFile()), false, false);
    960960                } catch (IOException e) {
    961                     Main.warn("IOException while reading HTTP image: "+e.getMessage());
     961                    Main.warn(e, "IOException while reading HTTP image:");
    962962                }
    963963                return img == null ? null : new ImageResource(img);
     
    966966            }
    967967        } catch (IOException e) {
     968            Main.debug(e);
    968969            return null;
    969970        } finally {
     
    990991                    bytes = Utils.decodeUrl(data).getBytes(StandardCharsets.UTF_8);
    991992                } catch (IllegalArgumentException ex) {
    992                     Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ')');
     993                    Main.warn(ex, "Unable to decode URL data part: "+ex.getMessage() + " (" + data + ')');
    993994                    return null;
    994995                }
     
    10171018                    return img == null ? null : new ImageResource(img);
    10181019                } catch (IOException e) {
    1019                     Main.warn("IOException while reading image: "+e.getMessage());
     1020                    Main.warn(e, "IOException while reading image:");
    10201021                }
    10211022            }
     
    11111112            }
    11121113        } catch (IOException e) {
    1113             Main.warn(tr("Failed to handle zip file ''{0}''. Exception was: {1}", archive.getName(), e.toString()));
     1114            Main.warn(e, tr("Failed to handle zip file ''{0}''. Exception was: {1}", archive.getName(), e.toString()));
    11141115        }
    11151116        return null;
     
    11821183                        return u;
    11831184                } catch (SecurityException e) {
    1184                     Main.warn(tr(
     1185                    Main.warn(e, tr(
    11851186                            "Failed to access directory ''{0}'' for security reasons. Exception was: {1}",
    11861187                            name, e.toString()));
     
    11971198                    return u;
    11981199            } catch (SecurityException e) {
    1199                 Main.warn(tr(
     1200                Main.warn(e, tr(
    12001201                        "Failed to access directory ''{0}'' for security reasons. Exception was: {1}", dir, e
    12011202                        .toString()));
     
    12711272            cf.close();
    12721273        } catch (SAXReturnException r) {
     1274            Main.trace(r);
    12731275            return r.getResult();
    12741276        } catch (IOException | SAXException e) {
     
    15451547            }
    15461548        } catch (SVGException ex) {
    1547             Main.error("Unable to load svg: {0}", ex.getMessage());
     1549            Main.error(ex, "Unable to load svg:");
    15481550            return null;
    15491551        }
  • trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java

    r10212 r10627  
    5959                        // Workaround for KDE (Desktop API is severely flawed)
    6060                        // see https://bugs.openjdk.java.net/browse/JDK-6486393
    61                         Main.warn("Desktop class failed. Platform dependent fall back for open url in browser.");
     61                        Main.warn(e, "Desktop class failed. Platform dependent fall back for open url in browser.");
    6262                        displayUrlFallback(uri);
    6363                    }
     
    7272                displayUrlFallback(uri);
    7373            } catch (IOException e) {
     74                Main.debug(e);
    7475                return e.getMessage();
    7576            }
     
    9091            return displayUrl(new URI(url));
    9192        } catch (URISyntaxException e) {
     93            Main.debug(e);
    9294            return e.getMessage();
    9395        }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r10580 r10627  
    6767                enableOSXFullscreen((Window) Main.parent);
    6868            } catch (IllegalAccessException e) {
     69                Main.debug(e);
    6970                // with Java 9, module java.desktop does not export com.apple.eawt, use new Desktop API instead
    7071                setHandlers(Desktop.class, quitHandler, aboutHandler, openFilesHandler, preferencesHandler, proxy, Desktop.getDesktop());
     
    8990            return Class.forName("com.apple.eawt."+className);
    9091        } catch (ClassNotFoundException e) {
     92            Main.trace(e);
    9193            return Class.forName("java.awt.desktop."+className);
    9294        }
     
    148150                    args[1].getClass().getDeclaredMethod(closed ? "performQuit" : "cancelQuit").invoke(args[1]);
    149151                } catch (IllegalAccessException e) {
     152                    Main.debug(e);
    150153                    // with Java 9, module java.desktop does not export com.apple.eawt, use new Desktop API instead
    151154                    Class.forName("java.awt.desktop.QuitResponse").getMethod(closed ? "performQuit" : "cancelQuit").invoke(args[1]);
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r10626 r10627  
    192192            return "Debian".equalsIgnoreCase(dist) || "Ubuntu".equalsIgnoreCase(dist) || "Mint".equalsIgnoreCase(dist);
    193193        } catch (IOException e) {
    194             if (Main.isDebugEnabled()) {
    195                 // lsb_release is not available on all Linux systems, so don't log at warning level
    196                 Main.debug(e.getMessage());
    197             }
     194            // lsb_release is not available on all Linux systems, so don't log at warning level
     195            Main.debug(e);
    198196            return false;
    199197        }
     
    303301                }
    304302            } catch (IOException e) {
     303                Main.debug(e);
    305304                // Non LSB-compliant Linux system. List of common fallback release files: http://linuxmafia.com/faq/Admin/release-files.html
    306305                for (LinuxReleaseInfo info : new LinuxReleaseInfo[]{
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r10626 r10627  
    268268                    ks.deleteEntry(alias);
    269269                } catch (KeyStoreException e) {
    270                     Main.error(tr("Unable to remove insecure certificate from keystore: {0}", e.getMessage()));
     270                    Main.error(e, tr("Unable to remove insecure certificate from keystore: {0}", e.getMessage()));
    271271                }
    272272            }
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r10616 r10627  
    13261326            return true;
    13271327        } catch (MalformedURLException | NullPointerException e) {
     1328            Main.trace(e);
    13281329            return false;
    13291330        }
  • trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java

    r10384 r10627  
    8989            initFromPreferences(preferenceKey);
    9090        } catch (WindowGeometryException e) {
    91             if (Main.isDebugEnabled()) {
    92                 Main.debug(e.getMessage());
    93             }
     91            Main.debug(e);
    9492            initFromWindowGeometry(defaultGeometry);
    9593        }
  • trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java

    r10378 r10627  
    204204                    return f;
    205205                } catch (NoSuchFieldException ex) {
     206                    Main.trace(ex);
    206207                    fields.put(s, null);
    207208                    return null;
     
    251252            } catch (SAXException e) {
    252253                // Exception very unlikely to happen, so no need to translate this
    253                 Main.error("Cannot disable 'load-external-dtd' feature: "+e.getMessage());
     254                Main.error(e, "Cannot disable 'load-external-dtd' feature:");
    254255            }
    255256            reader.parse(new InputSource(in));
Note: See TracChangeset for help on using the changeset viewer.