Here is the code which is giving the error -
try(StringWriter stringWriter = new StringWriter()) {
IDE is complaining as Unhandled exception from auto-closeable resource:java.io.IOException Is it necessary to pass something in the constructor here ?