Ignore:
Timestamp:
2015-10-10T15:47:41+02:00 (4 years ago)
Author:
Don-vip
Message:

sonar - squid:S1149 - Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r8846 r8851  
    88import java.awt.event.ActionEvent;
    99import java.awt.event.KeyEvent;
     10import java.util.ArrayDeque;
    1011import java.util.ArrayList;
    1112import java.util.Collection;
    1213import java.util.Collections;
     14import java.util.Deque;
    1315import java.util.LinkedHashMap;
    1416import java.util.LinkedHashSet;
     
    1719import java.util.Map;
    1820import java.util.Set;
    19 import java.util.Stack;
    2021
    2122import javax.swing.JOptionPane;
     
    557558        }
    558559
    559         protected Set<Node> getNodes(Stack<NodePair> pairs) {
    560             Set<Node> nodes = new LinkedHashSet<>(2*pairs.size());
    561             for (NodePair pair: pairs) {
    562                 nodes.add(pair.getA());
    563                 nodes.add(pair.getB());
    564             }
    565             return nodes;
    566         }
    567 
    568560        protected List<NodePair> getOutboundPairs(NodePair pair) {
    569561            return getOutboundPairs(pair.getB());
     
    586578        }
    587579
    588         protected boolean isSpanningWay(Stack<NodePair> way) {
     580        protected boolean isSpanningWay(Deque<NodePair> way) {
    589581            return numUndirectedEges == way.size();
    590582        }
    591583
    592         protected List<Node> buildPathFromNodePairs(Stack<NodePair> path) {
     584        protected List<Node> buildPathFromNodePairs(Deque<NodePair> path) {
    593585            List<Node> ret = new LinkedList<>();
    594586            for (NodePair pair: path) {
     
    610602            if (startNode == null)
    611603                return null;
    612             Stack<NodePair> path = new Stack<>();
    613             Stack<NodePair> nextPairs  = new Stack<>();
     604            Deque<NodePair> path = new ArrayDeque<>();
     605            Deque<NodePair> nextPairs  = new ArrayDeque<>();
    614606            nextPairs.addAll(getOutboundPairs(startNode));
    615607            while (!nextPairs.isEmpty()) {
  • trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java

    r8836 r8851  
    88import java.awt.event.KeyEvent;
    99import java.io.IOException;
     10import java.util.ArrayDeque;
    1011import java.util.Collection;
     12import java.util.Deque;
    1113import java.util.HashSet;
    1214import java.util.Set;
    13 import java.util.Stack;
    1415
    1516import javax.swing.JOptionPane;
     
    321322        protected void realRun() throws SAXException, IOException, OsmTransferException {
    322323            try {
    323                 Stack<OsmPrimitive> toCheck = new Stack<>();
     324                Deque<OsmPrimitive> toCheck = new ArrayDeque<>();
    324325                toCheck.addAll(getPrimitivesToCheckForParents());
    325326                Set<OsmPrimitive> checked = new HashSet<>();
  • trunk/src/org/openstreetmap/josm/actions/upload/CyclicUploadDependencyException.java

    r8510 r8851  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.util.ArrayList;
    7 import java.util.List;
    8 import java.util.Stack;
     6import java.util.ArrayDeque;
     7import java.util.Deque;
    98
    109import org.openstreetmap.josm.data.osm.Relation;
    1110
    1211public class CyclicUploadDependencyException extends Exception {
    13     private final Stack<Relation> cycle;
     12    private final Deque<Relation> cycle;
    1413
    15     public CyclicUploadDependencyException(Stack<Relation> cycle) {
     14    public CyclicUploadDependencyException(Deque<Relation> cycle) {
    1615        this.cycle = cycle;
    1716    }
     
    3433        sb.append(tr("Cyclic dependency between relations:"))
    3534          .append('[');
    36         for (int i = 0; i < cycle.size(); i++) {
    37             if (i > 0) {
     35        for (Relation r : cycle) {
     36            if (sb.length() > 0) {
    3837                sb.append(',');
    3938            }
    40             sb.append(formatRelation(cycle.get(i)));
     39            sb.append(formatRelation(r));
    4140        }
    4241        sb.append(']');
     
    4443    }
    4544
    46     public List<Relation> getCyclicUploadDependency() {
    47         return new ArrayList<>(cycle);
     45    public Deque<Relation> getCyclicUploadDependency() {
     46        return new ArrayDeque<>(cycle);
    4847    }
    4948}
  • trunk/src/org/openstreetmap/josm/actions/upload/RelationUploadOrderHook.java

    r8510 r8851  
    66import java.awt.BorderLayout;
    77import java.awt.Dimension;
     8import java.util.ArrayList;
     9import java.util.Deque;
    810import java.util.Iterator;
    911import java.util.List;
     
    6769     */
    6870    protected void warnCyclicUploadDependency(CyclicUploadDependencyException e) {
    69         List<Relation> dep = e.getCyclicUploadDependency();
    70         Relation last = dep.get(dep.size() -1);
     71        Deque<Relation> dep = e.getCyclicUploadDependency();
     72        Relation last = dep.getLast();
    7173        Iterator<Relation> it = dep.iterator();
    7274        while (it.hasNext()) {
     
    7779            }
    7880        }
    79         JPanel pnl = buildWarningPanel(dep);
     81        JPanel pnl = buildWarningPanel(new ArrayList<>(dep));
    8082        ExtendedDialog dialog = new ExtendedDialog(
    8183                Main.parent,
Note: See TracChangeset for help on using the changeset viewer.