Skip to content

Commit 961358f

Browse files
authored
Add location information to parsed objects and exceptions (#95)
* Store object locations when parsing and provide location of error in exceptions, where available * Add line number tracking to ASCII plist parsing * Add line information to ASCIIPropertyListParser exceptions * Add parse method overloads to store XML line information when parsing * Restructure unit tests * Remove old ant script
1 parent d5b3987 commit 961358f

27 files changed

+2361
-1347
lines changed

build.xml

-56
This file was deleted.

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
<version>3.8.1</version>
7575
<configuration>
7676
<compilerArgument>-Xlint:unchecked</compilerArgument>
77+
<compilerArgument>-Xlint:deprecation</compilerArgument>
7778
</configuration>
7879
<executions>
7980
<execution>

src/main/assembly/sources.xml

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
</formats>
66
<includeBaseDirectory>false</includeBaseDirectory>
77
<files>
8-
<file>
9-
<source>build.xml</source>
10-
</file>
118
<file>
129
<source>pom.xml</source>
1310
</file>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.dd.plist;
2+
3+
/**
4+
* Information about the location of an NSObject within an ASCII property list file.
5+
* @author Daniel Dreibrodt
6+
*/
7+
public class ASCIILocationInformation extends LocationInformation {
8+
private final int offset;
9+
private final int lineNo;
10+
private final int column;
11+
12+
ASCIILocationInformation(int offset, int lineNo, int column) {
13+
this.offset = offset;
14+
this.lineNo = lineNo;
15+
this.column = column;
16+
}
17+
18+
/**
19+
* Gets the offset of the NSObject inside the file.
20+
* @return The offset of the NSObject.
21+
*/
22+
public int getOffset() {
23+
return this.offset;
24+
}
25+
26+
/**
27+
* Gets the line number.
28+
* @return The line number, starting at 1.
29+
*/
30+
public int getLineNumber() {
31+
return this.lineNo;
32+
}
33+
34+
/**
35+
* Gets the column number.
36+
* @return The column, starting at 1.
37+
*/
38+
public int getColumnNumber() {
39+
return this.column;
40+
}
41+
42+
@Override
43+
public String getDescription() {
44+
return "Line: " + this.lineNo + ", Column: " + this.column + ", Offset: " + this.offset;
45+
}
46+
}

0 commit comments

Comments
 (0)