* in case of I/O error
*/
public InputStream newInputStream() throws IOException {
- return new MarkableFileInputStream(data);
+ synchronized (instanceLock) {
+ if (data == null) {
+ throw new IOException("Image was close()d");
+ }
+
+ return new MarkableFileInputStream(data);
+ }
}
/**
@Override
public void close() throws IOException {
synchronized (instanceLock) {
+ new Exception().printStackTrace();
if (size >= 0) {
size = -1;
data.delete();