Ignore:
Timestamp:
2015-03-08T23:39:57+01:00 (8 years ago)
Author:
Don-vip
Message:

fix Sonar issue squid:S2444 - Lazy initialization of "static" fields should be "synchronized"

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

Legend:

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

    r7025 r8126  
    2626public final class AudioPlayer extends Thread {
    2727
    28     private static AudioPlayer audioPlayer = null;
     28    private static volatile AudioPlayer audioPlayer = null;
    2929
    3030    private enum State { INITIALIZING, NOTPLAYING, PLAYING, PAUSED, INTERRUPTED }
  • trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java

    r8018 r8126  
    4242
    4343    private static boolean handlingInProgress = false;
    44     private static BugReporterThread bugReporterThread = null;
     44    private static volatile BugReporterThread bugReporterThread = null;
    4545    private static int exceptionCounter = 0;
    4646    private static boolean suppressExceptionDialogs = false;
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r7901 r8126  
    7676    }
    7777
    78     private static PluralMode pluralMode = PluralMode.MODE_NOTONE; /* english default */
    79     private static String loadedCode = "en";
     78    private static volatile PluralMode pluralMode = PluralMode.MODE_NOTONE; /* english default */
     79    private static volatile String loadedCode = "en";
    8080
    8181    /* Localization keys for file chooser (and color chooser). */
     
    164164        "OptionPane.cancelButtonText"
    165165    };
    166     private static Map<String, String> strings = null;
    167     private static Map<String, String[]> pstrings = null;
     166    private static volatile Map<String, String> strings = null;
     167    private static volatile Map<String, String[]> pstrings = null;
    168168    private static Map<String, PluralMode> languages = new HashMap<>();
    169169
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r8102 r8126  
    13561356    }
    13571357
    1358     private static SVGUniverse getSvgUniverse() {
     1358    private static synchronized SVGUniverse getSvgUniverse() {
    13591359        if (svgUniverse == null) {
    13601360            svgUniverse = new SVGUniverse();
  • trunk/src/org/openstreetmap/josm/tools/MultikeyActionsHandler.java

    r7937 r8126  
    124124     * @return The unique instance of this class
    125125     */
    126     public static MultikeyActionsHandler getInstance() {
     126    public static synchronized MultikeyActionsHandler getInstance() {
    127127        if (instance == null) {
    128128            instance = new MultikeyActionsHandler();
  • trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java

    r7509 r8126  
    77import java.util.ArrayList;
    88import java.util.Collection;
     9
    910import org.openstreetmap.josm.data.coor.LatLon;
    1011import org.openstreetmap.josm.data.osm.BBox;
     
    4748    }
    4849
    49     private static Collection<Area> leftHandTrafficPolygons;
    50     private static GeoPropertyIndex<Boolean> rlCache;
     50    private static volatile Collection<Area> leftHandTrafficPolygons;
     51    private static volatile GeoPropertyIndex<Boolean> rlCache;
    5152
    5253    /**
Note: See TracChangeset for help on using the changeset viewer.