When programming and being confronted with an unknown error, stack trace or a specific exception message I usually turn to Google in order to find out how other developers with similar problems previously approached these issues.
While at face value this might sound easy this requires experience. You have to know enough about software development in general and the environment (language, framework, library, you name it …) in particular in order to be able to ask the right questions. Just pasting “NullPointerException” into the Google search box for example won’t get you very far because it’s probably the most common exception in Java environments. Copying and pasting the specific line from a Java stack trace which shows where exactly (i.e. the line number) that NullPointerException has occurred is quite likely to yield a few helpful search results that at least will guide you further along.
Stack Overflow is particularly valuable in this ‘Googling a specific programming problem you only have a rough idea about‘ process. My approach usually is to click on each of the first few search results that point to questions on Stack Overflow. At the very least those will tell you if other developers have similar problems. If nobody does chances are that you’re either going in a completely wrong direction or that your problem is so arcane and rare that it might make sense to reframe it.
If however there’s an accepted answer to a question you’ll frequently have found a solution that applies to your situation as well. Even if it doesn’t solve your issue entirely you’ll often learn enough to at least make some progress.
All of this of course only really works because of the massive adoption of open source software in software development nowadays. Closed source software only allows for a rather limited examination of its inner workings and the expert community for such software most of the time is quite limited as well.
Like I said, from my experience what exact search phrases to use requires experience with the environment in question and indeed quite a bit of intuition about the particular programming language, which is not unlike the intuition one has about the natural languages one speaks (to varying degrees, of course).
Two approaches that work very well with Java are these:
- search for the first line from the stack trace that points to a line in your own code (i.e. one not from 3rd party frameworks or libraries)
- search for the line from the stack trace with a different indentation (usually the root caused / “caused by” event the exception was triggered by, see screenshot below)