manifoldcf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Furkan KAMACI (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CONNECTORS-1304) ban usage of String.toUpperCase() without Locale
Date Sun, 14 Aug 2016 12:28:20 GMT

    [ https://issues.apache.org/jira/browse/CONNECTORS-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15420314#comment-15420314
] 

Furkan KAMACI commented on CONNECTORS-1304:
-------------------------------------------

{quote}
You can pass a locale to String.toLowerCase(), so the naive approach would be to tell Java,
that we are in the US or using the English language: String.toLowerCase(Locale.US) or String.toLowerCase(Locale.ENGLISH).
This produces identical results but is still not consistent. What happens if the US government
decides to lowercase/uppercase like in Turkey? -- OK, don’t use Locale.US (this is also
too US-centric). Locale.ENGLISH is fine and very generic, but languages also change over the
years (who knows?), but we want to have it language invariant! If you are using Java 6, there
is a much better constant: Locale.ROOT -- You should use this constant for our lowercase example:
String.toLowerCase(Locale.ROOT).
{quote}

You can get more info from here: https://dzone.com/articles/policemans-horror-default

By the way do I need a write right for this page: https://cwiki.apache.org/confluence/display/CONNECTORS/HowToContribute

> ban usage of String.toUpperCase() without Locale
> ------------------------------------------------
>
>                 Key: CONNECTORS-1304
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-1304
>             Project: ManifoldCF
>          Issue Type: Improvement
>          Components: SearchBlox connector
>    Affects Versions: ManifoldCF 2.4
>            Reporter: Ahmet Arslan
>            Assignee: Ahmet Arslan
>             Fix For: ManifoldCF 2.5
>
>
> When relied on the default Locale, toUpperCase() is not reliable. For example: In SearchBloxConnector.java,
"title_boost".toUpperCase() will yield {{TİTLE_BOOST}} on Turkish Locale and won't match
{{TITLE_BOOST}}. We should prevent this in a more permanent way. I would like to integrate
Uwe's [forbidden apis|https://github.com/policeman-tools/forbidden-apis] when I have time.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message