[jira] Created: (GEOT-2604) ExpressionDOMParser does not handle empty Literals well

1 message Options
Embed this post
Permalink
JIRA jira@codehaus.org

[jira] Created: (GEOT-2604) ExpressionDOMParser does not handle empty Literals well

Reply Threaded More More options
Print post
Permalink
ExpressionDOMParser does not handle empty Literals well
-------------------------------------------------------

                 Key: GEOT-2604
                 URL: http://jira.codehaus.org/browse/GEOT-2604
             Project: GeoTools
          Issue Type: Bug
          Components: core main
    Affects Versions: 2.6-M1
            Reporter: Milton Jonathan
            Assignee: Jody Garnett
            Priority: Minor
         Attachments: geotools-tecgraf.2.6.x.expression_parser_with_empty_literals.patch

If passing a tag of the kind "<Literal/>", then the method ExpressionDOMParser.expression(Node root) does not recognize it as anything useful and ends up return null. This has the effect of making FilterDOMParser.parseFilter() throw a NullPointException when parsing a Filter like the following:
    <PropertyIsEqualTo>
        <PropertyName>my_attribute</PropertyName>
        <Literal/>
    </PropertyIsEqualTo>

I am not really sure what should be the correct behavior, but I think it should at least be a Literal (and certainly not null!). In the case above, the idea was to have a Filter for features whose specified attribute is the empty string (""). Both CQL.toFilter(" my_attribute = ' '  ") and  filterFactory.equals(filterFactory.literal("my_attribute"), filterFactory.literal("")) yield filters that generate <Literal/>, so I thought it would be reasonable to have that back when deserializing.
A simple patch is provided to fix the issue in this manner (sorry, no time for nice test cases..)


--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Geotools-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel