source: josm/trunk/src/org/openstreetmap/josm/io/OsmDataParsingException.java@ 6840

Last change on this file since 6840 was 3083, checked in by bastiK, 14 years ago

added svn:eol-style=native to source files

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.io;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import org.xml.sax.Locator;
7import org.xml.sax.SAXException;
8
9public class OsmDataParsingException extends SAXException {
10 private int columnNumber;
11 private int lineNumber;
12
13 public OsmDataParsingException() {
14 super();
15 }
16
17 public OsmDataParsingException(Exception e) {
18 super(e);
19 }
20
21 public OsmDataParsingException(String message, Exception e) {
22 super(message, e);
23 }
24
25 public OsmDataParsingException(String message) {
26 super(message);
27 }
28
29 public OsmDataParsingException rememberLocation(Locator locator) {
30 if (locator == null) return this;
31 this.columnNumber = locator.getColumnNumber();
32 this.lineNumber = locator.getLineNumber();
33 return this;
34 }
35
36 @Override
37 public String getMessage() {
38 String msg = super.getMessage();
39 if (lineNumber == 0 && columnNumber == 0)
40 return msg;
41 if (msg == null) {
42 msg = getClass().getName();
43 }
44 msg = msg + " " + tr("(at line {0}, column {1})", lineNumber, columnNumber);
45 return msg;
46 }
47
48 public int getColumnNumber() {
49 return columnNumber;
50 }
51
52 public int getLineNumber() {
53 return lineNumber;
54 }
55}
Note: See TracBrowser for help on using the repository browser.