diff --git a/platform/built-in-server/src/org/jetbrains/builtInWebServer/DefaultWebServerRootsProvider.kt b/platform/built-in-server/src/org/jetbrains/builtInWebServer/DefaultWebServerRootsProvider.kt index feb29b80c168..ce2969704f2c 100644 --- a/platform/built-in-server/src/org/jetbrains/builtInWebServer/DefaultWebServerRootsProvider.kt +++ b/platform/built-in-server/src/org/jetbrains/builtInWebServer/DefaultWebServerRootsProvider.kt @@ -60,10 +60,9 @@ private class DefaultWebServerRootsProvider : WebServerRootsProvider() { runReadAction { ModuleManager.getInstance(project).modules } .computeOrNull { module -> if (!module.isDisposed) { - val result = findByRelativePath(path, rootProvider.getRoots(ModuleRootManager.getInstance(module)), resolver, null) - if (result != null) { - result.moduleName = getModuleNameQualifier(project, module) - return result + findByRelativePath(path, rootProvider.getRoots(ModuleRootManager.getInstance(module)), resolver, null)?.let { + it.moduleName = getModuleNameQualifier(project, module) + return it } } null diff --git a/platform/built-in-server/testSrc/BuiltInWebServerTest.kt b/platform/built-in-server/testSrc/BuiltInWebServerTest.kt index 899d21dc4248..92bc079235ca 100644 --- a/platform/built-in-server/testSrc/BuiltInWebServerTest.kt +++ b/platform/built-in-server/testSrc/BuiltInWebServerTest.kt @@ -11,9 +11,9 @@ import com.intellij.util.writeChild import org.assertj.core.api.Assertions.assertThat import org.junit.Test -private class BuiltInWebServerTest : BuiltInServerTestCase() { +internal class BuiltInWebServerTest : BuiltInServerTestCase() { override val urlPathPrefix: String - get() = "/${BuiltInServerTestCase.projectRule.project.name}" + get() = "/${projectRule.project.name}" @Test @TestManager.TestDescriptor(filePath = "foo/index.html", doNotCreate = true, status = 200) @@ -34,7 +34,7 @@ private class BuiltInWebServerTest : BuiltInServerTestCase() { } private fun testIndex(vararg paths: String) { - val project = BuiltInServerTestCase.projectRule.project + val project = projectRule.project val newPath = tempDirManager.newPath() newPath.writeChild(manager.filePath!!, "hello") newPath.refreshVfs() diff --git a/platform/built-in-server/testSrc/RestApiTest.kt b/platform/built-in-server/testSrc/RestApiTest.kt index 5116c6425b47..8b01e8431c32 100644 --- a/platform/built-in-server/testSrc/RestApiTest.kt +++ b/platform/built-in-server/testSrc/RestApiTest.kt @@ -8,7 +8,7 @@ import org.junit.Test import java.net.HttpURLConnection import java.net.URL -private class RestApiTest : BuiltInServerTestCase() { +internal class RestApiTest : BuiltInServerTestCase() { override val urlPathPrefix = "/api/file" @Test diff --git a/platform/platform-impl/src/com/intellij/util/path.kt b/platform/platform-impl/src/com/intellij/util/path.kt index 33d2a184a15e..8dfd631a41d3 100644 --- a/platform/platform-impl/src/com/intellij/util/path.kt +++ b/platform/platform-impl/src/com/intellij/util/path.kt @@ -141,7 +141,7 @@ fun Path.refreshVfs() { inline fun Path.directoryStreamIfExists(task: (stream: DirectoryStream) -> R): R? { try { - Files.newDirectoryStream(this).use(task) + return Files.newDirectoryStream(this).use(task) } catch (ignored: NoSuchFileException) { } @@ -150,7 +150,7 @@ inline fun Path.directoryStreamIfExists(task: (stream: DirectoryStream inline fun Path.directoryStreamIfExists(noinline filter: ((path: Path) -> Boolean), task: (stream: DirectoryStream) -> R): R? { try { - Files.newDirectoryStream(this, { filter.invoke(it) }).use(task) + return Files.newDirectoryStream(this, { filter.invoke(it) }).use(task) } catch (ignored: NoSuchFileException) { }