Sometimes I write code that is not perfect. I know that because my console sometimes looks like this:

Exception in thread "blahblahblah" java.lang.StackOverflowError

    at java.lang.Thread.currentThread(Native Method)
    at java.lang.ThreadLocal.get(ThreadLocal.java:124)

Naturally, when this happens, I rush to Google with search phrases like

getting a stack overflow when I call foo() on a Bar

As you might expect, this leads to search results like

baz — is Baz framework a good choice if I need to foo lots of bars? — Stack Overflow


bar — how to foo bars with regexes — Stack Overflow

How can I better search for stack overflow errors without just getting links to stackoverflow.com?

  • Okay, yes, strictly speaking, this is off-topic, because it's a question about using search engines, not using Stack Exchange. But it's so close/relevant that I think it's okay... along the same lines as SO allowing questions about IDEs. – Pops Mar 11 '13 at 19:23

While it hasn't always been the best, using Stack Overflow's search avoids this problem just fine. The site can distinguish between itself and its content without difficulty.

| improve this answer | |

I'm assuming you are asking about general searching outside the SO environment. Whenever I use a search engine for a specific error, I try to search for the exact error message itself.

In other words, if you search for "Stack Overflow Error", you'll get lots of hits that refer to this site while searching for "java.lang.StackOverFlowError" seems more precise.

| improve this answer | |
  • I just tested this on Google, and the early hits for java.lang.StackOverFlowError were all relevant to the exception, even if the hit was on a stackoverflow.com page. – Patricia Shanahan Mar 11 '13 at 23:28

You could just divide the search space into that within and without Stack Overflow -- first search within SO then head to google to search with "-site:stackoverflow.com". That ought to cover all bases.

| improve this answer | |

Also, and I don't mean this the wrong way, its happened to me plenty of times: Usually when you get that type of error (stack overflow, out of memory, other infinite loop situations), it's because you made a mistake in the code that calls Bar.foo() rather than problem with the Bar implementation itself. Therefore, it's unlikely that there is a cookie cutter solution available for your problem, anyway.

And, of course, in that case the people at stackoverflow.com are more than happy to help.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged .