Changeset 11537 in josm


Ignore:
Timestamp:
2017-02-04T15:31:22+01:00 (8 years ago)
Author:
Don-vip
Message:

sonar - fb-contrib:CCNE_COMPARE_CLASS_EQUALS_NAME - Correctness - Method compares class name instead of comparing class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java

    r10469 r11537  
    158158
    159159    /**
    160      * <p>Replies true, if {@code Renderer} is already a registered map renderer
    161      * class.</p>
     160     * <p>Replies true, if {@code Renderer} is already a registered map renderer class.</p>
    162161     *
    163162     * @param renderer the map renderer class. Must not be null.
    164      * @return true, if {@code Renderer} is already a registered map renderer
    165      * class
     163     * @return true, if {@code Renderer} is already a registered map renderer class
    166164     * @throws IllegalArgumentException if {@code renderer} is null
    167165     */
     
    169167        CheckParameterUtil.ensureParameterNotNull(renderer);
    170168        for (Descriptor d: descriptors) {
    171             if (d.getRenderer().getName().equals(renderer.getName())) return true;
     169            if (d.getRenderer().equals(renderer)) return true;
    172170        }
    173171        return false;
     
    210208        while (it.hasNext()) {
    211209            Descriptor d = it.next();
    212             if (d.getRenderer().getName().equals(renderer.getName())) {
     210            if (d.getRenderer().equals(renderer)) {
    213211                it.remove();
    214212                break;
    215213            }
    216214        }
    217         if (activeRenderer != null && activeRenderer.getName().equals(renderer.getName())) {
     215        if (activeRenderer != null && activeRenderer.equals(renderer)) {
    218216            activateDefault();
    219217        }
     
    288286
    289287    /**
    290      * <p>Replies true, if currently the wireframe map renderer is active. Otherwise,
    291      * false.</p>
     288     * <p>Replies true, if currently the wireframe map renderer is active. Otherwise, false.</p>
    292289     *
    293290     * <p>There is a specific method for {@link WireframeMapRenderer} for legacy support.
     
    296293     * (menu entries, etc.) which toggle between these two renderers only.</p>
    297294     *
    298      * @return true, if currently the wireframe map renderer is active. Otherwise,
    299      * false
     295     * @return true, if currently the wireframe map renderer is active. Otherwise, false
    300296     */
    301297    public boolean isWireframeMapRendererActive() {
    302         return activeRenderer != null && activeRenderer.getName().equals(WireframeMapRenderer.class.getName());
     298        return WireframeMapRenderer.class.equals(activeRenderer);
    303299    }
    304300}
Note: See TracChangeset for help on using the changeset viewer.