ch.cyberduck.core.exception.AccessDeniedException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中ch.cyberduck.core.exception.AccessDeniedException.<init>()方法的一些代码示例,展示了AccessDeniedException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AccessDeniedException.<init>()方法的具体详情如下:
包路径:ch.cyberduck.core.exception.AccessDeniedException
类名称:AccessDeniedException
方法名:<init>

AccessDeniedException.<init>介绍

暂无

代码示例

代码示例来源: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 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

/**
 * 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 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 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

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

@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

@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

throw new AccessDeniedException(e.getMessage(), e);

代码示例来源:origin: iterate-ch/cyberduck

case HttpStatus.SC_FORBIDDEN:
case HttpStatus.SC_NOT_ACCEPTABLE:
  return new AccessDeniedException(buffer.toString(), failure);
case HttpStatus.SC_CONFLICT:
  return new ConflictException(buffer.toString(), failure);

代码示例来源:origin: iterate-ch/cyberduck

throw new AccessDeniedException(e.getMessage(), e);

代码示例来源:origin: iterate-ch/cyberduck

throw new AccessDeniedException(e.getMessage(), e);

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public BackgroundException map(final ExceptionUDT e) {
    final StringBuilder buffer = new StringBuilder();
    this.append(buffer, e.getError().getDescription());
    switch(e.getError()) {
      case NOSERVER:
      case ECONNSETUP:
      case ECONNFAIL:
      case ECONNLOST:
      case ECONNREJ:
        return new ConnectionRefusedException(buffer.toString(), e);
      case ETIMEOUT:
      case EINVSOCK:
        return new ConnectionTimeoutException(buffer.toString(), e);
      case EWRPERM:
        return new AccessDeniedException(buffer.toString(), e);
      case EINVPARAM:
        return new InteroperabilityException(buffer.toString(), e);
      case USER_DEFINED_MESSAGE:
        // Handle UDT Error : -4 : user defined message : UDT send time out [id: 0x3223fa70]
      case WRAPPER_UNKNOWN:
      case WRAPPER_UNIMPLEMENTED:
      case WRAPPER_MESSAGE:
        return new InteroperabilityException(buffer.toString(), e);

    }
    return this.wrap(e, buffer);
  }
}

代码示例来源:origin: iterate-ch/cyberduck

throw new AccessDeniedException(e.getMessage(), e);

代码示例来源:origin: iterate-ch/cyberduck

return new NotfoundException(buffer.toString(), e);
case PERMISSION_DENIED:
  return new AccessDeniedException(buffer.toString(), e);
case NO_CONNECTION:
case CONNECITON_LOST:

代码示例来源:origin: iterate-ch/cyberduck

return new RetriableAccessDeniedException(buffer.toString(), e);
case "AccessDeniedException":
  return new AccessDeniedException(buffer.toString(), e);
case "UnrecognizedClientException":
  return new LoginFailureException(buffer.toString(), e);

代码示例来源:origin: iterate-ch/cyberduck

/**
 * @param file A valid bookmark dictionary
 * @return Null if the file cannot be deserialized
 * @throws AccessDeniedException If the file is not readable
 */
@Override
public S read(final Local file) throws AccessDeniedException {
  if(!file.exists()) {
    throw new LocalAccessDeniedException(file.getAbsolute());
  }
  if(!file.isFile()) {
    throw new LocalAccessDeniedException(file.getAbsolute());
  }
  final S deserialized = this.read(file.getInputStream());
  if(null == deserialized) {
    throw new AccessDeniedException(String.format("Failure parsing file %s", file.getName()));
  }
  return deserialized;
}

代码示例来源:origin: iterate-ch/cyberduck

/**
 * @param file A valid bookmark dictionary
 * @return Null if the file cannot be deserialized
 * @throws AccessDeniedException If the file is not readable
 */
@Override
public S read(final Local file) throws AccessDeniedException {
  if(!file.exists()) {
    throw new LocalAccessDeniedException(file.getAbsolute());
  }
  if(!file.isFile()) {
    throw new LocalAccessDeniedException(file.getAbsolute());
  }
  NSDictionary dict = NSDictionary.dictionaryWithContentsOfFile(file.getAbsolute());
  if(null == dict) {
    throw new AccessDeniedException(String.format("Failure parsing file %s", file.getName()));
  }
  return this.deserialize(dict);
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public void configure(final boolean enable, final Path file) throws BackgroundException {
  final Location.Name location = session.getFeature(Location.class).getLocation(file);
  if(Location.unknown.equals(location)) {
    throw new AccessDeniedException("Cannot read bucket location");
  }
  final UDTProxyConfigurator configurator = new UDTProxyConfigurator(location, this.provider(),
      new KeychainX509TrustManager(new DefaultTrustManagerHostnameCallback(session.getHost())), new KeychainX509KeyManager(session.getHost()));
  configurator.configure(session);
}

代码示例来源:origin: iterate-ch/cyberduck

final MantaObject probablyEmptyFile = session.getClient().head(file.getAbsolute());
if(probablyEmptyFile.getContentLength() != 0) {
  throw new AccessDeniedException();

相关文章

微信公众号

最新文章

更多