diff options
author | mwebster <mwebster> | 2006-08-25 14:37:34 +0000 |
---|---|---|
committer | mwebster <mwebster> | 2006-08-25 14:37:34 +0000 |
commit | 6be70973a704548a42e396e996c9d49915b92a64 (patch) | |
tree | 4326d6c6e9f1bfee97785f7106e7c4664b523b27 /weaver | |
parent | 475afa91a3222f6839e7f087760415cc9bb76c98 (diff) | |
download | aspectj-6be70973a704548a42e396e996c9d49915b92a64.tar.gz aspectj-6be70973a704548a42e396e996c9d49915b92a64.zip |
Bug 155148 "jdk14 trace deadlock in oc4j" (use formatObj for _all_ arguments)
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/tools/AbstractTrace.java | 12 | ||||
-rw-r--r-- | weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java | 41 |
2 files changed, 47 insertions, 6 deletions
diff --git a/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java b/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java index 23d2aba39..28755dfd2 100644 --- a/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java +++ b/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java @@ -139,11 +139,11 @@ public abstract class AbstractTrace implements Trace { } /* Use classname@hashcode */ - else return obj.getClass().getName() + "@" + Integer.toString(obj.hashCode(),16); + else return obj.getClass().getName() + "@" + Integer.toHexString(obj.hashCode()); /* Object.hashCode() can be override and may thow an exception */ } catch (Exception ex) { - return obj.getClass().getName(); + return obj.getClass().getName() + "@FFFFFFFF"; } } @@ -172,4 +172,12 @@ public abstract class AbstractTrace implements Trace { return sb.toString(); } + + protected Object[] formatObjects(Object[] args) { + for (int i = 0; i < args.length; i++) { + args[i] = formatObj(args[i]); + } + + return args; + } }
\ No newline at end of file diff --git a/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java b/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java index 8f895a81b..334690b62 100644 --- a/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java +++ b/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java @@ -34,23 +34,56 @@ public abstract class AbstractTraceTest extends TestCase { public void testEnterWithThisAndArray() { Object arg1 = new String[] { "s1", "s2" }; Object arg2 = new char[] { 'a', 'b', 'c' }; - trace.enter("testEnterWithThisAndArgs",this,new Object[] { arg1, arg2 }); + trace.enter(getName(),this,new Object[] { arg1, arg2 }); } public void testEnterWithThisAndCollection() { Object arg1 = new ArrayList(); - trace.enter("testEnterWithThisAndArgs",this,new Object[] { arg1 }); + trace.enter(getName(),this,new Object[] { arg1 }); } public void testEnterWithThisAndTraceable () { Object arg1 = new Traceable() { public String toTraceString() { - return "Traceable"; + return getClass().getName() + "[Traceable]"; } }; - trace.enter("testEnterWithThisAndArgs",this,new Object[] { arg1 }); + trace.enter(getName(),this,new Object[] { arg1 }); + } + + public void testEnterWithThisAndToStringException () { + Object arg1 = new Object() { + + public String toString() { + throw new RuntimeException("toString() can throw an Exception"); + } + + }; + trace.enter(getName(),this,new Object[] { arg1 }); + } + + public void testEnterWithThisAndHashCodeException () { + Object arg1 = new Object() { + + public int hashCode() { + throw new RuntimeException("hashCode can throw an Exception"); + } + + }; + trace.enter(getName(),this,new Object[] { arg1 }); + } + + public void testEnterWithThisAndClassLoader () { + Object arg1 = new ClassLoader() { + + public String toString() { + throw new Error("Don't call ClassLoader.toString()"); + } + + }; + trace.enter(getName(),this,new Object[] { arg1 }); } public void testEnterWithThis() { |