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

Add XPathFactory setProperty and getProperty methods

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 18
    • Component/s: xml
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      source, behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      None. Adding new methods to the abstract XPathFactory class with default implementation. This change has no requirement for implementations and does not affect applications.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Add XPathFactory setProperty and getProperty methods.

      Problem

      The XPathFactory is the only one among XML factories that is missing the setProperty and getProperty methods, that makes it impossible to set any properties to the XPath processor through the API.

      The setFeature method was described as it could be used to "set a feature for this XPathFactory and XPaths created by this factory". This message can be misinterpreted as if a feature may be effective to any existing XPath objects. It's desirable to clarify the javadoc.

      Solution

      Add the setProperty and getProperty methods to XPathFactory.

      Clarify that a feature set through the setFeature method is effective to the XPath object created after the feature is set, but not any that may be created beforehand.

      Specification

      javax.xml.xpath
      
      public abstract class XPathFactory

      setProperty

      public void setProperty(String name, String value)
      
      Sets a property for this XPathFactory. The property applies to XPath objects that the XPathFactory creates. 
      It has no impact on XPath objects that are already created.
      
      A property can either be defined in this XPathFactory, or by the underlying implementation.
      
      Implementation Requirements:
          The default implementation throws UnsupportedOperationException.
      Parameters:
          name - the property name
          value - the value for the property
      Throws:
          IllegalArgumentException - if the property name is not recognized, or the value can not be assigned
          UnsupportedOperationException - if the implementation does not support the method
          NullPointerException - if the name is null. 
      
      Since:
          18

      getProperty

      public String getProperty(String name)
      
      Returns the value of the specified property.
      
      Implementation Requirements:
          The default implementation throws UnsupportedOperationException.
      Parameters:
          name - the property name
      Returns:
          the value of the property.
      Throws:
          IllegalArgumentException - if the property name is not recognized
          UnsupportedOperationException - if the implementation does not support the method
          NullPointerException - if the name is null. 
      
      Since:
          18

      setFeature javadoc clarification

      -   Set a feature for this XPathFactory and XPaths created by this factory.
      +   Sets a feature for this XPathFactory. The feature applies to XPath objects 
      +   that the XPathFactory creates. It has no impact on XPath objects that are
      +   already created.
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              joehw Joe Wang
              Reporter:
              joehw Joe Wang
              Reviewed By:
              Iris Clark, Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: