September 2017

Converting a Stack Trace to a String in Java

  • Satish 

1. Introduction When dealing with exceptions in Java, we’re frequently logging or simply displaying stack traces. However, sometimes, we don’t want just to print the stack trace, we might need to write the stack trace to a file, to a database or even transmit it over the network. For these purposes, having the stack trace as a String would be very useful. And unfortunately, Java doesn’t provide a very convenient method to do that directly. 2. Conversion with Core Java Let’s start… Read More »Converting a Stack Trace to a String in Java

The StackOverflowError in Java

  • Satish 

1. Overview StackOverflowError can be annoying for Java developers, as it’s one of the most common runtime errors we can encounter. In this article, we’ll see how this error can occur by looking at a variety of code examples as well as how we can deal with it.   2. Stack Frames and How StackOverflowError Occurs Let’s start with the basics. When a method is called, a new stack frame gets created on the call stack. This stack frame holds parameters of the invoked method,… Read More »The StackOverflowError in Java