@Override public String create(final Local file) throws AccessDeniedException { final ObjCObjectByReference error = new ObjCObjectByReference(); // Create new security scoped bookmark final NSURL url = NSURL.fileURLWithPath(file.getAbsolute()); if(log.isTraceEnabled()) { log.trace(String.format("Resolved file %s to url %s", file, url)); } final NSData data = url.bookmarkDataWithOptions_includingResourceValuesForKeys_relativeToURL_error( create, null, null, error); if(null == data) { log.warn(String.format("Failure getting bookmark data for file %s", file)); final NSError f = error.getValueAs(NSError.class); if(null == f) { throw new LocalAccessDeniedException(file.getAbsolute()); } throw new LocalAccessDeniedException(String.format("%s", f.localizedDescription())); } final String encoded = data.base64Encoding(); if(log.isTraceEnabled()) { log.trace(String.format("Encoded bookmark for %s as %s", file, encoded)); } return encoded; }