diff options
author | cbateman | 2013-04-22 22:51:34 +0000 |
---|---|---|
committer | cbateman | 2013-04-22 22:51:34 +0000 |
commit | 4571e58a2c343290829b90d8b23eecbbc7991a45 (patch) | |
tree | f9ee043d6a9d1807de0668f78ecfde56dabac4b4 /jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm | |
parent | eb98560f04e8999462853ab6143ecea32480b32a (diff) | |
download | webtools.jsf-4571e58a2c343290829b90d8b23eecbbc7991a45.tar.gz webtools.jsf-4571e58a2c343290829b90d8b23eecbbc7991a45.tar.xz webtools.jsf-4571e58a2c343290829b90d8b23eecbbc7991a45.zip |
Null checks to cover 392381 and 390867.
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm')
2 files changed, 38 insertions, 18 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ElementCMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ElementCMAdapter.java index b38e43150..6cc8e491d 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ElementCMAdapter.java +++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ElementCMAdapter.java @@ -3,6 +3,7 @@ */ package org.eclipse.jst.jsf.facelet.core.internal.cm; +import java.util.Collections; import java.util.Iterator; import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; @@ -20,6 +21,7 @@ class ElementCMAdapter implements CMElementDeclaration, CMNamedNodeMap ElementCMAdapter(final ITagElement tagElement, final TagInfo tldTagInfo) { + assert tagElement != null; _tagElement = tagElement; _tLDTagInfo = tldTagInfo; } @@ -51,7 +53,6 @@ class ElementCMAdapter implements CMElementDeclaration, CMNamedNodeMap public CMNamedNodeMap getLocalElements() { - // TODO Auto-generated method stub return null; } @@ -79,7 +80,11 @@ class ElementCMAdapter implements CMElementDeclaration, CMNamedNodeMap public Object getProperty(final String propertyName) { - return _tLDTagInfo.getTagProperty(_tagElement.getName(), propertyName); + if (_tLDTagInfo != null) + { + return _tLDTagInfo.getTagProperty(_tagElement.getName(), propertyName); + } + return null; } public boolean supports(final String propertyName) @@ -106,42 +111,57 @@ class ElementCMAdapter implements CMElementDeclaration, CMNamedNodeMap public int getLength() { - final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); - - if (map != null) + if (_tLDTagInfo != null) { - return map.getLength(); + final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); + + if (map != null) + { + return map.getLength(); + } } - return 0; } public CMNode getNamedItem(final String name) { - final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); - - if (map != null) + if (_tLDTagInfo != null) { - return map.getNamedItem(name); + final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); + + if (map != null) + { + return map.getNamedItem(name); + } } return null; } public CMNode item(final int index) { - final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); - - if (map != null) + if (_tLDTagInfo != null) { - return map.item(index); + final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); + + if (map != null) + { + return map.item(index); + } } return null; } public Iterator<?> iterator() { - final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); - return map.iterator(); + if (_tLDTagInfo != null) + { + final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); + if (map != null) + { + return map.iterator(); + } + } + return Collections.EMPTY_LIST.iterator(); } }
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/NamespaceCMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/NamespaceCMAdapter.java index 0732f1954..494f72b06 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/NamespaceCMAdapter.java +++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/NamespaceCMAdapter.java @@ -76,7 +76,7 @@ import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; for (int i = 0; it.hasNext(); i++) { final ITagElement tagElement = (ITagElement) it.next(); - if (i == index) + if (i == index && tagElement != null) { ElementCMAdapter element = _elements.get(tagElement.getName()); |