You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2013/01/01 12:29:02 UTC

svn commit: r1427384 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/OMElement.java axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java

Author: veithen
Date: Tue Jan  1 11:29:01 2013
New Revision: 1427384

URL: http://svn.apache.org/viewvc?rev=1427384&view=rev
Log:
getAllDeclaredNamespaces and getAllAttributes never return null.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
    webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java?rev=1427384&r1=1427383&r2=1427384&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java Tue Jan  1 11:29:01 2013
@@ -233,12 +233,15 @@ public interface OMElement extends OMNod
      * The iterator returned by this method supports {@link Iterator#remove()} and that method can
      * be used to remove a namespace declaration from this element.
      * 
-     * @return An iterator over the {@link OMNamespace} items declared on this element. Note that
-     *         the iterator may be invalidated by a call to {@link #declareNamespace(OMNamespace)},
-     *         {@link #declareNamespace(String, String)}, {@link #declareDefaultNamespace(String)}
-     *         or any other method that modifies the namespace declarations of this element.
+     * @return An iterator over the {@link OMNamespace} items declared on this element. If the
+     *         element has no namespace declarations, an empty iterator is returned.
+     *         <p>
+     *         Note that the returned iterator may be invalidated by a call to
+     *         {@link #declareNamespace(OMNamespace)}, {@link #declareNamespace(String, String)},
+     *         {@link #declareDefaultNamespace(String)} or any other method that modifies the
+     *         namespace declarations of this element.
      */
-    Iterator getAllDeclaredNamespaces() throws OMException;
+    Iterator getAllDeclaredNamespaces();
 
     /**
      * Get an iterator that returns all namespaces in scope for this element. This method may be
@@ -288,12 +291,12 @@ public interface OMElement extends OMNod
     
     /**
      * Returns a list of OMAttributes.
-     * <p/>
-     * <p>Note that the iterator returned by this function will be invalidated by any
-     * <tt>addAttribute</tt> call. </p>
-     *
-     * @return Returns an {@link Iterator} of {@link OMAttribute} items associated with the
-     *         element.
+     * <p>
+     * Note that the iterator returned by this function will be invalidated by any
+     * <tt>addAttribute</tt> call.
+     * 
+     * @return An iterator over the {@link OMAttribute} items associated with the element. If the
+     *         element has no attributes, an empty iterator is returned.
      * @see #getAttribute
      * @see #addAttribute(OMAttribute)
      * @see #addAttribute(String, String, OMNamespace)

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java?rev=1427384&r1=1427383&r2=1427384&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java Tue Jan  1 11:29:01 2013
@@ -1349,16 +1349,14 @@ class SwitchingWrapper extends AbstractX
         Map nsMap = new LinkedHashMap();
         while (context != null && !(context instanceof OMDocument)) {
             OMElement element = (OMElement) context;
-            Iterator i = element.getAllDeclaredNamespaces();
-            while (i != null && i.hasNext()) {
-                addNamespaceToMap((OMNamespace) i.next(), nsMap);
+            for (Iterator it = element.getAllDeclaredNamespaces(); it.hasNext(); ) {
+                addNamespaceToMap((OMNamespace) it.next(), nsMap);
             }
             if (element.getNamespace() != null) {
                 addNamespaceToMap(element.getNamespace(), nsMap);
             }
-            for (Iterator iter = element.getAllAttributes();
-                 iter != null && iter.hasNext();) {
-                OMAttribute attr = (OMAttribute) iter.next();
+            for (Iterator it = element.getAllAttributes(); it.hasNext(); ) {
+                OMAttribute attr = (OMAttribute) it.next();
                 if (attr.getNamespace() != null) {
                     addNamespaceToMap(attr.getNamespace(), nsMap);
                 }