Ignore:
Timestamp:
2016-05-15T00:51:10+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S2221 - "Exception" should not be caught when not required by called methods

File:
1 edited

Legend:

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

    r10208 r10212  
    731731    /* only for preferences */
    732732    public synchronized String getColorName(String o) {
    733         try {
    734             Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o);
    735             if (m.matches()) {
    736                 return tr("Paint style {0}: {1}", tr(I18n.escape(m.group(1))), tr(I18n.escape(m.group(2))));
    737             }
    738         } catch (Exception e) {
    739             Main.warn(e);
    740         }
    741         try {
    742             Matcher m = Pattern.compile("layer (.+)").matcher(o);
    743             if (m.matches()) {
    744                 return tr("Layer: {0}", tr(I18n.escape(m.group(1))));
    745             }
    746         } catch (Exception e) {
    747             Main.warn(e);
     733        Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o);
     734        if (m.matches()) {
     735            return tr("Paint style {0}: {1}", tr(I18n.escape(m.group(1))), tr(I18n.escape(m.group(2))));
     736        }
     737        m = Pattern.compile("layer (.+)").matcher(o);
     738        if (m.matches()) {
     739            return tr("Layer: {0}", tr(I18n.escape(m.group(1))));
    748740        }
    749741        return tr(I18n.escape(colornames.containsKey(o) ? colornames.get(o) : o));
     
    13361328                field.setAccessible(true);
    13371329                field.set(null, ResourceBundle.getBundle("sun.awt.resources.awt"));
    1338             } catch (Exception | InternalError e) {
    1339                 // Ignore all exceptions, including internal error raised by Java 9 Jigsaw EA:
    1340                 // java.lang.InternalError: legacy getBundle can't be used to find sun.awt.resources.awt in module java.desktop
    1341                 // InternalError catch to remove when https://bugs.openjdk.java.net/browse/JDK-8136804 is resolved
     1330            } catch (ReflectiveOperationException e) {
    13421331                if (Main.isTraceEnabled()) {
    13431332                    Main.trace(e.getMessage());
Note: See TracChangeset for help on using the changeset viewer.