XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.6
    • 0.6
    • product server
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: