Changeset 12975 in josm


Ignore:
Timestamp:
2017-10-10T02:21:18+02:00 (7 years ago)
Author:
Don-vip
Message:

fix #13920 - robustness against invalid mapcss code - catch error and log it (fix command is optional)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r12948 r12975  
    501501                return null;
    502502            }
    503             final Selector matchingSelector = whichSelectorMatchesPrimitive(p);
    504             Collection<Command> cmds = new LinkedList<>();
    505             for (FixCommand fixCommand : fixCommands) {
    506                 cmds.add(fixCommand.createCommand(p, matchingSelector));
    507             }
    508             if (deletion && !p.isDeleted()) {
    509                 cmds.add(new DeleteCommand(p));
    510             }
    511             return new SequenceCommand(tr("Fix of {0}", getDescriptionForMatchingSelector(p, matchingSelector)), cmds);
     503            try {
     504                final Selector matchingSelector = whichSelectorMatchesPrimitive(p);
     505                Collection<Command> cmds = new LinkedList<>();
     506                for (FixCommand fixCommand : fixCommands) {
     507                    cmds.add(fixCommand.createCommand(p, matchingSelector));
     508                }
     509                if (deletion && !p.isDeleted()) {
     510                    cmds.add(new DeleteCommand(p));
     511                }
     512                return new SequenceCommand(tr("Fix of {0}", getDescriptionForMatchingSelector(p, matchingSelector)), cmds);
     513            } catch (IllegalArgumentException e) {
     514                Logging.error(e);
     515                return null;
     516            }
    512517        }
    513518
Note: See TracChangeset for help on using the changeset viewer.