source: josm/trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSException.java@ 12533

Last change on this file since 12533 was 11562, checked in by Don-vip, 7 years ago

fix #14368 - java.util.regex.PatternSyntaxException: Unclosed group

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.mappaint.mapcss;
3
4/**
5 * MapCSS parsing error, with line/columnn information in error message.
6 */
7public class MapCSSException extends RuntimeException {
8
9 /** line number at which the parse error occured */
10 protected Integer line;
11 /** column number at which the parse error occured */
12 protected Integer column;
13
14 /**
15 * Constructs a new {@code MapCSSException} with an explicit error message.
16 * @param specialmessage error message
17 */
18 public MapCSSException(String specialmessage) {
19 super(specialmessage);
20 }
21
22 /**
23 * Constructs a new {@code MapCSSException} with a cause.
24 * @param cause the root cause
25 * @since 11562
26 */
27 public MapCSSException(Throwable cause) {
28 super(cause);
29 }
30
31 /**
32 * Sets the column number at which the parse error occured.
33 * @param column the column number at which the parse error occured
34 */
35 public void setColumn(int column) {
36 this.column = column;
37 }
38
39 /**
40 * Sets the line number at which the parse error occured.
41 * @param line the line number at which the parse error occured
42 */
43 public void setLine(int line) {
44 this.line = line;
45 }
46
47 @Override
48 public String getMessage() {
49 if (line == null || column == null)
50 return super.getMessage();
51 return String.format("Error at line %s, column %s: %s", line, column, super.getMessage());
52 }
53}
Note: See TracBrowser for help on using the repository browser.