From 656d39f4d26e5841c285877ed3834b2cc4a1c3d4 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 18 Feb 2013 15:02:34 +0400 Subject: [PATCH] cleanup --- .../openapi/vfs/impl/local/LocalFileSystemImpl.java | 13 ++++++------- .../intellij/testFramework/PlatformTestCase.java | 11 +++-------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java index 58520865b436..be13143d1a37 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java @@ -40,7 +40,6 @@ import org.jetbrains.annotations.TestOnly; import java.io.File; import java.io.FileNotFoundException; -import java.io.IOException; import java.util.*; public final class LocalFileSystemImpl extends LocalFileSystemBase implements ApplicationComponent { @@ -141,7 +140,7 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap } @TestOnly - public void cleanupForNextTest(@NotNull Set survivors) throws IOException { + public void cleanupForNextTest() { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { @@ -195,7 +194,7 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap } } - if (currentNode.watchRequest.isToWatchRecursively() && currentNode.nodes.size() > 0) { + if (currentNode.watchRequest.isToWatchRecursively() && !currentNode.nodes.isEmpty()) { // since we are watching this node recursively, we can remove it's children visitTree(currentNode, new Consumer() { @Override @@ -388,12 +387,10 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap if (rootPaths.isEmpty() || !myWatcher.isOperational()) { return Collections.emptySet(); } - else if (watchRecursively) { + if (watchRecursively) { return replaceWatchedRoots(Collections.emptySet(), rootPaths, null); } - else { - return replaceWatchedRoots(Collections.emptySet(), null, rootPaths); - } + return replaceWatchedRoots(Collections.emptySet(), null, rootPaths); } @Override @@ -401,6 +398,7 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap if (watchRequests.isEmpty()) return; ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override public void run() { synchronized (myLock) { final boolean update = doRemoveWatchedRoots(watchRequests); @@ -429,6 +427,7 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap final Set filesToSync = new HashSet(); ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override public void run() { synchronized (myLock) { final boolean update = doAddRootsToWatch(recursiveRoots, flatRoots, result, filesToSync) || diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java index fb5aea67c716..92c043643220 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java @@ -338,14 +338,9 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro ((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().cleanupForNextTest(); } - try { - LocalFileSystemImpl localFileSystem = (LocalFileSystemImpl)LocalFileSystem.getInstance(); - if (localFileSystem != null) { - localFileSystem.cleanupForNextTest(eternallyLivingFiles()); - } - } - catch (IOException e) { - // ignore + LocalFileSystemImpl localFileSystem = (LocalFileSystemImpl)LocalFileSystem.getInstance(); + if (localFileSystem != null) { + localFileSystem.cleanupForNextTest(); } LocalHistoryImpl.getInstanceImpl().cleanupForNextTest();