cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcus Eriksson (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-15033) Refactor to singleQuote reuse java.util.regex.Pattern instead of String.replaceAll for TableCQLHelper.java
Date Fri, 08 Mar 2019 09:11:00 GMT

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

Marcus Eriksson updated CASSANDRA-15033:
----------------------------------------
       Resolution: Fixed
    Fix Version/s: 4.0
           Status: Resolved  (was: Patch Available)

tests look fine: https://circleci.com/workflow-run/1632a420-ba67-437c-9b23-1bc07484a1ce

and committed as {{fd860b953ff1cea85e66577bac3f866935cf715b}}, thanks!

> Refactor to singleQuote reuse java.util.regex.Pattern instead of String.replaceAll for
TableCQLHelper.java
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-15033
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15033
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Interpreter
>            Reporter: DaeMyung Kang
>            Assignee: DaeMyung Kang
>            Priority: Trivial
>             Fix For: 4.0
>
>         Attachments: patch-15033.patch
>
>
> singleQuote uses `String.replaceAll ()` a lot in loop.
> and 'String.replaceAll()' compiles the regular expression each time it is called.
>  
> {code:java}
> public String replaceAll(String regex, String replacement) {
>     return Pattern.compile(regex).matcher(this).replaceAll(replacement);
>  }{code}
>  
> It is suggested in javadoc (https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#matches(java.lang.String,%20java.lang.CharSequence))
that it is efficient to reuse the pattern.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message