Ignore:
Timestamp:
2016-05-18T17:44:31+02:00 (4 years ago)
Author:
Don-vip
Message:

findbugs - UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR

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

Legend:

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

    r9983 r10250  
    441441        private final Set<NodePair> edges;
    442442        private int numUndirectedEges;
    443         private Map<Node, List<NodePair>> successors;
    444         private Map<Node, List<NodePair>> predecessors;
     443        private final Map<Node, List<NodePair>> successors = new LinkedHashMap<>();
     444        private final Map<Node, List<NodePair>> predecessors = new LinkedHashMap<>();
    445445
    446446        protected void rememberSuccessor(NodePair pair) {
     
    482482        protected void prepare() {
    483483            Set<NodePair> undirectedEdges = new LinkedHashSet<>();
    484             successors = new LinkedHashMap<>();
    485             predecessors = new LinkedHashMap<>();
     484            successors.clear();
     485            predecessors.clear();
    486486
    487487            for (NodePair pair: edges) {
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r10001 r10250  
    420420     */
    421421    private static class WayData {
    422         public final List<Node> wayNodes;             // The assigned way
    423         public final int nSeg;            // Number of Segments of the Way
    424         public final int nNode;           // Number of Nodes of the Way
    425         public Direction[] segDirections; // Direction of the segments
     422        public final List<Node> wayNodes;       // The assigned way
     423        public final int nSeg;                  // Number of Segments of the Way
     424        public final int nNode;                 // Number of Nodes of the Way
     425        public final Direction[] segDirections; // Direction of the segments
    426426        // segment i goes from node i to node (i+1)
    427427        public EastNorth segSum;          // (Vector-)sum of all horizontal segments plus the sum of all vertical
     
    433433            this.nNode = wayNodes.size();
    434434            this.nSeg = nNode - 1;
     435            this.segDirections = new Direction[nSeg];
    435436        }
    436437
     
    448449                en[i] = wayNodes.get(i).getEastNorth();
    449450            }
    450             segDirections = new Direction[nSeg];
    451451            Direction direction = pInitialDirection;
    452452            segDirections[0] = direction;
  • trunk/src/org/openstreetmap/josm/actions/OverpassDownloadAction.java

    r10131 r10250  
    120120    private static final class OverpassDownloadDialog extends DownloadDialog {
    121121
    122         private HistoryComboBox overpassWizard;
    123         private JosmTextArea overpassQuery;
     122        private final HistoryComboBox overpassWizard = new HistoryComboBox();
     123        private final JosmTextArea overpassQuery = new JosmTextArea("", 8, 80);
    124124        private static OverpassDownloadDialog instance;
    125125        private static final CollectionProperty OVERPASS_WIZARD_HISTORY = new CollectionProperty("download.overpass.wizard",
     
    151151
    152152            final String tooltip = tr("Builds an Overpass query using the Overpass Turbo query wizard");
    153             overpassWizard = new HistoryComboBox();
    154153            overpassWizard.setToolTipText(tooltip);
    155154            overpassWizard.getEditorComponent().addFocusListener(disableActionsFocusListener);
     
    178177            pnl.add(overpassWizard, GBC.eol().fill(GBC.HORIZONTAL));
    179178
    180             overpassQuery = new JosmTextArea("", 8, 80);
    181179            overpassQuery.setFont(GuiHelper.getMonospacedFont(overpassQuery));
    182180            overpassQuery.addFocusListener(disableActionsFocusListener);
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractChangesetDownloadTask.java

    r10129 r10250  
    127127     */
    128128    public final Future<?> download() {
    129         return Main.worker.submit(downloadTaskRunnable);
     129        return downloadTaskRunnable != null ? Main.worker.submit(downloadTaskRunnable) : null;
    130130    }
    131131
    132132    @Override
    133133    public final Future<?> loadUrl(boolean newLayer, String url, ProgressMonitor progressMonitor) {
    134         return Main.worker.submit(downloadTaskRunnable);
     134        return downloadTaskRunnable != null ? Main.worker.submit(downloadTaskRunnable) : null;
    135135    }
    136136
    137137    @Override
    138138    public final void cancel() {
    139         downloadTaskRunnable.cancel();
     139        if (downloadTaskRunnable != null) {
     140            downloadTaskRunnable.cancel();
     141        }
    140142    }
    141143
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTask.java

    r10124 r10250  
    2626 */
    2727public class ChangesetContentDownloadTask extends AbstractChangesetDownloadTask {
    28 
    29     private final DownloadTask downloadTask;
    3028
    3129    class DownloadTask extends RunnableDownloadTask {
     
    129127            throw new IllegalArgumentException(
    130128                    MessageFormat.format("Expected integer value > 0 for parameter ''{0}'', got ''{1}''", "changesetId", changesetId));
    131         downloadTask = new DownloadTask(parent, Collections.singleton(changesetId));
    132         setDownloadTask(downloadTask);
     129        setDownloadTask(new DownloadTask(parent, Collections.singleton(changesetId)));
    133130    }
    134131
     
    142139     */
    143140    public ChangesetContentDownloadTask(Component parent, Collection<Integer> changesetIds) {
    144         downloadTask = new DownloadTask(parent, changesetIds);
    145         setDownloadTask(downloadTask);
     141        setDownloadTask(new DownloadTask(parent, changesetIds));
    146142    }
    147143
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTask.java

    r10164 r10250  
    2727 */
    2828public class ChangesetHeaderDownloadTask extends AbstractChangesetDownloadTask {
    29 
    30     private final DownloadTask downloadTask;
    3129
    3230    class DownloadTask extends RunnableDownloadTask {
     
    112110     */
    113111    public ChangesetHeaderDownloadTask(Component dialogParent, Collection<Integer> ids, boolean includeDiscussion) {
    114         downloadTask = new DownloadTask(dialogParent, ids, includeDiscussion);
    115         setDownloadTask(downloadTask);
     112        setDownloadTask(new DownloadTask(dialogParent, ids, includeDiscussion));
    116113    }
    117114
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTask.java

    r10129 r10250  
    2626 */
    2727public class ChangesetQueryTask extends AbstractChangesetDownloadTask {
    28 
    29     private final DownloadTask downloadTask;
    3028
    3129    class DownloadTask extends RunnableDownloadTask {
     
    134132    public ChangesetQueryTask(Component parent, ChangesetQuery query) {
    135133        CheckParameterUtil.ensureParameterNotNull(query, "query");
    136         downloadTask = new DownloadTask(parent, query);
    137         setDownloadTask(downloadTask);
     134        setDownloadTask(new DownloadTask(parent, query));
    138135    }
    139136}
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java

    r10228 r10250  
    5151    private ProgressMonitor progressMonitor;
    5252
    53     private void addDownloadTask(DownloadTask dt, Rectangle2D td, int i, int n) {
     53    private void addDownloadTask(ProgressMonitor progressMonitor, DownloadTask dt, Rectangle2D td, int i, int n) {
    5454        ProgressMonitor childProgress = progressMonitor.createSubTaskMonitor(1, false);
    5555        childProgress.setCustomText(tr("Download {0} of {1} ({2} left)", i, n, n - i));
     
    8282            i++;
    8383            if (osmData) {
    84                 addDownloadTask(new DownloadOsmTask(), td, i, n);
     84                addDownloadTask(progressMonitor, new DownloadOsmTask(), td, i, n);
    8585            }
    8686            if (gpxData) {
    87                 addDownloadTask(new DownloadGpsTask(), td, i, n);
     87                addDownloadTask(progressMonitor, new DownloadGpsTask(), td, i, n);
    8888            }
    8989        }
Note: See TracChangeset for help on using the changeset viewer.