Last change
on this file since 2702 was 2512, checked in by stoecker, 14 years ago |
i18n updated, fixed files to reduce problems when applying patches, fix #4017
|
File size:
1.3 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.io;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import org.xml.sax.Locator;
|
---|
7 | import org.xml.sax.SAXException;
|
---|
8 |
|
---|
9 | public 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.