本文整理了Java中ch.cyberduck.core.exception.AccessDeniedException
类的一些代码示例,展示了AccessDeniedException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AccessDeniedException
类的具体详情如下:
包路径:ch.cyberduck.core.exception.AccessDeniedException
类名称:AccessDeniedException
暂无
代码示例来源:origin: iterate-ch/cyberduck
private NSObject parse(final InputStream in) throws AccessDeniedException {
try {
return XMLPropertyListParser.parse(in);
}
catch(ParserConfigurationException | IOException | SAXException | ParseException | PropertyListFormatException e) {
throw new AccessDeniedException("Failure parsing XML property list", e);
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public License create() {
try {
final List<License> list = delegate.open();
if(list.isEmpty()) {
return LicenseFactory.EMPTY_LICENSE;
}
return list.iterator().next();
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure finding receipt %s", e.getMessage()));
}
return LicenseFactory.EMPTY_LICENSE;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public String getBookmark() {
if(StringUtils.isBlank(bookmark)) {
try {
bookmark = resolver.create(this);
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure resolving bookmark for %s. %s", this, e.getDetail()));
}
}
return bookmark;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public BackgroundException map(final CryptoException failure) {
final StringBuilder buffer = new StringBuilder();
this.append(buffer, failure.getMessage());
return new AccessDeniedException(buffer.toString(), failure);
}
}
代码示例来源:origin: iterate-ch/cyberduck
protected void trash() {
if(log.isInfoEnabled()) {
log.info("Moving deprecated queue file to Trash");
}
try {
LocalTrashFactory.get().trash(file);
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure trashing bookmark %s %s", file, e.getMessage()));
}
}
代码示例来源:origin: iterate-ch/cyberduck
private void save(final Properties properties) {
try (OutputStream out = file.getOutputStream(false)) {
properties.store(out, "Credentials");
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure saving credentials to %s. %s", file.getAbsolute(), e.getDetail()));
}
catch(IOException e) {
log.warn(String.format("Failure saving credentials to %s. %s", file.getAbsolute(), e.getMessage()));
}
}
代码示例来源:origin: iterate-ch/cyberduck
/**
* Read invalid JSON format.
*/
protected void read(final ProtocolFactory protocols, final Local file) throws AccessDeniedException {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(file.getInputStream(), Charset.forName("UTF-8")));
try {
String l;
while((l = in.readLine()) != null) {
Matcher array = Pattern.compile("\\[(.*?)\\]").matcher(l);
while(array.find()) {
Matcher entries = Pattern.compile("\\{(.*?)\\}").matcher(array.group(1));
while(entries.find()) {
final String entry = entries.group(1);
this.read(protocols, entry);
}
}
}
}
finally {
IOUtils.closeQuietly(in);
}
}
catch(IOException e) {
throw new AccessDeniedException(e.getMessage(), e);
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void delete() {
if(log.isDebugEnabled()) {
log.debug(String.format("Delete edited file %s", local));
}
try {
LocalTrashFactory.get().trash(local);
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure trashing edited file %s %s", local, e.getMessage()));
}
}
代码示例来源:origin: iterate-ch/cyberduck
private Properties load() {
final Properties properties = new Properties();
try {
new DefaultLocalDirectoryFeature().mkdir(file.getParent());
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure saving credentials to %s. %s", file.getAbsolute(), e.getDetail()));
}
if(file.exists()) {
try {
try (InputStream in = file.getInputStream()) {
properties.load(in);
}
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure reading credentials from %s. %s", file.getAbsolute(), e.getDetail()));
}
catch(IOException e) {
log.warn(String.format("Failure reading credentials from %s. %s", file.getAbsolute(), e.getMessage()));
}
}
return properties;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void symlink(final Local file, final String target) throws AccessDeniedException {
try {
Files.createSymbolicLink(Paths.get(file.getAbsolute()), Paths.get(target));
}
catch(IOException | UnsupportedOperationException e) {
throw new AccessDeniedException(String.format("%s %s",
LocaleFactory.localizedString("Cannot create file", "Error"), file.getAbsolute()), e);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void apply(Path file, final Local local, final TransferStatus status, final ProgressListener listener) throws BackgroundException {
if(status.isExists()) {
if(log.isInfoEnabled()) {
log.info(String.format("Trash file %s", local));
}
try {
feature.trash(local);
}
catch(AccessDeniedException e) {
// Ignore. See #8670
log.warn(e.getMessage());
}
}
super.apply(file, local, status, listener);
}
}
代码示例来源:origin: iterate-ch/cyberduck
console.printf("%s%n", e.getDetail(false));
return Exit.failure;
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void write(final S item, final Local file) throws AccessDeniedException {
final String content = item.<NSDictionary>serialize(SerializerFactory.get()).toXMLPropertyList();
final OutputStream out = file.getOutputStream(false);
try {
IOUtils.write(content, out, Charset.forName("UTF-8"));
}
catch(IOException e) {
throw new AccessDeniedException(String.format("Cannot create file %s", file.getAbsolute()), e);
}
finally {
IOUtils.closeQuietly(out);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
public static License find(final LicenseVerifierCallback callback) {
try {
final String clazz = preferences.getProperty("factory.licensefactory.class");
try {
final Class<LicenseFactory> name = (Class<LicenseFactory>) Class.forName(clazz);
final List<License> list = new ArrayList<License>(name.newInstance().open());
list.removeIf(key -> !key.verify(callback));
if(list.isEmpty()) {
return LicenseFactory.EMPTY_LICENSE;
}
return list.iterator().next();
}
catch(InstantiationException | ClassNotFoundException | IllegalAccessException e) {
throw new FactoryException(e.getMessage(), e);
}
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure finding receipt %s", e.getMessage()));
}
return LicenseFactory.EMPTY_LICENSE;
}
代码示例来源:origin: iterate-ch/cyberduck
private BackgroundException handle(final FTPException e, final StringBuilder buffer) {
final int status = e.getCode();
switch(status) {
case FTPReply.INSUFFICIENT_STORAGE:
case FTPReply.STORAGE_ALLOCATION_EXCEEDED:
return new QuotaException(buffer.toString(), e);
case FTPReply.NOT_LOGGED_IN:
return new LoginFailureException(buffer.toString(), e);
case FTPReply.FAILED_SECURITY_CHECK:
case FTPReply.DENIED_FOR_POLICY_REASONS:
case FTPReply.NEED_ACCOUNT:
case FTPReply.NEED_ACCOUNT_FOR_STORING_FILES:
case FTPReply.FILE_NAME_NOT_ALLOWED:
case FTPReply.FILE_ACTION_NOT_TAKEN:
case FTPReply.ACTION_ABORTED:
return new AccessDeniedException(buffer.toString(), e);
case FTPReply.UNAVAILABLE_RESOURCE:
case FTPReply.FILE_UNAVAILABLE:
// Requested action not taken. File unavailable (e.g., file not found, no access)
return new NotfoundException(buffer.toString(), e);
case FTPReply.SERVICE_NOT_AVAILABLE:
return new ConnectionRefusedException(buffer.toString(), e);
}
return new InteroperabilityException(buffer.toString(), e);
}
}
代码示例来源:origin: iterate-ch/cyberduck
private void configure(final Map<TransferItem, TransferStatus> files, final ConnectionCallback callback, final boolean enabled) throws BackgroundException {
final Set<Path> buckets = new HashSet<>();
for(TransferItem file : files.keySet()) {
buckets.add(new S3PathContainerService().getContainer(file.remote));
}
for(Path bucket : buckets) {
if(enabled) {
try {
if(this.accelerate(bucket, callback)) {
if(log.isInfoEnabled()) {
log.info(String.format("Tunnel upload for file %s through accelerated endpoint %s", bucket, accelerationService));
}
accelerationService.configure(true, bucket);
break;
}
else {
log.warn(String.format("Transfer acceleration disabled for %s", bucket));
}
}
catch(AccessDeniedException e) {
log.warn(String.format("Ignore failure reading S3 accelerate configuration. %s", e.getMessage()));
}
}
else {
accelerationService.configure(false, bucket);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void write(final Collection<S> collection, final Local file) throws AccessDeniedException {
final NSArray list = new NSArray(collection.size());
int i = 0;
for(S bookmark : collection) {
list.setValue(i, bookmark.<NSDictionary>serialize(SerializerFactory.get()));
i++;
}
final String content = list.toXMLPropertyList();
final OutputStream out = file.getOutputStream(false);
try {
IOUtils.write(content, out, Charset.forName("UTF-8"));
}
catch(IOException e) {
throw new AccessDeniedException(String.format("Cannot create file %s", file.getAbsolute()), e);
}
finally {
IOUtils.closeQuietly(out);
}
}
代码示例来源:origin: iterate-ch/cyberduck
protected void save(final Host bookmark) {
if(this.isLocked()) {
log.debug(String.format("Skip saving bookmark %s while loading", bookmark));
}
else {
this.lock();
try {
if(!folder.exists()) {
new DefaultLocalDirectoryFeature().mkdir(folder);
}
final Local f = this.getFile(bookmark);
if(log.isInfoEnabled()) {
log.info(String.format("Save bookmark %s", f));
}
writer.write(bookmark, f);
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure saving item in collection %s", e.getMessage()));
}
finally {
this.unlock();
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public BackgroundException map(final JargonException e) {
final StringBuilder buffer = new StringBuilder();
this.append(buffer, e.getMessage());
if(e instanceof CatNoAccessException) {
return new AccessDeniedException(buffer.toString(), e);
}
if(e instanceof FileNotFoundException) {
return new NotfoundException(buffer.toString(), e);
}
if(e instanceof DataNotFoundException) {
return new NotfoundException(buffer.toString(), e);
}
if(e instanceof AuthenticationException) {
return new LoginFailureException(buffer.toString(), e);
}
if(e instanceof InvalidUserException) {
return new LoginFailureException(buffer.toString(), e);
}
if(e instanceof InvalidGroupException) {
return new LoginFailureException(buffer.toString(), e);
}
return this.wrap(e, buffer);
}
}
代码示例来源:origin: iterate-ch/cyberduck
log.warn(String.format("Ignore failure reading keys from KMS. %s", e.getMessage()));
keys.add(SSE_KMS_DEFAULT);
内容来源于网络,如有侵权,请联系作者删除!