sjsxp
  1. sjsxp
  2. SJSXP-29

IllegalArgumentException not thrown for getProperty() on XMLStreamReaderImpl

    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:
      29

      Description

      Currently SJSXP returns null for XMLStreamReaderImpl.getProperty(String) when
      an unsupported property is passed in.

      The specification does not make it explicit that for the reader an
      IllegalArgumentException should be thrown. However it does make it explicit for
      XMLStreamWriter.getProperty().

      I believe this is a bug in the specification hence why this is filed as a
      defect.

      Unit test:

      public void testGetPropertyWithUnsupportedProperty() throws Exception
      {
      String xml = "<root></root>";
      XMLInputFactory factory = XMLInputFactory.newInstance();
      XMLStreamReader r = factory.createXMLStreamReader( new StringReader(
      xml ) );
      try

      { r.getProperty( "BadProperty" ); fail( "Expecting IllegalArgumentException" ); }

      catch( IllegalArgumentException iae )

      { // expected }

      }

        Activity

        Hide
        Santiago Pericas-Geertsen added a comment -

        Throwing an exception seems more appropriate in this case.

        Show
        Santiago Pericas-Geertsen added a comment - Throwing an exception seems more appropriate in this case.
        Hide
        Joe Wang added a comment -

        Yes, we agree that throwing an exception would be more appropriate in this case.
        Unfortunately we couldn't fix this until the spec is fixed. But thanks for
        bringing up the issue.

        Show
        Joe Wang added a comment - Yes, we agree that throwing an exception would be more appropriate in this case. Unfortunately we couldn't fix this until the spec is fixed. But thanks for bringing up the issue.

          People

          • Assignee:
            Joe Wang
            Reporter:
            jeffrey_sinclair
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: