Author: andyhot
Date: Mon Nov 23 04:25:15 2009
New Revision: 883241
URL: http://svn.apache.org/viewvc?rev=883241&view=rev
Log:
TAP5-934: javassist + error reporting to work in 1.6jvm
Modified:
tapestry/tapestry5/branches/5.0/tapestry-ioc/pom.xml
tapestry/tapestry5/branches/5.0/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/OneShotLock.java
Modified: tapestry/tapestry5/branches/5.0/tapestry-ioc/pom.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.0/tapestry-ioc/pom.xml?rev=883241&r1=883240&r2=883241&view=diff
==============================================================================
--- tapestry/tapestry5/branches/5.0/tapestry-ioc/pom.xml (original)
+++ tapestry/tapestry5/branches/5.0/tapestry-ioc/pom.xml Mon Nov 23 04:25:15
2009
@@ -27,7 +27,7 @@
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
- <version>3.8.0.GA</version>
+ <version>3.9.0.GA</version>
</dependency>
<dependency>
Modified:
tapestry/tapestry5/branches/5.0/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/OneShotLock.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.0/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/OneShotLock.java?rev=883241&r1=883240&r2=883241&view=diff
==============================================================================
---
tapestry/tapestry5/branches/5.0/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/OneShotLock.java
(original)
+++
tapestry/tapestry5/branches/5.0/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/OneShotLock.java
Mon Nov 23 04:25:15 2009
@@ -36,21 +36,16 @@
{
if (lock)
{
- // This is how I would think it would be:
+ // The depth to find the caller of the check() or lock() method
varies between JDKs.
- // [0] is getStackTrace()
- // [1] is innerCheck()
- // [2] is check() or lock()
- // [3] is caller of check() or lock()
- // ... so why do we get element 4? Found this via trial and
error. Some extra stack frame
- // gets in there somehow, as in, getStackTrace() must be calling
something (probably native)
- // that creates the actual array, and includes itself as [0],
getStackTrace() as [1], etc.
- // Maybe it's something to do with synchronized?
+ StackTraceElement[] elements =
Thread.currentThread().getStackTrace();
- StackTraceElement element =
Thread.currentThread().getStackTrace()[4];
+ int i = 0;
+ while (!elements[i].getMethodName().equals("innerCheck"))
+ i++;
- throw new IllegalStateException(UtilMessages.oneShotLock(element));
+ throw new
IllegalStateException(UtilMessages.oneShotLock(elements[i + 2]));
}
}