Changeset 12365 in josm for trunk/src


Ignore:
Timestamp:
2017-06-09T19:57:55+02:00 (7 years ago)
Author:
michael2402
Message:

CyclicUploadDependencyException: Copy the collection passed to the constructor. Fix squid:S1149

Location:
trunk/src/org/openstreetmap/josm/actions/upload
Files:
2 edited

Legend:

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

    r12364 r12365  
    55
    66import java.util.ArrayList;
     7import java.util.Collections;
    78import java.util.List;
    89import java.util.Stack;
     
    1415 */
    1516public class CyclicUploadDependencyException extends Exception {
    16     private final Stack<Relation> cycle;
     17    private final List<Relation> cycle;
    1718
    1819    /**
     
    2122     */
    2223    public CyclicUploadDependencyException(Stack<Relation> cycle) {
    23         this.cycle = cycle;
     24        this.cycle = new ArrayList<>(cycle);
    2425    }
    2526
     
    5657     */
    5758    public List<Relation> getCyclicUploadDependency() {
    58         return new ArrayList<>(cycle);
     59        return Collections.unmodifiableList(cycle);
    5960    }
    6061}
  • trunk/src/org/openstreetmap/josm/actions/upload/RelationUploadOrderHook.java

    r12279 r12365  
    66import java.awt.BorderLayout;
    77import java.awt.Dimension;
     8import java.util.ArrayList;
    89import java.util.Iterator;
    910import java.util.List;
     
    6667     */
    6768    protected void warnCyclicUploadDependency(CyclicUploadDependencyException e) {
    68         List<Relation> dep = e.getCyclicUploadDependency();
     69        List<Relation> dep = new ArrayList<>(e.getCyclicUploadDependency());
    6970        Relation last = dep.get(dep.size() -1);
    7071        Iterator<Relation> it = dep.iterator();
Note: See TracChangeset for help on using the changeset viewer.