Marcono1234 created HDFS-15844:
----------------------------------

             Summary: TestPlanner uses wrong regex pattern
                 Key: HDFS-15844
                 URL: https://issues.apache.org/jira/browse/HDFS-15844
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: Marcono1234


The test class {{org.apache.hadoop.hdfs.server.diskbalancer.TestPlanner}} uses 
multiple times the regex patterns:
{code}
33.[2|3|4] G
{code}
{code}
18.[6|7|8] G
{code}
There are two issues with this:
- {{.}} matches any character, however it appears the test expects a literal 
{{.}}, therefore it should escape it:
{code}
\.
{code}
- {{[...]}} is a character class which matches any of the contained characters 
litereally (with some exceptions). Therefore this allows the character {{|}} 
literally, and duplicates it even though listing it once would be enough. The 
tests probably expect only one of the numbers, so {{|}} should be removed:
{code}
[234]
{code}

To demonstrate that the patterns are incorrect:
{code}
String invalid = "33@| G";
invalid.matches("33.[2|3|4] G");
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org

Reply via email to