You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by "Ashutosh Mestry (JIRA)" <ji...@apache.org> on 2017/02/24 17:24:44 UTC

[jira] [Created] (ATLAS-1594) Coverity Scan Issues Detected on 2/22

Ashutosh Mestry created ATLAS-1594:
--------------------------------------

             Summary: Coverity Scan Issues Detected on 2/22
                 Key: ATLAS-1594
                 URL: https://issues.apache.org/jira/browse/ATLAS-1594
             Project: Atlas
          Issue Type: Bug
          Components:  atlas-core
    Affects Versions: 0.8-incubating
            Reporter: Ashutosh Mestry
            Assignee: Ashutosh Mestry
             Fix For: 0.8-incubating


Following issues were discovered during the 2/22 Coverity Scan:
6 new defect(s) introduced to Apache Atlas found with Coverity Scan.
            5 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 6 of 6 defect(s)
            
            
            ** CID 156377:  Null pointer dereferences  (NULL_RETURNS)
            /webapp/src/main/java/org/apache/atlas/web/resources/ExportService.java: 231 in org.apache.atlas.web.resources.ExportService.initScriptEngine()()
            
            
            ________________________________________________________________________________________________________
            *** CID 156377:  Null pointer dereferences  (NULL_RETURNS)
            /webapp/src/main/java/org/apache/atlas/web/resources/ExportService.java: 231 in org.apache.atlas.web.resources.ExportService.initScriptEngine()()
            225             if (scriptEngineManager != null) {
            226                 return;
            227             }
            228    
            229             scriptEngineManager = new ScriptEngineManager();
            230             scriptEngine = scriptEngineManager.getEngineByName("gremlin-groovy");
            >>>     CID 156377:  Null pointer dereferences  (NULL_RETURNS)
            >>>     Calling a method on null object "scriptEngine".
            231             bindings = scriptEngine.createBindings();
            232    
            233             //Do not cache script compilations due to memory implications
            234             scriptEngine.getContext().setAttribute("#jsr223.groovy.engine.keep.globals", "phantom", ScriptContext.ENGINE_SCOPE);
            235         }
            
            ** CID 156376:  Null pointer dereferences  (NULL_RETURNS)
            
            
            ________________________________________________________________________________________________________
            *** CID 156376:  Null pointer dereferences  (NULL_RETURNS)
            /webapp/src/main/java/org/apache/atlas/web/resources/ImportService.java: 61 in org.apache.atlas.web.resources.ImportService.run(org.apache.atlas.web.resources.ZipSource, org.apache.atlas.model.impexp.AtlasImportRequest, java.lang.String, java.lang.String, java.lang.String)()
            55             AtlasImportResult result = new AtlasImportResult(request, userName, requestingIP, hostName, System.currentTimeMillis());
            56    
            57             try {
            58                 LOG.info("==> import(user={}, from={})", userName, requestingIP);
            59    
            60                 startTimestamp = System.currentTimeMillis();
            >>>     CID 156376:  Null pointer dereferences  (NULL_RETURNS)
            >>>     Dereferencing a pointer that might be null "source.getTypesDef()" when calling "processTypes".
            61                 processTypes(source.getTypesDef(), result);
            62                 processEntities(source, result);
            63    
            64                 result.setOperationStatus(AtlasImportResult.OperationStatus.SUCCESS);
            65             } catch (AtlasBaseException excp) {
            66                 LOG.error("import(user={}, from={}): failed", userName, requestingIP, excp);
            
            ** CID 156375:  Null pointer dereferences  (NULL_RETURNS)
            /webapp/src/main/java/org/apache/atlas/web/resources/ZipSource.java: 67 in org.apache.atlas.web.resources.ZipSource.setCreationOrder()()
            
            
            ________________________________________________________________________________________________________
            *** CID 156375:  Null pointer dereferences  (NULL_RETURNS)
            /webapp/src/main/java/org/apache/atlas/web/resources/ZipSource.java: 67 in org.apache.atlas.web.resources.ZipSource.setCreationOrder()()
            61         private void setCreationOrder() {
            62             String fileName = ZipExportFileNames.ATLAS_EXPORT_ORDER_NAME.toString();
            63    
            64             try {
            65                 String s = getFromCache(fileName);
            66                 this.creationOrder = convertFromJson(new TypeReference<List<String>>(){}, s);
            >>>     CID 156375:  Null pointer dereferences  (NULL_RETURNS)
            >>>     Calling a method on null object "this.creationOrder".
            67                 this.iterator = this.creationOrder.iterator();
            68             } catch (AtlasBaseException e) {
            69                 LOG.error(String.format("Error retrieving '%s' from zip.", fileName), e);
            70             }
            71         }
            72    
            
            ** CID 156374:  Null pointer dereferences  (NULL_RETURNS)
            /repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java: 159 in org.apache.atlas.repository.store.graph.v1.AtlasEntityChangeNotifier.doFullTextMapping(java.util.List)()
            
            
            ________________________________________________________________________________________________________
            *** CID 156374:  Null pointer dereferences  (NULL_RETURNS)
            /repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java: 159 in org.apache.atlas.repository.store.graph.v1.AtlasEntityChangeNotifier.doFullTextMapping(java.util.List)()
            153                 }
            154             } catch (AtlasException e) {
            155                 LOG.warn("Unable to determine if FullText is disabled. Proceeding with FullText mapping");
            156             }
            157    
            158             for (AtlasEntityHeader atlasEntityHeader : atlasEntityHeaders) {
            >>>     CID 156374:  Null pointer dereferences  (NULL_RETURNS)
            >>>     Assigning: "atlasVertex" = null return value from "findByGuid".
            159                 AtlasVertex atlasVertex = AtlasGraphUtilsV1.findByGuid(atlasEntityHeader.getGuid());
            160                 try {
            161                     String fullText = fullTextMapper.mapRecursive(atlasVertex, true);
            162                     GraphHelper.setProperty(atlasVertex, Constants.ENTITY_TEXT_PROPERTY_KEY, fullText);
            163                 } catch (AtlasException e) {
            164                     LOG.error("FullText mapping failed for Vertex[ guid = {} ]", atlasEntityHeader.getGuid());
            165                 }
            166             }
            167         }
            
            ** CID 156373:  Null pointer dereferences  (NULL_RETURNS)
            /repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java: 154 in org.apache.atlas.repository.store.graph.v1.AtlasEntityStoreV1.bulkImport(org.apache.atlas.repository.store.graph.v1.EntityStream, org.apache.atlas.model.impexp.AtlasImportResult)()
            
            
            ________________________________________________________________________________________________________
            *** CID 156373:  Null pointer dereferences  (NULL_RETURNS)
            /repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java: 154 in org.apache.atlas.repository.store.graph.v1.AtlasEntityStoreV1.bulkImport(org.apache.atlas.repository.store.graph.v1.EntityStream, org.apache.atlas.model.impexp.AtlasImportResult)()
            148             Set<String> processedGuids          = new HashSet<>();
            149             int         progressReportedAtCount = 0;
            150    
            151             while (entityStream.hasNext()) {
            152                 AtlasEntity entity = entityStream.next();
            153    
            >>>     CID 156373:  Null pointer dereferences  (NULL_RETURNS)
            >>>     Calling a method on null object "entity".
            154                 if(processedGuids.contains(entity.getGuid())) {
            155                     continue;
            156                 }
            157    
            158                 AtlasEntityStreamForImport oneEntityStream = new AtlasEntityStreamForImport(entity, entityStream);
            159    
            
            ** CID 156372:  Control flow issues  (DEADCODE)
            /webapp/src/main/java/org/apache/atlas/web/resources/ZipSource.java: 83 in org.apache.atlas.web.resources.ZipSource.updateGuidZipEntryMap()()
            
            
            ________________________________________________________________________________________________________
            *** CID 156372:  Control flow issues  (DEADCODE)
            /webapp/src/main/java/org/apache/atlas/web/resources/ZipSource.java: 83 in org.apache.atlas.web.resources.ZipSource.updateGuidZipEntryMap()()
            77             ZipInputStream zipInputStream = new ZipInputStream(inputStream);
            78             ZipEntry zipEntry = zipInputStream.getNextEntry();
            79             while (zipEntry != null) {
            80                 String entryName = zipEntry.getName().replace(".json", "");
            81    
            82                 if (guidEntityJsonMap.containsKey(entryName)) continue;
            >>>     CID 156372:  Control flow issues  (DEADCODE)
            >>>     Execution cannot reach this statement: "continue;".
            83                 if (zipEntry == null) continue;
            84    
            85                 byte[] buf = new byte[1024];
            86    
            87                 int n = 0;
            88                 ByteArrayOutputStream bos = new ByteArrayOutputStream();
            



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