This commit is contained in:
Vladimir Krivosheev
2015-08-28 18:15:34 +02:00
parent a73d2bb2da
commit 4682057a35
9 changed files with 26 additions and 57 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -29,7 +29,6 @@ import com.intellij.openapi.extensions.impl.ExtensionPointImpl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMExternalizableStringList;
import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.psi.PsiDocCommentOwner;
@@ -140,7 +139,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
try {
ADDITIONAL_ANNOTATIONS.readExternal(element);
}
catch (InvalidDataException ignored) {
catch (Throwable ignored) {
}
}
@@ -139,8 +139,13 @@ public interface HighlightInfoType {
return "HighlightInfoTypeImpl[severity=" + mySeverity + ", key=" + myAttributesKey + "]";
}
public void writeExternal(Element element) throws WriteExternalException {
mySeverity.writeExternal(element);
public void writeExternal(Element element) {
try {
mySeverity.writeExternal(element);
}
catch (WriteExternalException e) {
throw new RuntimeException(e);
}
myAttributesKey.writeExternal(element);
}
@@ -21,10 +21,8 @@ import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.JDOMExternalizableStringList;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.util.IncorrectOperationException;
@@ -135,7 +133,7 @@ public class SeverityRegistrar implements JDOMExternalizable, Comparator<Highlig
@Override
public void readExternal(Element element) throws InvalidDataException {
public void readExternal(Element element) {
myMap.clear();
myRendererColors.clear();
for (Element infoElement : element.getChildren(INFO_TAG)) {
@@ -181,7 +179,7 @@ public class SeverityRegistrar implements JDOMExternalizable, Comparator<Highlig
}
@Override
public void writeExternal(Element element) throws WriteExternalException {
public void writeExternal(Element element) {
List<HighlightSeverity> list = getOrderAsList(getOrderMap());
for (HighlightSeverity severity : list) {
Element info = new Element(INFO_TAG);
@@ -437,7 +435,7 @@ public class SeverityRegistrar implements JDOMExternalizable, Comparator<Highlig
return myType;
}
private void writeExternal(@NotNull Element element) throws WriteExternalException {
private void writeExternal(@NotNull Element element) {
myAttributes.writeExternal(element);
myType.writeExternal(element);
}
@@ -29,8 +29,6 @@ import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.packageDependencies.DependencyValidationManager;
import com.intellij.profile.DefaultProjectProfileManager;
import com.intellij.profile.Profile;
@@ -205,7 +203,7 @@ public class InspectionProjectProfileManagerImpl extends InspectionProjectProfil
try {
mySeverityRegistrar.readExternal(state);
}
catch (InvalidDataException e) {
catch (Throwable e) {
LOG.error(e);
}
super.loadState(state);
@@ -214,12 +212,7 @@ public class InspectionProjectProfileManagerImpl extends InspectionProjectProfil
@Override
public Element getState() {
Element state = super.getState();
try {
mySeverityRegistrar.writeExternal(state);
}
catch (WriteExternalException e) {
LOG.error(e);
}
mySeverityRegistrar.writeExternal(state);
return state;
}
@@ -20,7 +20,6 @@ import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.util.JDOMExternalizerUtil;
import com.intellij.openapi.util.NullableLazyValue;
import com.intellij.openapi.util.VolatileNullableLazyValue;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jdom.Element;
@@ -91,7 +90,7 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey> {
return find(externalName);
}
public void writeExternal(Element element) throws WriteExternalException {
public void writeExternal(Element element) {
JDOMExternalizerUtil.writeField(element, "myExternalName", myExternalName);
if (myDefaultAttributes != NULL_ATTRIBUTES) {
@@ -100,7 +99,6 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey> {
}
}
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
@@ -38,8 +38,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.profile.Profile;
import com.intellij.profile.codeInspection.InspectionProfileLoadUtil;
import com.intellij.profile.codeInspection.InspectionProfileManager;
@@ -256,23 +254,13 @@ public class InspectionProfileManagerImpl extends InspectionProfileManager imple
@Override
public Element getState() {
Element state = new Element("state");
try {
mySeverityRegistrar.writeExternal(state);
}
catch (WriteExternalException e) {
throw new RuntimeException(e);
}
mySeverityRegistrar.writeExternal(state);
return state;
}
@Override
public void loadState(Element state) {
try {
mySeverityRegistrar.readExternal(state);
}
catch (InvalidDataException e) {
throw new RuntimeException(e);
}
mySeverityRegistrar.readExternal(state);
}
public InspectionProfileConvertor getConverter() {
@@ -720,12 +720,7 @@ public class RunManagerImpl extends RunManagerEx implements PersistentStateCompo
}
}
try {
myOrder.readExternal(parentNode);
}
catch (InvalidDataException e) {
throw new RuntimeException(e);
}
myOrder.readExternal(parentNode);
// migration (old ids to UUIDs)
readList(myOrder);
@@ -734,12 +729,7 @@ public class RunManagerImpl extends RunManagerEx implements PersistentStateCompo
Element recentNode = parentNode.getChild(RECENT);
if (recentNode != null) {
JDOMExternalizableStringList list = new JDOMExternalizableStringList();
try {
list.readExternal(recentNode);
}
catch (InvalidDataException e) {
throw new RuntimeException(e);
}
list.readExternal(recentNode);
readList(list);
for (String name : list) {
RunnerAndConfigurationSettings settings = myConfigurations.get(name);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -18,6 +18,7 @@ package com.intellij.openapi.util;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.ReflectionUtil;
import org.jdom.Element;
import org.jdom.IllegalDataException;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@@ -47,7 +48,7 @@ public class JDOMExternalizableStringList extends ArrayList<String> implements J
}
@Override
public void readExternal(Element element) throws InvalidDataException {
public void readExternal(Element element) {
clear();
Class callerClass = null;
@@ -59,8 +60,7 @@ public class JDOMExternalizableStringList extends ArrayList<String> implements J
final ClassLoader classLoader = callerClass.getClassLoader();
for (Element listItemElement : listElement.getChildren(ATTR_ITEM)) {
if (!ATTR_ITEM.equals(listItemElement.getName())) {
throw new InvalidDataException(
"Unable to read list item. Unknown element found: " + listItemElement.getName());
throw new IllegalDataException("Unable to read list item. Unknown element found: " + listItemElement.getName());
}
String itemClassString = listItemElement.getAttributeValue(ATTR_CLASS);
Class itemClass;
@@ -68,8 +68,7 @@ public class JDOMExternalizableStringList extends ArrayList<String> implements J
itemClass = Class.forName(itemClassString, true, classLoader);
}
catch (ClassNotFoundException ex) {
throw new InvalidDataException(
"Unable to read list item: unable to load class: " + itemClassString + " \n" + ex.getMessage());
throw new IllegalDataException("Unable to read list item: unable to load class: " + itemClassString + " \n" + ex.getMessage());
}
String listItem = listItemElement.getAttributeValue(ATTR_VALUE);
@@ -16,7 +16,6 @@
package org.intellij.plugins.intelliLang.inject.config;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMExternalizableStringList;
import com.intellij.openapi.util.JDOMExternalizer;
import com.intellij.openapi.util.Pair;
@@ -28,6 +27,7 @@ import com.intellij.util.IncorrectOperationException;
import gnu.trove.THashMap;
import org.intellij.plugins.intelliLang.inject.java.JavaLanguageInjectionSupport;
import org.jdom.Element;
import org.jdom.IllegalDataException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -97,8 +97,7 @@ public class MethodParameterInjection extends BaseInjection {
try {
list.readExternal(e);
}
catch (InvalidDataException e1) {
// nothing
catch (IllegalDataException ignored) {
}
if (list.isEmpty()) return;
final boolean[] selection = new boolean[list.size()];