[platform] overwrites corrupted action script files (EA-110095)

This commit is contained in:
Roman Shevchenko
2017-10-25 17:10:05 +02:00
parent 3d2ef05dd4
commit fae48f22ec
@@ -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<ActionCommand> script = loadActionScript();
script.addAll(commands);
List<ActionCommand> 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);
}
}