[ 
https://issues.apache.org/jira/browse/OODT-582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ross Laidlaw closed OODT-582.
-----------------------------

    
> readTags creates empty source attributes for all tags defined in the RSS 
> configuration file
> -------------------------------------------------------------------------------------------
>
>                 Key: OODT-582
>                 URL: https://issues.apache.org/jira/browse/OODT-582
>             Project: OODT
>          Issue Type: Sub-task
>          Components: product server
>    Affects Versions: 0.6
>            Reporter: Ross Laidlaw
>            Assignee: Ross Laidlaw
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: OODT-582.rlaidlaw.2013-03-23.patch.txt
>
>
> 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:
> {code:title=RSSConfigReader.java|borderStyle=solid}
> protected static void readTags(Element root, RSSConfig conf)
> {
>   ...
>   if (tagElem.getAttribute(TAG_ATTR_SOURCE) != null)
>   {
>     tag.setSource(tagElem.getAttribute(TAG_ATTR_SOURCE));
>   }
>   ...
> }
> {code}
> Instead the getAttribute method returns an [empty 
> String|http://docs.oracle.com/javase/1.5.0/docs/api/org/w3c/dom/Element.html#getAttribute(java.lang.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|http://docs.oracle.com/javase/1.5.0/docs/api/org/w3c/dom/Element.html#getAttributeNode(java.lang.String)].
>   This method takes the attribute name as a String argument and returns null 
> if the attribute does not exist for the element.
> {code:title=RSSConfigReader.java|borderStyle=solid}
> protected static void readTags(Element root, RSSConfig conf)
> {
>   ...
>   if (tagElem.getAttributeNode(TAG_ATTR_SOURCE) != null)
>   {
>     tag.setSource(tagElem.getAttribute(TAG_ATTR_SOURCE));
>   }
>   ...
> }
> {code}
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to