Changeset 20811
- Timestamp:
- 2009-10-12T21:20:59+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/util/XMLTools.java
r18377 r20811 520 520 String line = ""; 521 521 int linenumber = e.getLineNumber(); 522 DebugStream.print ln("\n****SAXParseException on LINE NUMBER: " + linenumber);522 DebugStream.print("\n****SAXParseException on LINE NUMBER: " + linenumber); 523 523 if(DebugStream.isDebuggingEnabled()) { 524 524 if(linenumber != -1) { 525 // find the line in xmlContents string (xmlContents is only set if GLI is run with debugging turned on) 526 int start = 0; 527 int end = xmlContents.length(); 528 for(int i = 1; i <= linenumber; i++) { 529 end = xmlContents.indexOf("\n"); 530 if(end > 0) { 531 line = xmlContents.substring(start, end); 532 } 533 start = end+1; 534 } 525 String[] lines = xmlContents.split("\n"); 526 if (lines.length > 0) { 527 DebugStream.println(" (number of lines: " + lines.length + ")"); 528 if(lines.length >= linenumber) { 529 line = lines[linenumber-1]; 530 } else { // error is past the last line 531 line = "Error is past the last line (" + lines.length + "): " + lines[lines.length-1]; 532 } 533 } else { 534 DebugStream.print("\n"); 535 } 536 lines = null; 537 535 538 DebugStream.println("The parsing error occurred on this line:\n***********START\n" + line + "\n***********END"); 536 539 DebugStream.println("SAXParseException message: " + e.getMessage() + "\n");
Note:
See TracChangeset
for help on using the changeset viewer.