Hi there,

not sure if it helps, but myself, I've played with the sanitizer, and 
eventually wrote my own track dumper which does two parts:
- first, it dumps my own code only (plus some extras, e.g., for internally 
compiled scripts it shows the offending line, etc.)
- after that, it dumps full stack (some very basic plumbing-removing 
sanitization would help here, but the more aggresive, the less useable).

For me, it's nearly perfect: 99 % of cases the short and concise 1st dump 
suffices and I can happily ignore the rest. If it happens not to, I still can 
dive into the mess and scope out the details.

All the best,
OC

> On 23 Jun 2022, at 13:31, Jochen Theodorou <blackd...@gmx.org> wrote:
> 
> On 23.06.22 11:41, Paul King wrote:
>> I tend to agree with you but it does get a little tricky. If "my own
>> user code" is making use of e.g. Java collection classes, then
>> sometimes I'd really like to see "one level down".
> 
> one level down... well, for you in
> 
> [...]
>> Caught: java.lang.NullPointerException
>> java.lang.NullPointerException
>>         at java.util.Hashtable.containsKey(Hashtable.java:336)
>>         at java.util.Hashtable$KeySet.contains(Hashtable.java:654)
>>         at 
>> java.util.Collections$SynchronizedCollection.contains(Collections.java:2023)
>>         at java.util.ArrayList.batchRemove(ArrayList.java:726)
>>         at java.util.ArrayList.removeAll(ArrayList.java:696)
>>         at Script.run(Script.groovy:9)
> 
> it is the removeAll, so one level down means for you one level down from
> the caller (skipping indy code) - which is somewhere in the "middle" of
> the trace if not sanitized in this example.
> 
> Could we make the sanitizer more intelligent to recognize the caller
> (Script.groovy:9) and the method called (ArrayList#removeAll) to then
> sanitize the rest in a more aggressive way?
> 
> I think actually that is maybe thought a bit too short... there can be
> multiple such places, that you want to retain. Then we would have to
> recognize user code vs non-user code, which is what the sanitization is
> kind of about...
> 
> How about doing something like this:
> * have a "hard sanitizer" list, consisting of packages/classes, that
> will be always removed. like "sun." or GroovyStarter
> * have a "soft sanitizer" list, consisting of packages that will be
> removed only under condition
> * in a first iteration we remove the frames with the hard sanitizer, in
> a second iteration we remove all frames with the soft sanitizer if the
> frame two frames ago has been removed. Going with the full trace from
> before the expected result would then be:
> * two frames ago is true if the frame is the top frame, or the first
> frame in the list as well of course
> 
>> java.lang.NullPointerException
>>        at java.util.Hashtable.containsKey(Hashtable.java:336)
>>        at 
>> java.util.Collections$SynchronizedCollection.contains(Collections.java:2023)
>>        at java.util.ArrayList.removeAll(ArrayList.java:696)
>>        at Script.run(Script.groovy:9)
> 
> hard list: org.codehaus.groovy.tools.GroovyStarter, java.lang.reflect.,
> sun., org.codehaus.groovy.vmplugin
> 
> soft list:
> java., groovy.
> 
> I would actually also always keep the last frame, which in this case
> just be chance is true, meaning the trace above has only 1 unwanted
> frame for me.
> 
> Maybe somebody else has a better idea
> 
> bye Jochen

Reply via email to