A DESCRIPTION OF THE PROBLEM :
Using java.awt.Font.createFont(inputstream) will leak temporary file, as java internally copies this stream to temporary file, that is keeps open utill JVM shutdown.
see https://github.com/frohoff/jdk8u-jdk/blob/master/src/share/classes/sun/f... createFont2D call.
This causes an issue in webapp context - temporary files are left behind until application server restarts(tomcat).
Cleanup at JVM shutdown is too late - all temporary files should get deleted when they're no longer needed.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1/start tomcat.
2/deploy and start webapp there.
3/make webapp call Font.createFont using Jnputstream to some font bundled in .war
4/stop webapp.
5/observe tomcat temp folder being polluted by +SF.. files.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No leaked temporary files(and filedescriptors) in temp folder.
ACTUAL -
Temp folder gradually fills up with temporary files by each restart of application
CUSTOMER SUBMITTED WORKAROUND :
Only workaround is to use Font.createFont(File).