test_class.file: filter-service-core/src/test/java/cn/leancloud/filter/service/FilterServiceFileUtilsTest.java
test_class.identifier: FilterServiceFileUtilsTest
test_case.body: @Test
      public void atomicMoveWithFallbackFailed() throws Exception {
          final String tempDir = System.getProperty("java.io.tmpdir", "/tmp") +
                  File.separator + "filter_service_" + System.nanoTime();
          FileUtils.forceMkdir(new File(tempDir));
          Path a = Paths.get(tempDir).resolve("path_a");
          Path b = Paths.get(tempDir).resolve("path_b");
          assertThatThrownBy(() -> FilterServiceFileUtils.atomicMoveWithFallback(a, b))
                  .isInstanceOf(NoSuchFileException.class);
          FileUtils.forceDelete(new File(tempDir));
      }
test_case.class_method_signature: FilterServiceFileUtilsTest.atomicMoveWithFallbackFailed()
test_case.full_signature: @Test public void atomicMoveWithFallbackFailed()
test_case.identifier: atomicMoveWithFallbackFailed
test_case.invocations: getProperty nanoTime forceMkdir resolve get resolve get isInstanceOf assertThatThrownBy atomicMoveWithFallback forceDelete
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void atomicMoveWithFallbackFailed()
focal_class.declarator: logger = LoggerFactory.getLogger(FilterServiceFileUtils.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(FilterServiceFileUtils.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.file: filter-service-core/src/main/java/cn/leancloud/filter/service/FilterServiceFileUtils.java
focal_class.identifier: FilterServiceFileUtils
focal_class.class_method_signature: FilterServiceFileUtils.lockDirectory(Path baseDir, String lockFileName)
focal_class.full_signature: static FileLock lockDirectory(Path baseDir, String lockFileName)
focal_class.identifier: lockDirectory
focal_class.modifiers: static
focal_class.parameters: (Path baseDir, String lockFileName)
focal_class.return: FileLock
focal_class.signature: FileLock lockDirectory(Path baseDir, String lockFileName)
focal_class.class_method_signature: FilterServiceFileUtils.releaseDirectoryLock(@Nullable FileLock lock)
focal_class.full_signature: static void releaseDirectoryLock(@Nullable FileLock lock)
focal_class.identifier: releaseDirectoryLock
focal_class.modifiers: static
focal_class.parameters: (@Nullable FileLock lock)
focal_class.return: void
focal_class.signature: void releaseDirectoryLock(@Nullable FileLock lock)
focal_class.class_method_signature: FilterServiceFileUtils.atomicMoveWithFallback(Path source, Path target)
focal_class.full_signature: static void atomicMoveWithFallback(Path source, Path target)
focal_class.identifier: atomicMoveWithFallback
focal_class.modifiers: static
focal_class.parameters: (Path source, Path target)
focal_class.return: void
focal_class.signature: void atomicMoveWithFallback(Path source, Path target)
focal_method.body: static void atomicMoveWithFallback(Path source, Path target) throws IOException {
          try {
              Files.move(source, target, StandardCopyOption.ATOMIC_MOVE);
          } catch (IOException outer) {
              try {
                  Files.move(source, target, StandardCopyOption.REPLACE_EXISTING);
                  logger.debug("Non-atomic move of {} to {} succeeded after atomic move failed due to {}", source, target,
                          outer.getMessage());
              } catch (IOException inner) {
                  inner.addSuppressed(outer);
                  throw inner;
              }
          }
      }
focal_method.class_method_signature: FilterServiceFileUtils.atomicMoveWithFallback(Path source, Path target)
focal_method.full_signature: static void atomicMoveWithFallback(Path source, Path target)
focal_method.identifier: atomicMoveWithFallback
focal_method.invocations: move move debug getMessage addSuppressed
focal_method.modifiers: static
focal_method.parameters: (Path source, Path target)
focal_method.return: void
focal_method.signature: void atomicMoveWithFallback(Path source, Path target)