AppChecker created CMIS-1014:
--------------------------------

             Summary: Incorrect validation: sub-expression is always false
                 Key: CMIS-1014
                 URL: https://issues.apache.org/jira/browse/CMIS-1014
             Project: Chemistry
          Issue Type: Bug
          Components: opencmis-server
    Affects Versions: OpenCMIS 1.0.0
            Reporter: AppChecker


Hi!

There is 
[condition|https://github.com/apache/chemistry-opencmis/blob/48ec4de7547025fdca1d10c6bee439751373ecbd/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java#L75]:
{code:xml}
           if (c == '\\' || c == '/' || c == '\"' || c == ':' || c == '*' || c 
== '?' || c == '<' || c == '>'
                    && c == '|') {
                return false;
            }
{code}

This expression is equivalent to:
(c == '\\' || c == '/' || c == '\"' || c == ':' || c == '*' || c == '?' || c == 
'<' ||  ( c == '>'
                    && c == '|' )  )
but
(c == '>' && c == '|') is always false.
So, condition is equivalent to
(c == '\\' || c == '/' || c == '\"' || c == ':' || c == '*' || c == '?' || c == 
'<'  || false)
or
(c == '\\' || c == '/' || c == '\"' || c == ':' || c == '*' || c == '?' || c == 
'<' )

Probably need to replace the '&' to '||'


This possible defect found by 
[AppChecker|https://cnpo.ru/en/solutions/appchecker.php]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to