From fae48f22eca08d9522dc1a4e502da92e2868a1ae Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 25 Oct 2017 17:09:42 +0200 Subject: [PATCH] [platform] overwrites corrupted action script files (EA-110095) --- .../startup/StartupActionScriptManager.java | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/platform/bootstrap/src/com/intellij/ide/startup/StartupActionScriptManager.java b/platform/bootstrap/src/com/intellij/ide/startup/StartupActionScriptManager.java index b890c067198b..6d4688a08016 100644 --- a/platform/bootstrap/src/com/intellij/ide/startup/StartupActionScriptManager.java +++ b/platform/bootstrap/src/com/intellij/ide/startup/StartupActionScriptManager.java @@ -1,21 +1,8 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.startup; import com.intellij.openapi.application.PathManager; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.util.io.ZipUtil; import org.jetbrains.annotations.NotNull; @@ -60,8 +47,16 @@ public class StartupActionScriptManager { } } else { - List script = loadActionScript(); - script.addAll(commands); + List script; + try { + script = loadActionScript(); + script.addAll(commands); + } + catch (ObjectStreamException e) { + Logger.getInstance(StartupActionScriptManager.class).warn(e); + script = new ArrayList<>(commands); + } + saveActionScript(script); } } @@ -86,7 +81,7 @@ public class StartupActionScriptManager { } } catch (ReflectiveOperationException e) { - throw new IOException("Stream error: " + scriptFile, e); + throw (StreamCorruptedException)new StreamCorruptedException("Stream error: " + scriptFile).initCause(e); } }