Yeah, sure. Here is the code: public class LocalFileResource extends DynamicImageResource { private final Logger LOG = Logger.getLogger(LocalFileResource.class); private String filePath; private InputStream stream;
public LocalFileResource(String filePath) throws FileNotFoundException { this.filePath = filePath; File file = new File(filePath); if(!file.exists()){ throw new FileNotFoundException("Could not load file " + filePath); } try { stream = new FileInputStream(file); } catch (FileNotFoundException ex) { throw new FileNotFoundException("Could not obtain stream from " + filePath); } } public LocalFileResource(InputStream stream) { if(stream == null){ throw new IllegalArgumentException("Stream cannot be null"); } this.stream = stream; } @Override protected byte[] getImageData(IResource.Attributes attributes) { try { return IOUtils.toByteArray(stream); } catch (IOException ex) { LOG.error("Could not return byte[] from " + stream); return null; } finally { if(stream != null){ try { stream.close(); } catch (IOException ex) { LOG.error("Could not close stream: " + ex.getMessage()); } } } } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Possible-memory-leak-in-Wicket-1-5-12-tp4668856p4668865.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org