FYI this introduced concurrency issues. See
MULE-4563
I assume the idea was to speed things up by avoiding unnecessary calls to mkdirs() so I'll make this thread-safe rather than rollback.
Dan
public Object store(String queue, Object obj) throws IOException
{
String id = getId(obj);
File file = FileUtils.newFile(store, queue + File.separator + id + EXTENSION);
- file.getParentFile().mkdirs();
+ if(!file.getParentFile().exists() && !file.getParentFile().mkdirs())
+ {
+ throw new IOException("Failed to create directory: " + file.getAbsolutePath());
+ }
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
oos.writeObject(obj);
oos.close();