Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r7110 r7124 10 10 import java.io.InputStream; 11 11 import java.nio.charset.StandardCharsets; 12 import java.text.MessageFormat; 12 13 import java.util.ArrayList; 13 14 import java.util.List; … … 126 127 } 127 128 MapCSSRule optRule = new MapCSSRule(r.selector.optimizedBaseCheck(), r.declaration); 128 switch (((GeneralSelector) selRightmost).getBase()) { 129 final String base = ((GeneralSelector) selRightmost).getBase(); 130 switch (base) { 129 131 case "node": 130 132 nodeRules.add(optRule); … … 149 151 case "canvas": 150 152 canvasRules.add(r); 153 default: 154 final RuntimeException e = new RuntimeException(MessageFormat.format("Unknown MapCSS base selector {0}", base)); 155 Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage())); 156 Main.error(e); 157 logError(e); 151 158 } 152 159 } -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy
r7123 r7124 310 310 assert !s1.matches(new Environment().withPrimitive(w)) 311 311 } 312 313 @Test 314 public void testInvalidBaseSelector() throws Exception { 315 def css = new MapCSSStyleSource("invalid_base[key=value] {}") 316 css.loadStyleSource() 317 assert !css.getErrors().isEmpty() 318 assert css.getErrors().iterator().next().toString().contains("Unknown MapCSS base selector invalid_base") 319 } 312 320 }
Note:
See TracChangeset
for help on using the changeset viewer.