From 60dfa8cc840affb856dc63e85a9e3ddca6093c02 Mon Sep 17 00:00:00 2001 From: Vladimir Ilmov Date: Thu, 30 Jul 2020 15:19:51 +0200 Subject: [PATCH] Ignore ProcessCancelledException in VirtualFileKotlinClass --- .../kotlin/load/kotlin/VirtualFileKotlinClass.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/VirtualFileKotlinClass.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/VirtualFileKotlinClass.kt index 7e5747a0fc1..1e484346619 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/VirtualFileKotlinClass.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/VirtualFileKotlinClass.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.load.kotlin import com.intellij.ide.highlighter.JavaClassFileType import com.intellij.openapi.diagnostic.Logger +import com.intellij.openapi.progress.ProcessCanceledException import com.intellij.openapi.vfs.VirtualFile import org.jetbrains.kotlin.load.kotlin.KotlinClassFinder.Result.KotlinClass import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader @@ -41,8 +42,7 @@ class VirtualFileKotlinClass private constructor( override fun getFileContents(): ByteArray { try { return file.contentsToByteArray() - } - catch (e: IOException) { + } catch (e: IOException) { LOG.error(renderFileReadingErrorMessage(file), e) throw rethrow(e) } @@ -71,18 +71,18 @@ class VirtualFileKotlinClass private constructor( return@time kotlinJvmBinaryClass?.let { KotlinClass(it, byteContent) } ?: KotlinClassFinder.Result.ClassFileContent(byteContent) } - } - catch (e: FileNotFoundException) { + } catch (e: FileNotFoundException) { // Valid situation. User can delete jar file. - } - catch (e: Throwable) { - LOG.warn(renderFileReadingErrorMessage(file)) + } catch (e: ProcessCanceledException) { + // Valid situation. + } catch (e: Throwable) { + LOG.warn(renderFileReadingErrorMessage(file), e) } null } } private fun renderFileReadingErrorMessage(file: VirtualFile): String = - "Could not read file: ${file.path}; size in bytes: ${file.length}; file type: ${file.fileType.name}" + "Could not read file: ${file.path}; size in bytes: ${file.length}; file type: ${file.fileType.name}" } }