sjsxp
  1. sjsxp
  2. SJSXP-20

IllegalStateException not thrown for illegal states when XMLStreamReader.getNamespaceURI() is called

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      20

      Description

      StAX specification states that an IllegalStateException should be thrown if
      XMLStreamReader.getNamespaceURI() is called when not on START_ELEMENT,
      END_ELEMENT or ATTRIBUTE.

      Current XMLStreamReaderImpl returns null.

      Unit test example using START_DOCUMENT:

      public void testGetNamespaceURIOnStartDocumentEvent() throws Exception

      { String xml = "<root></root>"; XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader r = factory.createXMLStreamReader( new StringReader( xml ) ); r.require( XMLStreamReader.START_DOCUMENT, null, null); r.getNamespaceURI(); fail("Expecting IllegalStateException"); }

        Activity

        Hide
        Santiago Pericas-Geertsen added a comment -

        It actually says that for getNamespaceURI(int) not getNamespaceURI(), strangely. I'll have a look anyway,
        but the test does not appear to be valid.

        Show
        Santiago Pericas-Geertsen added a comment - It actually says that for getNamespaceURI(int) not getNamespaceURI(), strangely. I'll have a look anyway, but the test does not appear to be valid.
        Hide
        Santiago Pericas-Geertsen added a comment -

        Although I agree that to be consistent it should throw an IllegalStateException,
        the spec does not say that for getNamespaceURI(), as I indicated in my evaluation.

        Show
        Santiago Pericas-Geertsen added a comment - Although I agree that to be consistent it should throw an IllegalStateException, the spec does not say that for getNamespaceURI(), as I indicated in my evaluation.

          People

          • Assignee:
            Santiago Pericas-Geertsen
            Reporter:
            jeffrey_sinclair
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: