java.io.FileNotFoundException.getCause()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(127)

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

FileNotFoundException.getCause介绍

暂无

代码示例

代码示例来源:origin: org.demoiselle.signer/timestamp

/**
 * Loads the contents of a file from the disk
 *
 * @param parmFile Filename and path
 * @return The array of bytes in the file
 */
public static byte[] readContent(String parmFile) throws CertificateCoreException {
  try {
    File file = new File(parmFile);
    InputStream is = new FileInputStream(file);
    byte[] result = new byte[(int) file.length()];
    is.read(result);
    is.close();
    return result;
  } catch (FileNotFoundException ex) {
    throw new CertificateCoreException(ex.getMessage(), ex.getCause());
  } catch (IOException ex) {
    throw new CertificateCoreException(ex.getMessage(), ex.getCause());
  }
}

代码示例来源:origin: org.demoiselle.signer/signature-timestamp

/**
 * Carrega o conteudo de um arquivo do disco
 *
 * @param arquivo Caminho do arquivo
 * @return Os bytes do arquivo
 */
public static byte[] readContent(String arquivo) throws CertificateCoreException {
  try {
    File file = new File(arquivo);
    InputStream is = new FileInputStream(file);
    byte[] result = new byte[(int) file.length()];
    is.read(result);
    is.close();
    return result;
  } catch (FileNotFoundException ex) {
    throw new CertificateCoreException(ex.getMessage(), ex.getCause());
  } catch (IOException ex) {
    throw new CertificateCoreException(ex.getMessage(), ex.getCause());
  }
}

代码示例来源:origin: com.taobao.metamorphosis/metamorphosis-tools

private void initMysqlClient(final String jdbcConf) throws InitException {
  try {
    final Properties jdbcProperties = ResourceUtils.getResourceAsProperties(jdbcConf);
    final String url = jdbcProperties.getProperty("jdbc.url");
    final String userName = jdbcProperties.getProperty("jdbc.username");
    final String userPassword = jdbcProperties.getProperty("jdbc.password");
    final String jdbcUrl = url + "&user=" + userName + "&password=" + userPassword;
    System.out.println("mysql connect parameter is :\njdbc.url=" + jdbcUrl);
    Class.forName("com.mysql.jdbc.Driver");
    this.connect = DriverManager.getConnection(jdbcUrl);
  }
  catch (final FileNotFoundException e) {
    throw new InitException(e.getMessage(), e.getCause());
  }
  catch (final Exception e) {
    throw new InitException("mysql connect init failed. " + e.getMessage(), e.getCause());
  }
}

代码示例来源:origin: renyuneyun/Easer

@Override
  public List<ConditionStructure> all() {
    List<ConditionStructure> list = new ArrayList<>();
    File[] files = dir.listFiles(new FileFilter() {
      @Override
      public boolean accept(File pathname) {
        if (pathname.isFile()) {
          if (pathname.getName().endsWith(NC.SUFFIX)) {
            return true;
          }
        }
        return false;
      }
    });
    for (File file : files) {
      try {
        list.add(get(file));
      } catch (IllegalStorageDataException e) {
        e.printStackTrace();
      } catch (FileNotFoundException e) {
        throw new IllegalStateException(e.getCause());
      }
    }
    return list;
  }
}

代码示例来源:origin: renyuneyun/Easer

@Override
  public List<ScriptStructure> all() {
    List<ScriptStructure> list = new ArrayList<>();
    File[] files = dir.listFiles(new FileFilter() {
      @Override
      public boolean accept(File pathname) {
        if (pathname.isFile()) {
          if (pathname.getName().endsWith(NC.SUFFIX)) {
            return true;
          }
        }
        return false;
      }
    });
    for (File file : files) {
      ScriptStructure event;
      try {
        event = get(file);
        list.add(event);
      } catch (IllegalStorageDataException e) {
        e.printStackTrace();
      } catch (FileNotFoundException e) {
        throw new IllegalStateException(e.getCause());
      }
    }
    return list;
  }
}

代码示例来源:origin: renyuneyun/Easer

