DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8623>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8623
[PATCH] ErrorListener reports wrong line numbers (always -1)
Summary: [PATCH] ErrorListener reports wrong line numbers (always
-1)
Product: XalanJ2
Version: 2.3Dx
Platform: PC
OS/Version: Linux
Status: NEW
Severity: Major
Priority: Other
Component: org.apache.xalan.processor
AssignedTo: xalan-dev@xxxxxxxxxxxxxx
ReportedBy: petr.kuzel@xxxxxxx
Index: src/org/apache/xalan/processor/StylesheetHandler.java
===================================================================
RCS file:
/home/cvspublic/xml-xalan/java/src/org/apache/xalan/processor/StylesheetHandler.java,v
retrieving revision 1.47
diff -u -b -r1.47 StylesheetHandler.java
--- src/org/apache/xalan/processor/StylesheetHandler.java 10 Oct 2001
18:42:07 -0000 1.47
+++ src/org/apache/xalan/processor/StylesheetHandler.java 29 Apr 2002
14:48:16 -0000
@@ -103,6 +103,7 @@
import javax.xml.transform.TransformerException;
import org.apache.xml.utils.SAXSourceLocator;
+import org.xml.sax.helpers.LocatorImpl;
/**
* <meta name="usage" content="advanced"/>
@@ -441,7 +442,7 @@
public void setDocumentLocator(Locator locator)
{
- // System.out.println("pushing locator for: "+locator.getSystemId());
+ //System.out.println("pushing locator for: "+locator.getSystemId());
m_stylesheetLocatorStack.push(new SAXSourceLocator(locator));
}
@@ -927,6 +928,15 @@
{
SAXSourceLocator locator = getLocator();
+
+ // clone it as locator is shared and its value may dismiss
+ LocatorImpl clone = new LocatorImpl();
+ clone.setSystemId(locator.getSystemId());
+ clone.setPublicId(locator.getPublicId());
+ clone.setColumnNumber(locator.getColumnNumber());
+ clone.setLineNumber(locator.getLineNumber());
+ locator = new SAXSourceLocator(clone);
+
ErrorListener handler = m_stylesheetProcessor.getErrorListener();
TransformerException pe;
@@ -1482,6 +1492,7 @@
if (m_stylesheetLocatorStack.isEmpty())
{
+
SAXSourceLocator locator = new SAXSourceLocator();
locator.setSystemId(this.getStylesheetProcessor().getDOMsystemID());
|