Ignore:
Timestamp:
2016-12-09T23:31:13+01:00 (3 years ago)
Author:
Don-vip
Message:

sonar - squid:S00112 - Generic exceptions should never be thrown: define JosmRuntimeException

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj

    r10837 r11374  
    4040import org.openstreetmap.josm.gui.mappaint.mapcss.Subpart;
    4141import org.openstreetmap.josm.tools.ColorHelper;
     42import org.openstreetmap.josm.tools.JosmRuntimeException;
    4243import org.openstreetmap.josm.tools.Pair;
    4344import org.openstreetmap.josm.tools.Utils;
     
    6667     */
    6768    public static enum LexicalState {
    68         PREPROCESSOR(0), /* the preprocessor */
    69         DEFAULT(2);      /* the main parser */
    70        
     69        /** the preprocessor */
     70        PREPROCESSOR(0),
     71        /** the main parser */
     72        DEFAULT(2);
     73
    7174        int idx; // the integer, which javacc assigns to this state
    72        
     75
    7376        LexicalState(int idx) {
    7477            if (!this.name().equals(MapCSSParserTokenManager.lexStateNames[idx])) {
    75                 throw new RuntimeException();
     78                throw new JosmRuntimeException("Wrong name for index " + idx);
    7679            }
    7780            this.idx = idx;
    7881        }
    79     };
     82    }
    8083   
    8184    /**
     
    9598            scs = new SimpleCharStream(in, encoding, 1, 1);
    9699        } catch (java.io.UnsupportedEncodingException e) {
    97             throw new RuntimeException(e);
     100            throw new JosmRuntimeException(e);
    98101        }
    99102        return new MapCSSParserTokenManager(scs, initState.idx);
Note: See TracChangeset for help on using the changeset viewer.