Issue Type: Bug Bug
Affects Versions: 10.4, 11-beta
Assignee: Jody Garnett
Components: main
Created: 25/Jan/14 4:11 AM
Description:

3The pattern used in SimpleFeaturePropertyAccessorFactory to match property id is seriously flawed. It will accept strings as "===" or "34x?<>".
The comment says it is based on http://www.w3.org/TR/xml/#NT-Name so I looked up the spec and compared it with the pattern and I found following problems:

  • \\u00C0\\u00D6 - should be \\u00C0-\\u00D6,
  • \\u00C0\\u00D6 - is actually the same as \\u00C0-\\u00D6 which is used in the spec, but for the sake of consistency should be \\u00C0-\\u00D6,
  • \\x10000-\\xEFFFF - a very serious one, more on this later,
  • \\\\x10000-\\\\xEFFFF - another serious one.

\\x10000-\\xEFFFF is equivalent to: #x10 | "0" | "0" | 0-#xEF | "F" | "F" | "F"
According to the java.util.regex.Pattern javadoc the construct is \xhh so only two characters after \x are treated as a hexadecimal code, the rest are matched as-is so \\x10000-\\xEFFFF allows for \n (#x10) and any character between 0 and #xEF

\\\\x10000-\\\\xEFFFF is equivalent to: "\" | "x" | "1" | "0" | "0" | "0" | 0-&#92; | "x" | "E" | "F" | "F" | "F" | "F"
\\\\ ends as \\ and in a regular _expression_ it matches "\" character. This range allows for any character beteween 0 and \.

As Java character is only 16 bit wide the unicode characters in range #x10000-#xEFFFF cannot be represented as single Java characters. For this reason it is not possible (or at least not easy) to create regular _expression_ which would match such characters. To properly process such unicode strings one has to use codePoint* methods of the String class and not the character based ones.

Project: GeoTools
Priority: Major Major
Reporter: Sebastian Graca
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
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to