From: Knute Johnson on 2 Dec 2009 23:36 Martin Gregorie wrote: > On Wed, 02 Dec 2009 10:39:50 -0800, Knute Johnson wrote: > >> I've got some production code and at one site I keep getting an >> ArrayIndexOutOfBoundsException. The problem is that there is no line >> number in the stack trace so I don't know where this is happening. The >> error is posted below. This one user must be doing something different >> than the other two but I can't get them to give me any details (which is >> very typical). I can give them modified code easily so any ideas on how >> to track this? >> > I don't have any directly relevant comments - sorry - and the following > is probably not directly relevant because retrofitting would be tedious, > but it may give you some ideas: > > I have never got on with debuggers, so I tend to load up my programs with > trace statements that output to stderr. So far, so conventional, however > I also add command line options to control debugging detail by setting a > 'debug' integer and always leave this stuff in production code because > the speed impact of testing integer values and skipping debug statements > is minimal and the diagnostic value of this trick during live running is > huge. I started doing that with C programs and still use it for Java. > An even better trick I learned from an ancient OS (ICL George 3) is to > leave tracing permanently active but to send it to a circular buffer. > Dumping the buffer is triggered by fatal errors, so you get the error > plus the program actions leading to it. The overhead of this approach is > a bit higher, but again not really noticeable. The benefit is that you > are guaranteed to get a manageable amount of diagnostics from any crash. That's a neat trick, I like it! -- Knute Johnson email s/nospam/knute2009/ -- Posted via NewsDemon.com - Premium Uncensored Newsgroup Service ------->>>>>>http://www.NewsDemon.com<<<<<<------ Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
From: Roedy Green on 3 Dec 2009 01:06 On Wed, 02 Dec 2009 10:39:50 -0800, Knute Johnson <nospam(a)rabbitbrush.frazmtn.com> wrote, quoted or indirectly quoted someone who said : > >Exception in thread "AWT-EventQueue-0" >java.lang.ArrayIndexOutOfBoundsException: > 4 > at sun.font.FontDesignMetrics.charsWidth(Unknown Source) My guess is the font you are using has malformed Font metrics data. Are you using some unusual font? Are you playing with ANY font the user has installed or just a known safe set? -- Roedy Green Canadian Mind Products http://mindprod.com I mean the word proof not in the sense of the lawyers, who set two half proofs equal to a whole one, but in the sense of a mathematician, where half proof = 0, and it is demanded for proof that every doubt becomes impossible. ~ Carl Friedrich Gauss
From: Knute Johnson on 3 Dec 2009 01:28 Roedy Green wrote: > On Wed, 02 Dec 2009 10:39:50 -0800, Knute Johnson > <nospam(a)rabbitbrush.frazmtn.com> wrote, quoted or indirectly quoted > someone who said : > >> Exception in thread "AWT-EventQueue-0" >> java.lang.ArrayIndexOutOfBoundsException: >> 4 >> at sun.font.FontDesignMetrics.charsWidth(Unknown Source) > My guess is the font you are using has malformed Font metrics data. > Are you using some unusual font? Are you playing with ANY font the > user has installed or just a known safe set? I am using one modified font but it has been in use for years. Also, it only occurs at one installation where the new JRE is installed. I think John came up with the right cause. Thanks, -- Knute Johnson email s/nospam/knute2009/ -- Posted via NewsDemon.com - Premium Uncensored Newsgroup Service ------->>>>>>http://www.NewsDemon.com<<<<<<------ Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
From: Martin Gregorie on 3 Dec 2009 08:16 On Wed, 02 Dec 2009 21:33:46 -0500, Arne Vajhøj wrote: > Martin Gregorie wrote: >> I have never got on with debuggers, so I tend to load up my programs >> with trace statements that output to stderr. So far, so conventional, >> however I also add command line options to control debugging detail by >> setting a 'debug' integer and always leave this stuff in production >> code because the speed impact of testing integer values and skipping >> debug statements is minimal and the diagnostic value of this trick >> during live running is huge. > > I completely agree that debuggers are great for debugging toy programs, > but log output is often much better for real world programs. > > But I would use log4j instead of something home made. > Like Knute, I started doing this in C programs. Actually I lie - I started doing this in COBOL, long before I learned C. Anyway, I simply transferred the technique across to Java, but as its implemented as a class, partly to shorten tracing statements. IMO re.trace("blah blah"); is more readable and faster to write than System.err.println("blah blah");. It would be trivial to change my ReportError class to use log4j rather than System.err but I'd probably roll in the circular buffer trick at the same time since that hasn't yet made it into Java. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
From: Mike Schilling on 3 Dec 2009 16:16 Arne Vajh�j wrote: > But I would use log4j instead of something home made. Why log4j rather than java.util.logger? (just curious; I've always used the latter, so have no basis for comparison)
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: return to the begin of InputStream Next: hql - elements function |