Ignore:
Timestamp:
2015-10-11T15:28:33+02:00 (9 years ago)
Author:
Don-vip
Message:

fix #11957 - partial revert of r8851 - do not replace Stack by ArrayDeque because of different iteration behaviour + add unit test

File:
1 edited

Legend:

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

    r8851 r8856  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.util.ArrayDeque;
    7 import java.util.Deque;
     6import java.util.ArrayList;
     7import java.util.List;
     8import java.util.Stack;
    89
    910import org.openstreetmap.josm.data.osm.Relation;
    1011
    1112public class CyclicUploadDependencyException extends Exception {
    12     private final Deque<Relation> cycle;
     13    private final Stack<Relation> cycle;
    1314
    14     public CyclicUploadDependencyException(Deque<Relation> cycle) {
     15    public CyclicUploadDependencyException(Stack<Relation> cycle) {
    1516        this.cycle = cycle;
    1617    }
     
    3334        sb.append(tr("Cyclic dependency between relations:"))
    3435          .append('[');
    35         for (Relation r : cycle) {
    36             if (sb.length() > 0) {
     36        for (int i = 0; i < cycle.size(); i++) {
     37            if (i > 0) {
    3738                sb.append(',');
    3839            }
    39             sb.append(formatRelation(r));
     40            sb.append(formatRelation(cycle.get(i)));
    4041        }
    4142        sb.append(']');
     
    4344    }
    4445
    45     public Deque<Relation> getCyclicUploadDependency() {
    46         return new ArrayDeque<>(cycle);
     46    public List<Relation> getCyclicUploadDependency() {
     47        return new ArrayList<>(cycle);
    4748    }
    4849}
Note: See TracChangeset for help on using the changeset viewer.