#vulnerable code 
                                private ResponseEntity<String> savedFloorAndUnitInfo(IPageData pd, List<ImportFloor> floors, ComponentValidateResult result) {
        String apiUrl = "";
        JSONObject paramIn = null;
        ResponseEntity<String> responseEntity = null;
        for (ImportFloor importFloor : floors) {
            paramIn = new JSONObject();
            //先保存 楼栋信息
            JSONObject savedFloorInfo = getExistsFloor(pd, result, importFloor);
            // 如果不存在，才插入
            if (savedFloorInfo == null) {
                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.saveFloor";
                paramIn.put("communityId", result.getCommunityId());
                paramIn.put("floorNum", importFloor.getFloorNum());
                paramIn.put("userId", result.getUserId());
                paramIn.put("name", importFloor.getFloorNum() + "号楼");
                responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
            }
            if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
                continue;
            }

            savedFloorInfo = getExistsFloor(pd, result, importFloor);

            if (savedFloorInfo == null) {
                continue;
            }
            importFloor.setFloorId(savedFloorInfo.getString("floorId"));
            paramIn.clear();
            //判断单元信息是否已经存在，如果存在则不保存数据unit.queryUnits
            if (getExistsUnit(pd, result, importFloor) != null) {
                continue;
            }

            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.saveUnit";

            paramIn.put("communityId", result.getCommunityId());
            paramIn.put("floorId", savedFloorInfo.getString("floorId"));
            paramIn.put("unitNum", importFloor.getUnitNum());
            paramIn.put("layerCount", importFloor.getLayerCount());
            paramIn.put("lift", importFloor.getLift());
            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);

            //将unitId 刷入ImportFloor对象
            JSONObject savedUnitInfo = getExistsUnit(pd, result, importFloor);
            importFloor.setUnitId(savedUnitInfo.getString("unitId"));

        }
        return responseEntity;
    } 
                            #location 18 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                private ResponseEntity<String> savedFloorAndUnitInfo(IPageData pd, List<ImportFloor> floors, ComponentValidateResult result) {
        String apiUrl = "";
        JSONObject paramIn = null;
        ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功",HttpStatus.OK);
        for (ImportFloor importFloor : floors) {
            paramIn = new JSONObject();
            //先保存 楼栋信息
            JSONObject savedFloorInfo = getExistsFloor(pd, result, importFloor);
            // 如果不存在，才插入
            if (savedFloorInfo == null) {
                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.saveFloor";
                paramIn.put("communityId", result.getCommunityId());
                paramIn.put("floorNum", importFloor.getFloorNum());
                paramIn.put("userId", result.getUserId());
                paramIn.put("name", importFloor.getFloorNum() + "号楼");
                responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
            }
            if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
                continue;
            }

            savedFloorInfo = getExistsFloor(pd, result, importFloor);

            if (savedFloorInfo == null) {
                continue;
            }
            importFloor.setFloorId(savedFloorInfo.getString("floorId"));
            paramIn.clear();
            //判断单元信息是否已经存在，如果存在则不保存数据unit.queryUnits
            JSONObject savedUnitInfo = getExistsUnit(pd, result, importFloor);
            if ( savedUnitInfo != null) {
                importFloor.setUnitId(savedUnitInfo.getString("unitId"));
                continue;
            }

            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.saveUnit";

            paramIn.put("communityId", result.getCommunityId());
            paramIn.put("floorId", savedFloorInfo.getString("floorId"));
            paramIn.put("unitNum", importFloor.getUnitNum());
            paramIn.put("layerCount", importFloor.getLayerCount());
            paramIn.put("lift", importFloor.getLift());
            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);

            //将unitId 刷入ImportFloor对象
             savedUnitInfo = getExistsUnit(pd, result, importFloor);
            importFloor.setUnitId(savedUnitInfo.getString("unitId"));

        }
        return responseEntity;
    }