Ignore:
Timestamp:
2016-05-15T21:14:06+02:00 (8 years ago)
Author:
Don-vip
Message:

findbugs - fix/suppress most of warnings reported in unit tests + enable low confidence warnings for core

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java

    r9661 r10222  
    99import java.lang.reflect.Field;
    1010import java.lang.reflect.Method;
     11import java.security.AccessController;
     12import java.security.PrivilegedAction;
    1113import java.util.ArrayList;
    1214import java.util.Arrays;
     
    5658    public void addSelected(OsmPrimitive p, DataSet ds) {
    5759        try {
    58             Method method = ds.getClass()
     60            final Method method = ds.getClass()
    5961                .getDeclaredMethod("addSelected",
    6062                                   new Class<?>[] {Collection.class, boolean.class});
    61             method.setAccessible(true);
     63            AccessController.doPrivileged(new PrivilegedAction<Object>() {
     64                @Override
     65                public Object run() {
     66                    method.setAccessible(true);
     67                    return null;
     68                }
     69            });
    6270            method.invoke(ds, Collections.singleton(p), false);
    63         } catch (Exception e) {
     71        } catch (ReflectiveOperationException e) {
    6472            e.printStackTrace();
    6573            fail("Can't add OsmPrimitive to dataset: " + e.getMessage());
     
    162170            rlCache.setAccessible(true);
    163171            ConstantTrafficHand trafficHand = new ConstantTrafficHand(true);
    164             rlCache.set(null, new GeoPropertyIndex<Boolean>(trafficHand, 24));
    165         } catch (Exception e) {
     172            rlCache.set(null, new GeoPropertyIndex<>(trafficHand, 24));
     173        } catch (ReflectiveOperationException e) {
    166174            e.printStackTrace();
    167175            fail("Impossible to mock left/right hand database: " + e.getMessage());
Note: See TracChangeset for help on using the changeset viewer.