@Override
  public List<EventStructure> all() {
    List<EventStructure> list = new ArrayList<>();
    File[] files = dir.listFiles(new FileFilter() {
      @Override
      public boolean accept(File pathname) {
        if (pathname.isFile()) {
          if (pathname.getName().endsWith(NC.SUFFIX)) {
            return true;
          }
        }
        return false;
      }
    });
    for (File file : files) {
      try {
        list.add(get(file));
      } catch (IllegalStorageDataException e) {
        e.printStackTrace();
      } catch (FileNotFoundException e) {
        throw new IllegalStateException(e.getCause());
      }
    }
    return list;
  }
}

代码示例来源:origin: renyuneyun/Easer

@Override
  public List<ProfileStructure> all() {
    List<ProfileStructure> list = new ArrayList<>();
    File[] files = dir.listFiles(new FileFilter() {
      @Override
      public boolean accept(File pathname) {
        if (pathname.isFile()) {
          if (pathname.getName().endsWith(NC.SUFFIX)) {
            return true;
          }
        }
        return false;
      }
    });
    for (File file : files) {
      try {
        list.add(get(file));
      } catch (IllegalStorageDataException e) {
        e.printStackTrace();
      } catch (FileNotFoundException e) {
        throw new IllegalStateException(e.getCause());
      }
    }
    return list;
  }
}

代码示例来源:origin: OpenClinica/OpenClinica

throw new OpenClinicaSystemException("File was not found", ex.getCause());
} catch (IOException ioe) {

代码示例来源:origin: OpenClinica/OpenClinica

throw new OpenClinicaSystemException("File was not found", ex.getCause());
} catch (IOException ioe) {
  throw new OpenClinicaSystemException("IO Exception", ioe.getCause());

代码示例来源:origin: OpenClinica/OpenClinica

throw new OpenClinicaSystemException("File was not found", ex.getCause());
} catch (IOException ioe) {
  throw new OpenClinicaSystemException("IO Exception", ioe.getCause());

代码示例来源:origin: OpenClinica/OpenClinica

throw new OpenClinicaSystemException("File was not found", ex.getCause());
} catch (IOException ioe) {
  throw new OpenClinicaSystemException("IO Exception", ioe.getCause());

代码示例来源:origin: OpenClinica/OpenClinica

throw new OpenClinicaSystemException(ex.getMessage(), ex.getCause());
} catch (IOException ex) {
  throw new OpenClinicaSystemException(ex.getMessage(), ex.getCause());

代码示例来源:origin: jiongjionger/NeverLag

@Override
public void onEnable() {
  ConfigManager.getInstance().reload();
  try {
    i18n = I18n.load(new File(getDataFolder(), "lang/"), ConfigManager.getInstance().lang);
  } catch (FileNotFoundException e) {
    Bukkit.getConsoleSender().sendMessage(String.format("[%s] §c找不到指定的语言文件 §e%s§c, 插件无法正常加载! 请在配置文件中更改 §elang §c选项",
      getName(), ConfigManager.getInstance().lang));              // 输出中文提示 (彩色)
    throw new RuntimeException(e.getLocalizedMessage(), e.getCause());  // 输出英文提示 (抛错)
  }
  // 判断是否安装了ProtocolLib前置插件
  isInstallProtocoLib = Bukkit.getPluginManager().isPluginEnabled("ProtocolLib");
  // 计算TPS
  tpsWatcher = new TpsWatcher();
  Bukkit.getScheduler().runTaskTimer(this, tpsWatcher, 1L, 1L);
  // 开启主线程停顿检测线程
  watchDog = new WatchDog();
  // 初始化防御ALL-U-WANT模组
  if (isInstallProtocoLib) {
    AntiAUWMod.register();
  }
  // TODO 一堆new实例和配置文件
  this.registerCommand();
  this.registerListener();
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-file

fail();
} catch (final FileNotFoundException ex) {
  if (!(ex.getCause() instanceof FsSyncException)
      || !(ex.getCause().getCause() instanceof FsResourceOpenException))
      throw ex;
  new TFileOutputStream(file2).close();
} catch (final FileNotFoundException ex) {
  if (!(ex.getCause() instanceof FsSyncException)
      || !(ex.getCause().getCause() instanceof FsResourceOpenException))
      throw ex;
  logger.log(Level.INFO,

代码示例来源:origin: de.schlichtherle.truezip/truezip-file

fail();
} catch (final FileNotFoundException ex) {
  if (!(ex.getCause() instanceof FsSyncException)
      || !(ex.getCause().getCause() instanceof FsResourceOpenException))
    throw ex;

相关文章