}
// The following is just wrong. Even if the DataHandler has a stream, we should still
// apply the threshold.
try {
DataSource ds = handler.getDataSource();
if (ds instanceof FileDataSource) {
FileDataSource fds = (FileDataSource)ds;
File file = fds.getFile();
if (file.length() < threshold) {
return null;
}
} else if (ds.getClass().getName().endsWith("ObjectDataSource")) {
Object o = handler.getContent();
if (o instanceof String
&& ((String)o).length() < threshold) {
return null;
} else if (o instanceof byte[] && ((byte[])o).length < threshold) {