return new ForwardResolution("/bugzooky/AddEditBug.jsp");
}
/** Saves (or updates) a bug, and then returns the user to the bug list. */
public Resolution save() throws IOException {
BugManager bm = new BugManager();
Bug bug = getBug();
if (this.newAttachment != null) {
Attachment attachment = new Attachment();
attachment.setName(this.newAttachment.getFileName());
attachment.setSize(this.newAttachment.getSize());
attachment.setContentType(this.newAttachment.getContentType());
byte[] data = new byte[(int) this.newAttachment.getSize()];
InputStream in = this.newAttachment.getInputStream();
in.read(data);
attachment.setData(data);
bug.addAttachment(attachment);
}
// Set the open date for new bugs
if (bug.getOpenDate() == null)
bug.setOpenDate(new Date());
bm.saveOrUpdate(bug);
return new RedirectResolution(BugListActionBean.class);
}