Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.4
-
None
Description
DataSourceClassPathResolver opens an InputStream (via .class.getResourceAsStream) to read a resource into a ByteArrayDataSource, but never closes it:
public DataSource resolve(final String resourceLocation, final boolean isLenient) throws IOException { ... final InputStream is = DataSourceClassPathResolver.class.getResourceAsStream(resourceName); if (is != null) { final ByteArrayDataSource ds = new ByteArrayDataSource(is, mimeType); // EMAIL-125: set the name of the DataSource to the normalized resource URL // similar to other DataSource implementations, e.g. FileDataSource, URLDataSource ds.setName(DataSourceClassPathResolver.class.getResource(resourceName).toString()); result = ds; }
The 'is' variable above should be closed in a try ... finally