Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4431468

Element.removeAttribute() throws DOMException with undeclared code

XMLWordPrintable

    • 1.1.1
    • generic
    • generic
    • Verified



        Name: eaR10174 Date: 03/28/2001


          The implementation of the method org.w3c.dom.Element.removeAttribute() throws
        DOMException with NOT_FOUND_ERR code (See test.java below), but the definition of
        this method doesn't declare such code
        (http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614):
          
          "removeAttribute
               .....
               Exceptions
                   DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
                   readonly."

          The bug has appeared since the build jaxp-1_1-ea-bin-b07-02_oct_2000 till the build
        jaxp-1.1.1-b23-23_mar_2001 and affects the old tests in TCK JAXP 1.1
         
             /api/com/sun/xml/tests/dom/ElementTest.html#removeAttribute0002
             /api/com/sun/xml/tests/dom/ElementTest.html#removeAttribute0003

         
        ------------------------------------test.java-----------------------------
        import org.w3c.dom.Document;
        import org.w3c.dom.Element;
        import org.w3c.dom.DOMException;
        import javax.xml.parsers.DocumentBuilderFactory;
        import javax.xml.parsers.DocumentBuilder;

        public class test {
            
            public static void main(String argv[]) {
                try {
                    Document document = DocumentBuilderFactory.newInstance()
                                            .newDocumentBuilder().newDocument();
                                       
                    Element element = document.createElement("test");
                    element.setAttribute("attr", "");
                    
                    element.removeAttribute("att");
                    
                } catch (DOMException e) {
                    if (e.code == DOMException.NOT_FOUND_ERR) {
                        System.out.println("DOMException with NOT_FOUND_ERR code.");
                    }
                } catch (Exception e) {
                    System.out.println("Exception: " + e);
                }
            }
        }
        ---------------------------------------------------------------------------
        ---------------------------------------------------------------------------
        % java -showversion -cp .:jaxp1.1.1/jaxp.jar:jaxp1.1.1/crimson.jar test
        java version "1.3.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
        Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)

        DOMException with NOT_FOUND_ERR code.
        --------------------------------------------------------------------------

        ======================================================================

              egoei Edwin Goei (Inactive)
              evgsunw Evg Evg (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: