Skip to content

Commit

Permalink
Add location information to parsed objects and exceptions (#95)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
3breadt authored Mar 10, 2024
1 parent d5b3987 commit 961358f
Show file tree
Hide file tree
Showing 27 changed files with 2,361 additions and 1,347 deletions.
56 changes: 0 additions & 56 deletions build.xml

This file was deleted.

1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<version>3.8.1</version>
<configuration>
<compilerArgument>-Xlint:unchecked</compilerArgument>
<compilerArgument>-Xlint:deprecation</compilerArgument>
</configuration>
<executions>
<execution>
Expand Down
3 changes: 0 additions & 3 deletions src/main/assembly/sources.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
<file>
<source>build.xml</source>
</file>
<file>
<source>pom.xml</source>
</file>
Expand Down
46 changes: 46 additions & 0 deletions src/main/java/com/dd/plist/ASCIILocationInformation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.dd.plist;

/**
* Information about the location of an NSObject within an ASCII property list file.
* @author Daniel Dreibrodt
*/
public class ASCIILocationInformation extends LocationInformation {
private final int offset;
private final int lineNo;
private final int column;

ASCIILocationInformation(int offset, int lineNo, int column) {
this.offset = offset;
this.lineNo = lineNo;
this.column = column;
}

/**
* Gets the offset of the NSObject inside the file.
* @return The offset of the NSObject.
*/
public int getOffset() {
return this.offset;
}

/**
* Gets the line number.
* @return The line number, starting at 1.
*/
public int getLineNumber() {
return this.lineNo;
}

/**
* Gets the column number.
* @return The column, starting at 1.
*/
public int getColumnNumber() {
return this.column;
}

@Override
public String getDescription() {
return "Line: " + this.lineNo + ", Column: " + this.column + ", Offset: " + this.offset;
}
}
Loading

0 comments on commit 961358f

Please sign in to comment.