The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Bruce Chapman

Bruce Chapman has been developing in Java since 1998, predominantly building telecommunication sytems. He has a degree in mechanical engineering from so long ago that it is almost irrelevant, and lives in New Zealand. Bruce was a member of the JSR269 expert group. His interest is primarily in the SE space but has also worked on ME and EE projects.

 

Bruce Chapman's blog

Delinquent

Posted by brucechapman on April 8, 2009 at 10:36 PM PDT

With computers you can have the joy of delinquency without anyone getting hurt. Delinquency being different to maliciousness of course.

So when I saw that Throwable.initCause() method could throw an IAE if the argument was "this", the delinquent in me saw an opportunity for some harmless fun.

public class TheDevilMadeMeDoIt {
    public static void main(String[] args) {
        Throwable t1 = new Throwable("t1");
        Throwable t2 = new Throwable("t2");
        t1.initCause(t2);
        t2.initCause(t1);
        t1.printStackTrace();
    }
}

I'll leave the result as an exercise.

Comments
Comments are listed in date ascending order (oldest first)

Prague_hotel, Once you try it out you'll see that it is something completely different. My code does not generate a IAE (tho' maybe it should?). :-{)>

Unxpected IAE at: java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6307563 Yours seems easier to try out. :)
Syndicate content