Changeset 11107 in josm for trunk/src


Ignore:
Timestamp:
2016-10-08T23:50:28+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S2189 - Loops should not be infinite

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Diff.java

    r10757 r11107  
    792792                otherStart = j;
    793793
    794                 for (;;) {
     794                boolean loop = true;
     795                while (loop) {
    795796                    /* Now find the end of this run of changes.  */
    796797
     
    819820                        ++j;
    820821                    } else {
    821                         break;
     822                        loop = false;
    822823                    }
    823824                }
  • trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportQueue.java

    r10939 r11107  
    6060            reportsToDisplay.add(report);
    6161            if (displayThread == null) {
    62                 displayThread = new Thread(this::displayAll, "bug-report-display");
     62                displayThread = new Thread(new BugReportDisplayRunnable(), "bug-report-display");
    6363                displayThread.start();
    6464            }
     
    6767    }
    6868
    69     private void displayAll() {
    70         try {
    71             while (true) {
    72                 ReportedException e = getNext();
    73                 SuppressionMode suppress = displayFor(e);
    74                 handleDialogResult(e, suppress);
     69    private class BugReportDisplayRunnable implements Runnable {
     70
     71        private volatile boolean running = true;
     72
     73        @Override
     74        public void run() {
     75            try {
     76                while (running) {
     77                    ReportedException e = getNext();
     78                    handleDialogResult(e, displayFor(e));
     79                }
     80            } catch (InterruptedException e) {
     81                displayFor(BugReport.intercept(e));
    7582            }
    76         } catch (InterruptedException e) {
    77             displayFor(BugReport.intercept(e));
    7883        }
    7984    }
Note: See TracChangeset for help on using the changeset viewer.