common: Annotate Element.getAttribute
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Sun, 6 Dec 2015 22:34:36 +0000 (17:34 -0500)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 7 Dec 2015 23:08:02 +0000 (18:08 -0500)
It cannot return null. It returns an empty String when the attribute is
not present. Fixes a warning in XmlViewInfo

Change-Id: Ia4b3ee9ccc2990597cbba16c2d0d1e3349a78bec
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/62078
Reviewed-by: Hudson CI
Reviewed-by: Alexandre Montplaisir <alexmonthy@efficios.com>
common/org.eclipse.tracecompass.common.core/annotations/org/w3c/dom/Element.eea [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlCondition.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlEventHandler.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlLocation.java

diff --git a/common/org.eclipse.tracecompass.common.core/annotations/org/w3c/dom/Element.eea b/common/org.eclipse.tracecompass.common.core/annotations/org/w3c/dom/Element.eea
new file mode 100644 (file)
index 0000000..6767633
--- /dev/null
@@ -0,0 +1,4 @@
+class org/w3c/dom/Element
+getAttribute
+ (Ljava/lang/String;)Ljava/lang/String;
+ (Ljava/lang/String;)L1java/lang/String;
index ebb4e6598e20a8558adfc7a66611c5e4b3b32e2a..a5f286c0f5ba2e2d4d14c88fbbd0b169e5e913b1 100644 (file)
@@ -152,9 +152,6 @@ public class TmfXmlCondition {
 
             if (childElements.size() == 1 && firstChild.getNodeName().equals(TmfXmlStrings.ELEMENT_FIELD)) {
                 String attribute = firstChild.getAttribute(TmfXmlStrings.NAME);
-                if (attribute == null) {
-                    throw new IllegalArgumentException();
-                }
                 fStateValue = modelFactory.createStateValue(stateValueElement, fContainer, attribute);
             } else {
                 List<ITmfXmlStateAttribute> attributes = new ArrayList<>();
index 71c92c3518599b387ee0906e8012706353d33d4a..2393c28ac7a7396790245f01b5c8e23d9b46fefa 100644 (file)
@@ -63,9 +63,6 @@ public class TmfXmlEventHandler {
     public TmfXmlEventHandler(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer parent) {
         fParent = parent;
         String name = node.getAttribute(TmfXmlStrings.HANDLER_EVENT_NAME);
-        if (name == null) {
-            throw new IllegalArgumentException();
-        }
         fName = name;
 
         List<@NonNull Element> childElements = XmlUtils.getChildElements(node, TmfXmlStrings.STATE_CHANGE);
index 320a68772395f9c66a94a0ec6ddaad5866a86bef..51ebde5f50b5e2ddb19704cb10ff34759cf07b66 100644 (file)
@@ -58,9 +58,6 @@ public class TmfXmlLocation {
      */
     public TmfXmlLocation(ITmfXmlModelFactory modelFactory, Element location, IXmlStateSystemContainer container) {
         String id = location.getAttribute(TmfXmlStrings.ID);
-        if (id == null) {
-            throw new IllegalArgumentException();
-        }
         fId = id;
         fContainer = container;
 
This page took 0.027483 seconds and 5 git commands to generate.