use of com.celements.rights.access.exceptions.NoAccessRightsException in project celements-blog by celements.
the class NewsletterAttachmentService method getAttachmentForFullname.
Attachment getAttachmentForFullname(String imgFullname) {
AttachmentURLCommand attURL = new AttachmentURLCommand();
Attachment att = null;
try {
XWikiDocument attDoc = getContext().getWiki().getDocument(webUtils.resolveDocumentReference(attURL.getPageFullName(imgFullname)), getContext());
XWikiAttachment xatt = attService.getAttachmentNameEqual(attDoc, attURL.getAttachmentName(imgFullname));
att = attService.getApiAttachment(xatt);
} catch (XWikiException xwe) {
LOGGER.error("Exception getting attachment Document.", xwe);
} catch (AttachmentNotExistsException anee) {
LOGGER.error("Attachment [{}] not found.", imgFullname, anee);
} catch (NoAccessRightsException nore) {
LOGGER.error("No access rights on attachment [{}]", imgFullname, nore);
}
return att;
}
Aggregations