stream = new FileInputStream(file);
JcrUtils.putFile(targetParent, targetName, mimeType, stream);
node.getSession().save();
} catch (RepositoryException e) {
throw new ImportException("Unable to import from file '" + dataSource + "' to '"
+ target.getPath() + "'", e);
} catch (FileNotFoundException e) {
throw new ImportException("Unexpected FileNotFoundException while importing", e);
} finally {
if (stream != null) {
IOUtils.closeQuietly(stream);
}
}