tmf: Bug 495054: Importing or exporting custom parsers fails silently
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / parsers / custom / CustomTxtTraceDefinition.java
index 13a159feb267307f3d11d2dfde714681c7b8b07a..2de73280a88ea9618a503b777b9a35b37cd71bb3 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2015 Ericsson
+ * Copyright (c) 2010, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -34,7 +34,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.TransformerFactoryConfigurationError;
@@ -494,6 +493,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             if (file.canRead()) {
                 doc = db.parse(file);
                 if (!doc.getDocumentElement().getNodeName().equals(CUSTOM_TXT_TRACE_DEFINITION_ROOT_ELEMENT)) {
+                    Activator.logError(String.format("Error saving CustomTxtTraceDefinition: path=%s is not a valid custom parser file", path)); //$NON-NLS-1$
                     return;
                 }
             } else {
@@ -546,17 +546,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
 
             TmfTraceType.addCustomTraceType(CustomTxtTrace.class, categoryName, definitionName);
 
-        } catch (ParserConfigurationException e) {
-            Activator.logError("Error saving CustomTxtTraceDefinition: path=" + path, e); //$NON-NLS-1$
-        } catch (TransformerConfigurationException e) {
-            Activator.logError("Error saving CustomTxtTraceDefinition: path=" + path, e); //$NON-NLS-1$
-        } catch (TransformerFactoryConfigurationError e) {
-            Activator.logError("Error saving CustomTxtTraceDefinition: path=" + path, e); //$NON-NLS-1$
-        } catch (TransformerException e) {
-            Activator.logError("Error saving CustomTxtTraceDefinition: path=" + path, e); //$NON-NLS-1$
-        } catch (IOException e) {
-            Activator.logError("Error saving CustomTxtTraceDefinition: path=" + path, e); //$NON-NLS-1$
-        } catch (SAXException e) {
+        } catch (ParserConfigurationException | TransformerFactoryConfigurationError | TransformerException | IOException | SAXException e) {
             Activator.logError("Error saving CustomTxtTraceDefinition: path=" + path, e); //$NON-NLS-1$
         }
     }
@@ -811,7 +801,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
             } else if (nodeName.equals(OUTPUT_COLUMN_ELEMENT)) {
                 Element outputColumnElement = (Element) node;
                 OutputColumn outputColumn = new OutputColumn();
-                outputColumn.name = checkNotNull(outputColumnElement.getAttribute(NAME_ATTRIBUTE));
+                outputColumn.name = outputColumnElement.getAttribute(NAME_ATTRIBUTE);
                 def.outputs.add(outputColumn);
             }
         }
This page took 0.025902 seconds and 5 git commands to generate.