Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2004-05-13 18:14:30 +0000
committerDarin Wright2004-05-13 18:14:30 +0000
commita74f7c97388ea9a290e53589879cedcb4364aaf0 (patch)
treec27e573102b5c8f62cc510a2ad810e7bd17d27f3 /org.eclipse.core.variables/src/org/eclipse/core/internal
parentf68d36e73f629c82842855ec14529bcd7363ab7a (diff)
downloadeclipse.platform.debug-a74f7c97388ea9a290e53589879cedcb4364aaf0.tar.gz
eclipse.platform.debug-a74f7c97388ea9a290e53589879cedcb4364aaf0.tar.xz
eclipse.platform.debug-a74f7c97388ea9a290e53589879cedcb4364aaf0.zip
Bug 61958 - dangerous practice of catching Throwable
Diffstat (limited to 'org.eclipse.core.variables/src/org/eclipse/core/internal')
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
index 4c0241d9d..aa646f7d0 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
@@ -22,6 +22,7 @@ import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
@@ -49,6 +50,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
/**
* Singleton string variable manager.
@@ -227,12 +229,24 @@ public class StringVariableManager implements IStringVariableManager {
return;
}
Element root= null;
+ Throwable ex = null;
try {
- ByteArrayInputStream stream= new ByteArrayInputStream(variablesString.getBytes("UTF-8")); //$NON-NLS-1$
+ ByteArrayInputStream stream = new ByteArrayInputStream(variablesString.getBytes("UTF-8")); //$NON-NLS-1$
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
root = parser.parse(stream).getDocumentElement();
- } catch (Throwable throwable) {
- VariablesPlugin.logMessage("An exception occurred while loading persisted value variables.", throwable); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ ex = e;
+ } catch (ParserConfigurationException e) {
+ ex = e;
+ } catch (FactoryConfigurationError e) {
+ ex = e;
+ } catch (SAXException e) {
+ ex = e;
+ } catch (IOException e) {
+ ex = e;
+ }
+ if (ex != null) {
+ VariablesPlugin.logMessage("An exception occurred while loading persisted value variables.", ex); //$NON-NLS-1$
return;
}
if (!root.getNodeName().equals(VALUE_VARIABLES_TAG)) {

Back to the top