Ignore:
Timestamp:
2014-04-27T15:35:47+02:00 (12 years ago)
Author:
Don-vip
Message:

see #8465 - use String switch/case where applicable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java

    r7005 r7012  
    112112            if (value == null) {
    113113                throwException(tr("Missing mandatory attribute ''{0}''.", "open"));
    114             } else if (value.equals("true")) {
     114            } else if ("true".equals(value)) {
    115115                current.setOpen(true);
    116             } else if (value.equals("false")) {
     116            } else if ("false".equals(value)) {
    117117                current.setOpen(false);
    118118            } else {
     
    160160        @Override
    161161        public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    162             if (qName.equals("osm")) {
     162            switch (qName) {
     163            case "osm":
    163164                if (atts == null) {
    164165                    throwException(tr("Missing mandatory attribute ''{0}'' of XML element {1}.", "version", "osm"));
     
    168169                    throwException(tr("Missing mandatory attribute ''{0}''.", "version"));
    169170                }
    170                 if (!(v.equals("0.6"))) {
     171                if (!("0.6".equals(v))) {
    171172                    throwException(tr("Unsupported version: {0}", v));
    172173                }
    173             } else if (qName.equals("changeset")) {
     174                break;
     175            case "changeset":
    174176                current = new Changeset();
    175177                parseChangesetAttributes(current, atts);
    176             } else if (qName.equals("tag")) {
     178                break;
     179            case "tag":
    177180                String key = atts.getValue("k");
    178181                String value = atts.getValue("v");
    179182                current.put(key, value);
    180             } else {
     183                break;
     184            default:
    181185                throwException(tr("Undefined element ''{0}'' found in input stream. Aborting.", qName));
    182186            }
     
    185189        @Override
    186190        public void endElement(String uri, String localName, String qName) throws SAXException {
    187             if (qName.equals("changeset")) {
     191            if ("changeset".equals(qName)) {
    188192                changesets.add(current);
    189193            }
Note: See TracChangeset for help on using the changeset viewer.