Friday, September 29, 2017

Find the hidden exception with the IntelliJ debugger

I was hacking some code and running tests and got:

  testA(org.acme.ATest)  Time elapsed: 0.114 sec  <<< ERROR!
   java.lang.RuntimeException: Could not inject members
   Caused by: java.lang.NullPointerException

No stack trace, no line number, nothing :-(

Attaching a debugger and making it stop on NPE also did not help, as this was slowing execution down to no avail.

Luckily IntelliJ IDEA has a nice feature to just log the exception when it happens. Just go to the breakpoint view in the Debugger and tick the respective checkbox

Bildschirmfoto 2017 09 29 um 16 16 46

You should also unmark the suspend checkbox as you don't want your porgram being interrupted all the time in places you don't want to know about (I had some hundreds of lines of NPEs within the JRE itself).

When you then attach the debugger to your process, you will see all NPEs along with the place they were thrown. And if the place is within your code, you can navigate to it via the log entry with one click.

I am sure other IDEs have a similar functionality.

Wednesday, June 14, 2017

Was tun ohne Wald?

Mein Beitrag zum Comic-Collab von Schlogger zum Thema Wald.

Comic collab wald

 

Thema für den 15. Juli: „Schmerzen“

Mit dabei im Juni 2017: (wird noch aktualisiert)

– Schlogger
Skizzenblog
pilhuhn
Rainer Unsinn
Strichweise Diesig
Demystifikation
OnlineComics
Pepperworth
Dramatized Depiction
Schisslaweng

Sunday, April 02, 2017

A beginners guide to DSL writing in Ruby

I wrote an article on writing (external) Domain Specific Languages in Ruby over at the Red Hat Developers Blog.

This is based on my two posts on Computed Metrics for HawkFX and A DSL for alert trigger definitions in Hawkular.