You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Dave Brosius (JIRA)" <xe...@xml.apache.org> on 2006/09/10 04:34:22 UTC
[jira] Created: (XERCESJ-1186) [PATCH] retain exception stack
traces
[PATCH] retain exception stack traces
-------------------------------------
Key: XERCESJ-1186
URL: http://issues.apache.org/jira/browse/XERCESJ-1186
Project: Xerces2-J
Issue Type: Improvement
Affects Versions: 2.8.1
Reporter: Dave Brosius
Priority: Minor
Attachments: retain_stack_traces.diff
When a different exception is thrown from a catch block, you lose the original stack trace where the exception occurred, making it more difficult to figure out what went wrong. Add code to initialize the thrown exception's initial cause, so the stack traces are retained.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
[jira] Commented: (XERCESJ-1186) [PATCH] retain exception stack
traces
Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESJ-1186?page=comments#action_12433661 ]
Michael Glavassevich commented on XERCESJ-1186:
-----------------------------------------------
Dave, there are some issues with doing that. Throwable.initCause() and the IllegalStateException(String, Throwable) constructor were added to the platform in JDK 1.4 and 5.0 respectively. Xerces runs on JDK 1.2 so can't call these unless it's done conditionally using reflection. Also, there's been some talk about changing SAXException [1] so that it uses the JDK 1.4 exception changing mechanism. If that modification is made the call to initCause() may throw an IllegalStateException if the cause was initialized in SAXException's constructor.
[1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6385694
> [PATCH] retain exception stack traces
> -------------------------------------
>
> Key: XERCESJ-1186
> URL: http://issues.apache.org/jira/browse/XERCESJ-1186
> Project: Xerces2-J
> Issue Type: Improvement
> Affects Versions: 2.8.1
> Reporter: Dave Brosius
> Priority: Minor
> Attachments: retain_stack_traces.diff
>
>
> When a different exception is thrown from a catch block, you lose the original stack trace where the exception occurred, making it more difficult to figure out what went wrong. Add code to initialize the thrown exception's initial cause, so the stack traces are retained.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
[jira] Commented: (XERCESJ-1186) [PATCH] retain exception stack
traces
Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESJ-1186?page=comments#action_12433731 ]
Michael Glavassevich commented on XERCESJ-1186:
-----------------------------------------------
Right. This is approximately what was being considered for SAXException. David Megginson wanted some feedback [1] from the community before making the change but very few people responded. It was hoped that this could be included in JAXP 1.4 (Java SE 6) but it's probably too late for that now.
[1] http://www.megginson.com/blogs/quoderat/archives/2006/03/12/rfc-java-sax-exceptions-and-new-minor-sax-version/
> [PATCH] retain exception stack traces
> -------------------------------------
>
> Key: XERCESJ-1186
> URL: http://issues.apache.org/jira/browse/XERCESJ-1186
> Project: Xerces2-J
> Issue Type: Improvement
> Affects Versions: 2.8.0
> Reporter: Dave Brosius
> Priority: Minor
> Attachments: retain_stack_traces.diff
>
>
> When a different exception is thrown from a catch block, you lose the original stack trace where the exception occurred, making it more difficult to figure out what went wrong. Add code to initialize the thrown exception's initial cause, so the stack traces are retained.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
[jira] Updated: (XERCESJ-1186) [PATCH] retain exception stack
traces
Posted by "Dave Brosius (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESJ-1186?page=all ]
Dave Brosius updated XERCESJ-1186:
----------------------------------
Attachment: retain_stack_traces.diff
> [PATCH] retain exception stack traces
> -------------------------------------
>
> Key: XERCESJ-1186
> URL: http://issues.apache.org/jira/browse/XERCESJ-1186
> Project: Xerces2-J
> Issue Type: Improvement
> Affects Versions: 2.8.1
> Reporter: Dave Brosius
> Priority: Minor
> Attachments: retain_stack_traces.diff
>
>
> When a different exception is thrown from a catch block, you lose the original stack trace where the exception occurred, making it more difficult to figure out what went wrong. Add code to initialize the thrown exception's initial cause, so the stack traces are retained.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
[jira] Updated: (XERCESJ-1186) [PATCH] retain exception stack
traces
Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESJ-1186?page=all ]
Michael Glavassevich updated XERCESJ-1186:
------------------------------------------
Affects Version/s: 2.8.0
(was: 2.8.1)
> [PATCH] retain exception stack traces
> -------------------------------------
>
> Key: XERCESJ-1186
> URL: http://issues.apache.org/jira/browse/XERCESJ-1186
> Project: Xerces2-J
> Issue Type: Improvement
> Affects Versions: 2.8.0
> Reporter: Dave Brosius
> Priority: Minor
> Attachments: retain_stack_traces.diff
>
>
> When a different exception is thrown from a catch block, you lose the original stack trace where the exception occurred, making it more difficult to figure out what went wrong. Add code to initialize the thrown exception's initial cause, so the stack traces are retained.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
[jira] Commented: (XERCESJ-1186) [PATCH] retain exception stack
traces
Posted by "elharo (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESJ-1186?page=comments#action_12433685 ]
elharo commented on XERCESJ-1186:
---------------------------------
This can be addressed in 1.2 and later. All you need to do is reimplement the initCause, getCause mechanism from Java 1.4 in the exception classes. JDOM does this, XOM does this. Probably others as well. The basic code looks like this:
private Throwable cause;
public Throwable getCause() {
return this.cause;
}
// null is insufficient for detecting an uninitialized cause.
// The cause may be set to null which may not then be reset.
private boolean causeSet = false;
/**
* <p>
* Sets the root cause of this exception. This may
* only be called once. Subsequent calls throw an
* <code>IllegalStateException</code>.
* </p>
*
* <p>
* This method is unnecessary in Java 1.4 where it could easily be
* inherited from the superclass. However, including it here
* allows this method to be used in Java 1.3 and earlier.
* </p>
*
* @param cause the root cause of this exception
*
* @return this <code>XMLException</code>
*
* @throws IllegalArgumentException if the cause is this exception
* (An exception cannot be its own cause.)
* @throws IllegalStateException if this method is called twice
*/
public final Throwable initCause(Throwable cause) {
if (causeSet) {
throw new IllegalStateException("Can't overwrite cause");
}
else if (cause == this) {
throw new IllegalArgumentException("Self-causation not permitted");
}
else this.cause = cause;
causeSet = true;
return this;
}
In Java 1.4 and later these redundantly override the base methods. In 1.2 and 1.3 they provide those methods. Either way, it works.
> [PATCH] retain exception stack traces
> -------------------------------------
>
> Key: XERCESJ-1186
> URL: http://issues.apache.org/jira/browse/XERCESJ-1186
> Project: Xerces2-J
> Issue Type: Improvement
> Affects Versions: 2.8.0
> Reporter: Dave Brosius
> Priority: Minor
> Attachments: retain_stack_traces.diff
>
>
> When a different exception is thrown from a catch block, you lose the original stack trace where the exception occurred, making it more difficult to figure out what went wrong. Add code to initialize the thrown exception's initial cause, so the stack traces are retained.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
[jira] Commented: (XERCESJ-1186) [PATCH] retain exception stack
traces
Posted by "Dave Brosius (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESJ-1186?page=comments#action_12433662 ]
Dave Brosius commented on XERCESJ-1186:
---------------------------------------
fair enough. feel free to close.
> [PATCH] retain exception stack traces
> -------------------------------------
>
> Key: XERCESJ-1186
> URL: http://issues.apache.org/jira/browse/XERCESJ-1186
> Project: Xerces2-J
> Issue Type: Improvement
> Affects Versions: 2.8.1
> Reporter: Dave Brosius
> Priority: Minor
> Attachments: retain_stack_traces.diff
>
>
> When a different exception is thrown from a catch block, you lose the original stack trace where the exception occurred, making it more difficult to figure out what went wrong. Add code to initialize the thrown exception's initial cause, so the stack traces are retained.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
[jira] Resolved: (XERCESJ-1186) [PATCH] retain exception stack
traces
Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESJ-1186?page=all ]
Michael Glavassevich resolved XERCESJ-1186.
-------------------------------------------
Resolution: Later
We can't do this now. Revisit if Xerces moves to requiring JDK 1.4 (or above) at some point in the future.
> [PATCH] retain exception stack traces
> -------------------------------------
>
> Key: XERCESJ-1186
> URL: http://issues.apache.org/jira/browse/XERCESJ-1186
> Project: Xerces2-J
> Issue Type: Improvement
> Affects Versions: 2.8.0
> Reporter: Dave Brosius
> Priority: Minor
> Attachments: retain_stack_traces.diff
>
>
> When a different exception is thrown from a catch block, you lose the original stack trace where the exception occurred, making it more difficult to figure out what went wrong. Add code to initialize the thrown exception's initial cause, so the stack traces are retained.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org