7045138: OutOfMemoryError thrown without stack trace in jdk7-b142
Reviewed-by: dholmes, mchung
This commit is contained in:
parent
41491be4d6
commit
250f88282b
@ -777,7 +777,8 @@ public class Throwable implements Serializable {
|
||||
* @see java.lang.Throwable#printStackTrace()
|
||||
*/
|
||||
public synchronized Throwable fillInStackTrace() {
|
||||
if (stackTrace != null) {
|
||||
if (stackTrace != null ||
|
||||
backtrace != null /* Out of protocol state */ ) {
|
||||
fillInStackTrace(0);
|
||||
stackTrace = UNASSIGNED_STACK;
|
||||
}
|
||||
@ -817,7 +818,8 @@ public class Throwable implements Serializable {
|
||||
private synchronized StackTraceElement[] getOurStackTrace() {
|
||||
// Initialize stack trace field with information from
|
||||
// backtrace if this is the first call to this method
|
||||
if (stackTrace == UNASSIGNED_STACK) {
|
||||
if (stackTrace == UNASSIGNED_STACK ||
|
||||
(stackTrace == null && backtrace != null) /* Out of protocol state */) {
|
||||
int depth = getStackTraceDepth();
|
||||
stackTrace = new StackTraceElement[depth];
|
||||
for (int i=0; i < depth; i++)
|
||||
@ -865,7 +867,8 @@ public class Throwable implements Serializable {
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
if (this.stackTrace == null) // Immutable stack
|
||||
if (this.stackTrace == null && // Immutable stack
|
||||
backtrace == null) // Test for out of protocol state
|
||||
return;
|
||||
this.stackTrace = defensiveCopy;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user