java.nio.file.NoSuchFileException.printStackTrace()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(179)

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

NoSuchFileException.printStackTrace介绍

暂无

代码示例

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

} catch (Exception notInJarWithPath) {
  notInJarWithPath.printStackTrace();
  notFoundOnFilesystemWithExtensionTackedOn.printStackTrace();
  throw new RuntimeException(" Could not locate DBTYpe settings : " + matchString,
      notInJarWithPath);

代码示例来源:origin: org.apache.cassandra/cassandra-all

static void delete(File file)
{
  try
  {
    if (logger.isTraceEnabled())
      logger.trace("Deleting {}", file);
    Files.delete(file.toPath());
  }
  catch (NoSuchFileException e)
  {
    logger.error("Unable to delete {} as it does not exist, see debug log file for stack trace", file);
    if (logger.isDebugEnabled())
    {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      try (PrintStream ps = new PrintStream(baos))
      {
        e.printStackTrace(ps);
      }
      logger.debug("Unable to delete {} as it does not exist, stack trace:\n {}", file, baos.toString());
    }
  }
  catch (IOException e)
  {
    logger.error("Unable to delete {}", file, e);
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

static void delete(File file)
{
  try
  {
    if (logger.isTraceEnabled())
      logger.trace("Deleting {}", file);
    Files.delete(file.toPath());
  }
  catch (NoSuchFileException e)
  {
    logger.error("Unable to delete {} as it does not exist, see debug log file for stack trace", file);
    if (logger.isDebugEnabled())
    {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      try (PrintStream ps = new PrintStream(baos))
      {
        e.printStackTrace(ps);
      }
      logger.debug("Unable to delete {} as it does not exist, stack trace:\n {}", file, baos.toString());
    }
  }
  catch (IOException e)
  {
    logger.error("Unable to delete {}", file, e);
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

static void delete(File file)
{
  try
  {
    if (logger.isTraceEnabled())
      logger.trace("Deleting {}", file);
    Files.delete(file.toPath());
  }
  catch (NoSuchFileException e)
  {
    logger.error("Unable to delete {} as it does not exist, see debug log file for stack trace", file);
    if (logger.isDebugEnabled())
    {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      try (PrintStream ps = new PrintStream(baos))
      {
        e.printStackTrace(ps);
      }
      logger.debug("Unable to delete {} as it does not exist, stack trace:\n {}", file, baos.toString());
    }
  }
  catch (IOException e)
  {
    logger.error("Unable to delete {}", file, e);
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

static void delete(File file)
{
  try
  {
    if (logger.isTraceEnabled())
      logger.trace("Deleting {}", file);
    Files.delete(file.toPath());
  }
  catch (NoSuchFileException e)
  {
    logger.error("Unable to delete {} as it does not exist, see debug log file for stack trace", file);
    if (logger.isDebugEnabled())
    {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      try (PrintStream ps = new PrintStream(baos))
      {
        e.printStackTrace(ps);
      }
      logger.debug("Unable to delete {} as it does not exist, stack trace:\n {}", file, baos.toString());
    }
  }
  catch (IOException e)
  {
    logger.error("Unable to delete {}", file, e);
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.apache.taverna.language/taverna-robundle

@Test
public void fileChannelCreate() throws Exception {
  try {
    Path test = fs.getPath("test.txt");
    FileChannel.open(test, StandardOpenOption.WRITE,
        StandardOpenOption.CREATE).close();
  } catch (NoSuchFileException ex) {
    System.err.println("Unexpected exception");
    ex.printStackTrace();
    // Bug in JDK
  }
}

代码示例来源:origin: net.sourceforge.pmd/pmd-core

} catch (Exception notInJarWithPath) {
  notInJarWithPath.printStackTrace();
  notFoundOnFilesystemWithExtensionTackedOn.printStackTrace();
  throw new RuntimeException(" Could not locate DBTYpe settings : " + matchString,
      notInJarWithPath);

代码示例来源:origin: org.apache.taverna.language/taverna-robundle

@Test
public void setLastModifiedTime() throws Exception {
  Path root = fs.getRootDirectories().iterator().next();
  Path folder = root.resolve("folder");
  Files.createDirectory(folder);
  Path file = root.resolve("file");
  Files.createFile(file);
  FileTime someTimeAgo = FileTime.from(365 * 12, TimeUnit.DAYS);
  Files.setLastModifiedTime(folder, someTimeAgo);
  Files.setLastModifiedTime(file, someTimeAgo);
  try {
    Files.setLastModifiedTime(root, someTimeAgo);
  } catch (NoSuchFileException ex) {
    System.err
        .println("Unexpected failure of setLastModifiedTime on root");
    ex.printStackTrace();
  }
}

相关文章