You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by "JC (JIRA)" <ji...@apache.org> on 2017/04/18 19:31:41 UTC

[jira] [Created] (STANBOL-1461) Possible code smell that returns always true in conditions

JC created STANBOL-1461:
---------------------------

             Summary: Possible code smell that returns always true in conditions
                 Key: STANBOL-1461
                 URL: https://issues.apache.org/jira/browse/STANBOL-1461
             Project: Stanbol
          Issue Type: Bug
          Components: Commons, Enhancer
            Reporter: JC
            Priority: Trivial


Hi

In a recent code snapshot from GitHub, I've found following suspicious code.

Path: commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/standalone/ClassPathDataFileProvider.java
{code}
101     private URL getDataFile(String bundleSymbolicName, String filename) {
102         //if the parsed bundleSymbolicName is null accept any request
103         //if not, than check if the request is from the correct bundle.
104         if(bundleSymbolicName != null && !bundleSymbolicName.equals(bundleSymbolicName)) {
105             log.debug("Requested bundleSymbolicName {} does not match mine ({}), request ignored",
106                     bundleSymbolicName, symbolicName);
107             return null;
108         }
{code}
In Line 104, bundleSymbolicName.equals(bundleSymbolicName) should be bundleSymbolicName.equals(*symbolicName*)?

Path: enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/PosTagSupport.java
{code}
135         public boolean equals(Object obj) {
136             return obj instanceof PosTagInfo && tag.equals(tag) &&
137                     categories.equals(categories) && pos.equals(pos);
138         }
{code}
In Line 136 and 137, there are conditions comparing the same objects.

These might not be issue if the code is not playable in real world. But wanted to report just in case. Thanks! 



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