chukwa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guille -bisho- (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CHUKWA-463) Improve pattern for getTag() method
Date Thu, 11 Mar 2010 16:12:27 GMT

    [ https://issues.apache.org/jira/browse/CHUKWA-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844106#action_12844106
] 

Guille -bisho- commented on CHUKWA-463:
---------------------------------------

Damm! I'm sorry. This may break things.

I'm not expert in java regexp, and I didn't notice that matches only matches if the full string
starts with tagName="...

For a regular expresion that can match in the middle of a string, we need to do a matcher.find()
instead.

I re-atach a diff.

> Improve pattern for getTag() method
> -----------------------------------
>
>                 Key: CHUKWA-463
>                 URL: https://issues.apache.org/jira/browse/CHUKWA-463
>             Project: Hadoop Chukwa
>          Issue Type: Improvement
>          Components: Data Processors
>            Reporter: Guille -bisho-
>         Attachments: improve_tags_pattern.diff
>
>
> The current pattern used for extracting tags from the tags field:
>     Pattern tagPattern = Pattern.compile(".*"+tagName+"=\"(.*?)\".*");
> Doesn't work very well. If you pass tagName "bar", will also match (and return) the content
of foobar="dssad" tag.
> The proposed path is more correct, and also faster than using .*

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message