Uploaded image for project: 'OODT'
  1. OODT
  2. OODT-458 Allow XML namespaces to be defined in the RSS configuration file for the CAS REST service ('fmprod' webapp)
  3. OODT-582

readTags creates empty source attributes for all tags defined in the RSS configuration file

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 0.6
    • Component/s: product server
    • Labels:
      None

      Description

      The following code in the readTags method in the org.apache.oodt.cas.product.rss.RSSConfigReader class assumes that org.w3c.dom.Element.getAttribute(String name) will return null if a tag does not have a 'source' attribute definition in the RSS configuration file:

      RSSConfigReader.java
      protected static void readTags(Element root, RSSConfig conf)
      {
        ...
      
        if (tagElem.getAttribute(TAG_ATTR_SOURCE) != null)
        {
          tag.setSource(tagElem.getAttribute(TAG_ATTR_SOURCE));
        }
      
        ...
      }
      

      Instead the getAttribute method returns an empty String. This means that by default readTags will give every tag a blank source attribute.

      We could change the above to use another method getAttributeNode. This method takes the attribute name as a String argument and returns null if the attribute does not exist for the element.

      RSSConfigReader.java
      protected static void readTags(Element root, RSSConfig conf)
      {
        ...
      
        if (tagElem.getAttributeNode(TAG_ATTR_SOURCE) != null)
        {
          tag.setSource(tagElem.getAttribute(TAG_ATTR_SOURCE));
        }
      
        ...
      }
      

      With the above change, if any tags in the RSS configuration file have an explicitly defined empty source attribute (e.g. <tag name="example" source=""/>), readTags will add the empty source attribute to the attribute list for the tag. But if a tag does not have an explicit source attribute definition, readTags will no longer create a blank source attribute for the tag.

        Attachments

          Activity

            People

            • Assignee:
              rlaidlaw Ross Laidlaw
              Reporter:
              rlaidlaw Ross Laidlaw
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: