[ https://issues.apache.org/jira/browse/ATLAS-1887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16054897#comment-16054897 ]
David Radley commented on ATLAS-1887: ------------------------------------- https://reviews.apache.org/r/60213 > Coverity Scan defects in AtlasRelationshipType > ---------------------------------------------- > > Key: ATLAS-1887 > URL: https://issues.apache.org/jira/browse/ATLAS-1887 > Project: Atlas > Issue Type: Bug > Reporter: David Radley > Assignee: David Radley > > 3 new defect(s) introduced to Apache Atlas found with Coverity Scan. > 3 defect(s), reported by Coverity Scan earlier, were marked fixed in the > recent build analyzed by Coverity Scan. > > New defect(s) Reported-by: Coverity Scan > Showing 3 of 3 defect(s) > > > ** CID 164610: (REVERSE_INULL) > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 140 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 147 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > > > > ________________________________________________________________________________________________________ > *** CID 164610: (REVERSE_INULL) > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 140 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > 134 // composition containers should not be multiple > cardinality > 135 if (endDef1 != null && > 136 endDef1.getCardinality() == > AtlasAttributeDef.Cardinality.SET && > 137 endDef1.getIsContainer()) { > 138 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER, > name); > 139 } > >>> CID 164610: (REVERSE_INULL) > >>> Null-checking "endDef2" suggests that it may be null, but it has > already been dereferenced on all paths leading to the check. > 140 if (endDef2 != null && endDef2 != null && > 141 endDef2.getCardinality() == > AtlasAttributeDef.Cardinality.SET && > 142 endDef2.getIsContainer()) { > 143 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER, > name); > 144 } > 145 } > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 147 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > 141 endDef2.getCardinality() == > AtlasAttributeDef.Cardinality.SET && > 142 endDef2.getIsContainer()) { > 143 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER, > name); > 144 } > 145 } > 146 if ((endDef1 != null && endDef1.getCardinality() == > AtlasAttributeDef.Cardinality.LIST) || > >>> CID 164610: (REVERSE_INULL) > >>> Null-checking "endDef2" suggests that it may be null, but it has > already been dereferenced on all paths leading to the check. > 147 (endDef2 != null && endDef2.getCardinality() == > AtlasAttributeDef.Cardinality.LIST)) { > 148 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_LIST_ON_END, name); > 149 } > 150 } > > ** CID 164609: (REVERSE_INULL) > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 135 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 146 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > > > > ________________________________________________________________________________________________________ > *** CID 164609: (REVERSE_INULL) > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 135 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > 129 // AGGREGATION needs one end to be the container. > 130 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_AGGREGATION_NO_CONTAINER, > name); > 131 } > 132 } > 133 if (relationshipCategory == > RelationshipCategory.COMPOSITION) { > 134 // composition containers should not be multiple > cardinality > >>> CID 164609: (REVERSE_INULL) > >>> Null-checking "endDef1" suggests that it may be null, but it has > already been dereferenced on all paths leading to the check. > 135 if (endDef1 != null && > 136 endDef1.getCardinality() == > AtlasAttributeDef.Cardinality.SET && > 137 endDef1.getIsContainer()) { > 138 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER, > name); > 139 } > 140 if (endDef2 != null && endDef2 != null && > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 146 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > 140 if (endDef2 != null && endDef2 != null && > 141 endDef2.getCardinality() == > AtlasAttributeDef.Cardinality.SET && > 142 endDef2.getIsContainer()) { > 143 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER, > name); > 144 } > 145 } > >>> CID 164609: (REVERSE_INULL) > >>> Null-checking "endDef1" suggests that it may be null, but it has > already been dereferenced on all paths leading to the check. > 146 if ((endDef1 != null && endDef1.getCardinality() == > AtlasAttributeDef.Cardinality.LIST) || > 147 (endDef2 != null && endDef2.getCardinality() == > AtlasAttributeDef.Cardinality.LIST)) { > 148 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_LIST_ON_END, name); > 149 } > 150 } > > ** CID 164608: Incorrect expression (CONSTANT_EXPRESSION_RESULT) > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 140 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > > > > ________________________________________________________________________________________________________ > *** CID 164608: Incorrect expression (CONSTANT_EXPRESSION_RESULT) > /intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java: 140 > in > org.apache.atlas.type.AtlasRelationshipType.validateAtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef)() > 134 // composition containers should not be multiple > cardinality > 135 if (endDef1 != null && > 136 endDef1.getCardinality() == > AtlasAttributeDef.Cardinality.SET && > 137 endDef1.getIsContainer()) { > 138 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER, > name); > 139 } > >>> CID 164608: Incorrect expression (CONSTANT_EXPRESSION_RESULT) > >>> The expression "endDef2 != null && endDef2 != null" does not > accomplish anything because it evaluates to either of its identical operands, > "endDef2 != null". > 140 if (endDef2 != null && endDef2 != null && > 141 endDef2.getCardinality() == > AtlasAttributeDef.Cardinality.SET && > 142 endDef2.getIsContainer()) { > 143 throw new > AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER, > name); > 144 } > 145 } > > > > ________________________________________________________________________________________________________ > To view the defects in Coverity Scan visit, > https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZSbhom32dlDl11LWEm9nX1nbwG-2F526MSwix34kV0EOH7g-2BScYg5Neu8mhD8p0GzKU-3D_LnAJ35ABvEvOrnniInKJw2EvFzzVWfd-2BYI3WJ8Im3vFjv7nQi-2FhPeGs-2Bv3qPna2I6Y-2F7ecykkKAz5Btym6eHO6v14SxBHNQMDjHcwuFsEEIBSrAK2Xd-2F1L4ny-2FQ3C-2FOLoWO8GpziJWFLmb3K0s1aQnM2lEV11ajexLy6ekTq7nINf3awkvo06fZ9jSS-2FBWjQvc7E87EmuUGuQXe-2BaEKF-2FKn7-2F4yuC-2BUmhljwyUJ5JgE-3D > > To manage Coverity Scan email notifications for > "mneethi...@hortonworks.com", click > https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq47mxskBQgxRJXpeEpoMwX0McAuDRyJUckvXbF17DhDLsPMLsQ8vjMxWA8prVpW8XFQLFUT1SyR1J0pL1yCZ20nVmr2nMWjTeARQKttMH-2FASk-3D_LnAJ35ABvEvOrnniInKJw2EvFzzVWfd-2BYI3WJ8Im3vFjv7nQi-2FhPeGs-2Bv3qPna2I6Y-2F7ecykkKAz5Btym6eHO-2BujkcXEuavEzmld5L8FZavbTJfsUoriHPgVIOE6W4caMNy4himirewJiif1kkYU937wVH4wxiaCodaVShDjkSaAppl0cCQhNrwam7lyKNDziisDteLjOFzuqcos-2BAeuh6yikM25iqIJvuoelo-2FOF3o-3D > -- This message was sent by Atlassian JIRA (v6.4.14#64029)