Changeset 8631 in josm


Ignore:
Timestamp:
2015-07-31T21:08:09+02:00 (4 years ago)
Author:
wiktorn
Message:

Move lock aquires closer to try/catch/finally, to silent FindBugs warnings. Addresses: #11689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r8625 r8631  
    405405    public void addLayer(Layer layer) {
    406406        boolean isOsmDataLayer = layer instanceof OsmDataLayer;
    407         layerLock.writeLock().lock();
    408         layerLock.readLock().lock();
    409407        EnumSet<LayerListenerType> listenersToFire = EnumSet.noneOf(LayerListenerType.class);
    410408        Layer oldActiveLayer = activeLayer;
    411409        OsmDataLayer oldEditLayer = editLayer;
     410
     411        layerLock.writeLock().lock();
     412        layerLock.readLock().lock();
    412413        try {
    413414            try {
     
    530531     */
    531532    public void removeLayer(Layer layer) {
    532         layerLock.writeLock().lock();
    533         layerLock.readLock().lock();
    534 
    535533        EnumSet<LayerListenerType> listenersToFire = EnumSet.noneOf(LayerListenerType.class);
    536534        Layer oldActiveLayer = activeLayer;
    537535        OsmDataLayer oldEditLayer = editLayer;
     536
     537        layerLock.writeLock().lock();
     538        layerLock.readLock().lock();
    538539        try {
    539540            try {
     
    601602     */
    602603    public void moveLayer(Layer layer, int pos) {
    603         layerLock.writeLock().lock();
    604         layerLock.readLock().lock();
    605604        EnumSet<LayerListenerType> listenersToFire;
    606605        Layer oldActiveLayer = activeLayer;
    607606        OsmDataLayer oldEditLayer = editLayer;
     607
     608        layerLock.writeLock().lock();
     609        layerLock.readLock().lock();
    608610        try {
    609611            try {
Note: See TracChangeset for help on using the changeset viewer.