657a658,679 > /** > * @param filename > * @param content > * @param context > * @return > * @throws XWikiException > */ > public XWikiAttachment createNewAttachment(String filename, byte[] content, XWikiContext context) throws XWikiException { > XWikiAttachment attachment = this.getAttachment(filename); > if (attachment == null) { > attachment = new XWikiAttachment(); > attachment.setFilename(filename); > this.getAttachmentList().add(attachment); > } > attachment.setContent(content); > attachment.setAuthor(context.getUser()); > attachment.setDoc(this); > > this.saveAttachmentContent(attachment, context); > return attachment; > } >