Hi programmers,
Eclipse complains about a lot places in the source code., e.g.
"Resource leak: 'fmt' is never closed SyntaxException.java /mkgmap/src/uk/me/parabola/mkgmap/scan line 45 Java Problem"
The code looks like this:
public String getMessage() {
Formatter fmt = new Formatter();
fmt.format("Error: ");
if (fileName != null)
fmt.format("(%s:%d): ", fileName, lineNumber);
fmt.format(super.getMessage());
return fmt.toString();
}
The message disappears if I change the last line to this:
String res = fmt.toString();
fmt.close();
return res;
Does anybody know if this can really improve something?
Gerd