java - Is invocation of exception.fillInStacktrace useful? -


i found explicit invocation of e.fillinstacktrace() directly after creation of exception exception e = new exception().

i think redundant, because constructor of throwable invoke fillinstacktrace().

but maybe overlooked , lines useful:

exception e = new exception(); e.fillinstacktrace(); creationinfo = new creationinfo(e.getstacktrace()); 

(public creationinfo(stacktraceelement[] astacktrace){...})

i think

  1. the additional invocation of e.fillinstacktrace(); directly after creation exception redundant , wast lot of resource, because method expensive.

  2. it seams construct needed obtain current stacktrace, therefore:

    creationinfo = thread.currentthread().getstacktrace(); 

    is better way.

before filling issue report want ask if have overlooked something?

you correct on both counts: biggest reason why fillinstacktrace available let override in own exceptions you'd save costs of providing stack trace information, or need hide information location exception may have been thrown. see this answer more details.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -