in.close();
}
} finally {
- encoded.close();
+ encoded.flush();
+ // Cannot close!
}
}
@Override
protected Object fromStream(InputStream in) throws IOException {
try {
- return new Image(in);
+ // Cannot close it!
+ InputStream decoded = StringUtils.unbase64(in, false);
+ return new Image(decoded);
} catch (IOException e) {
throw new UnknownFormatConversionException(e.getMessage());
}
e.printStackTrace(); // should not happen (see
// setAccessible)
}
+
+ write(out, "\n}");
}
}
if (e instanceof IOException) {
throw (IOException) e;
}
- throw new IOException(e.getMessage());
+ throw new IOException(e.getMessage(), e);
}
}