#vulnerable code 
                                public void read(String filename){
        BufferedReader reader = getBufferedReader(filename);
        String line;
        Coordinate[] coords = null;
        int[] demands = null;
        Integer capacity = null;
        String edgeType = null;
        String edgeWeightFormat = null;
        List<Integer> depotIds = new ArrayList<Integer>();
        boolean isCoordSection = false;
        boolean isDemandSection = false;
        boolean isDepotSection = false;
        boolean isEdgeWeightSection = false;
        List<Double> edgeWeights = new ArrayList<Double>();
        int dimensions = 0;

        while( ( line = getLine(reader) ) != null ){
            if(line.startsWith("EOF") || line.contains("EOF")){
                break;
            }
            if(line.startsWith("DIMENSION")){
                String[] tokens = line.split(":");
                String dim = tokens[1].trim();
                dimensions = Integer.parseInt(dim);
                coords = new Coordinate[dimensions];
                demands = new int[dimensions];
                continue;
            }
            if(line.startsWith("CAPACITY")){
                String[] tokens = line.trim().split(":");
                capacity = Integer.parseInt(tokens[1].trim());
                continue;
            }
            if(line.startsWith("EDGE_WEIGHT_TYPE")){
                String[] tokens = line.trim().split(":");
                edgeType = tokens[1].trim();
                continue;
            }
            if(line.startsWith("EDGE_WEIGHT_FORMAT")){
                String[] tokens = line.trim().split(":");
                edgeWeightFormat = tokens[1].trim();
                continue;
            }
            if(line.startsWith("NODE_COORD_SECTION")){
                isCoordSection = true;
                isDemandSection = false;
                isDepotSection = false;
                isEdgeWeightSection = false;
                continue;
            }
            if(line.startsWith("DEMAND_SECTION")){
                isDemandSection = true;
                isCoordSection = false;
                isDepotSection = false;
                isEdgeWeightSection = false;
                continue;
            }
            if(line.startsWith("DEPOT_SECTION")){
                isDepotSection = true;
                isDemandSection = false;
                isCoordSection = false;
                isEdgeWeightSection = false;
                continue;
            }
            if(line.startsWith("EDGE_WEIGHT_SECTION")){
                isDepotSection = false;
                isCoordSection = false;
                isDemandSection = false;
                isEdgeWeightSection = true;
                continue;
            }
            if(line.startsWith("DISPLAY_DATA_SECTION")){
                isDepotSection = false;
                isCoordSection = true;
                isDemandSection = false;
                isEdgeWeightSection = false;
                continue;
            }
            if(isCoordSection){
                if(coords == null) throw new IllegalStateException("DIMENSION tag missing");
                String[] tokens = line.trim().split("\\s+");
                coords[Integer.parseInt(tokens[0]) - 1] = Coordinate.newInstance(Double.parseDouble(tokens[1]), Double.parseDouble(tokens[2]));
                continue;
            }
            if(isDemandSection){
                if(demands == null) throw new IllegalStateException("DIMENSION tag missing");
                String[] tokens = line.trim().split("\\s+");
                demands[Integer.parseInt(tokens[0]) - 1] = Integer.parseInt(tokens[1]);
                continue;
            }
            if(isDepotSection){
                if(line.equals("-1")){
                    isDepotSection = false;
                }
                else{
                    depotIds.add(Integer.parseInt(line));
                }
                continue;
            }
            if(isEdgeWeightSection){
                String[] tokens = line.trim().split("\\s+");
                for (String s : tokens) edgeWeights.add(Double.parseDouble(s));
                continue;
            }
        }
        close(reader);
        vrpBuilder.setFleetSize(VehicleRoutingProblem.FleetSize.FINITE);
        for(Integer depotId : depotIds){
            VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0,capacity).build();
            VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId(depotId.toString())
                    .setStartLocationCoordinate(coords[depotId - 1]).setType(type).build();
            vrpBuilder.addVehicle(vehicle);
        }

        for (int i = 0; i < coords.length; i++) {
            String id = "" + (i + 1);
            if(depotIds.isEmpty()){
                if(i==0) {
                    VehicleImpl vehicle = VehicleImpl.Builder.newInstance("traveling_salesman")
                            .setStartLocation(Location.Builder.newInstance().setId(id)
                                    .setCoordinate(coords[i]).setIndex(i).build())

                                    .build();
                    vrpBuilder.addVehicle(vehicle);
                    continue;
                }
            }
            Service service = Service.Builder.newInstance(id)
                    .setLocation(Location.Builder.newInstance().setId(id)
                            .setCoordinate(coords[i]).setIndex(i).build())
                    .addSizeDimension(0, demands[i]).build();
            vrpBuilder.addJob(service);
        }
        if(edgeType.equals("GEO")){
            List<Location> locations = new ArrayList<Location>();
            for(Vehicle v : vrpBuilder.getAddedVehicles()) locations.add(v.getStartLocation());
            for(Job j : vrpBuilder.getAddedJobs()) locations.add(((Service)j).getLocation());
            vrpBuilder.setRoutingCost(getGEOMatrix(locations));
        }
        else if(edgeType.equals("EXPLICIT")){
            if(edgeWeightFormat.equals("UPPER_ROW")){
                FastVehicleRoutingTransportCostsMatrix.Builder matrixBuilder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(dimensions,true);
                int fromIndex = 0;
                int toIndex = 1;
                for(int i=0;i<edgeWeights.size();i++){
                    if(toIndex == dimensions){
                        fromIndex++;
                        toIndex = fromIndex + 1;
                    }
                    matrixBuilder.addTransportDistance(fromIndex, toIndex, edgeWeights.get(i));
                    matrixBuilder.addTransportTime(fromIndex,toIndex,edgeWeights.get(i));
                    toIndex++;
                }
                vrpBuilder.setRoutingCost(matrixBuilder.build());
            }
            else if(edgeWeightFormat.equals("UPPER_DIAG_ROW")){
                FastVehicleRoutingTransportCostsMatrix.Builder matrixBuilder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(dimensions,true);
                int fromIndex = 0;
                int toIndex = 0;
                for(int i=0;i<edgeWeights.size();i++){
                    if(toIndex == dimensions){
                        fromIndex++;
                        toIndex = fromIndex;
                    }
                    matrixBuilder.addTransportDistance(fromIndex,toIndex,edgeWeights.get(i));
                    matrixBuilder.addTransportTime(fromIndex,toIndex,edgeWeights.get(i));
                    toIndex++;
                }
                vrpBuilder.setRoutingCost(matrixBuilder.build());
            }
            else if(edgeWeightFormat.equals("LOWER_DIAG_ROW")){
                FastVehicleRoutingTransportCostsMatrix.Builder matrixBuilder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(dimensions,true);
                int fromIndex = 0;
                int toIndex = 0;
                for(int i=0;i<edgeWeights.size();i++){
                    if(toIndex > fromIndex){
                        fromIndex++;
                        toIndex = 0;
                    }
                    matrixBuilder.addTransportDistance(fromIndex,toIndex,edgeWeights.get(i));
                    matrixBuilder.addTransportTime(fromIndex,toIndex,edgeWeights.get(i));
                    toIndex++;
                }
                vrpBuilder.setRoutingCost(matrixBuilder.build());
            }
            else if(edgeWeightFormat.equals("FULL_MATRIX")){
                FastVehicleRoutingTransportCostsMatrix.Builder matrixBuilder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(dimensions,true);
                int fromIndex = 0;
                int toIndex = 0;
                for(int i=0;i<edgeWeights.size();i++){
                    if(toIndex == dimensions){
                        fromIndex++;
                        toIndex = 0;
                    }
                    matrixBuilder.addTransportDistance(fromIndex,toIndex,edgeWeights.get(i));
                    matrixBuilder.addTransportTime(fromIndex,toIndex,edgeWeights.get(i));
                    toIndex++;
                }
                vrpBuilder.setRoutingCost(matrixBuilder.build());
            }



        }


    } 
                            #location 115 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public void read(String filename){
        BufferedReader reader = getBufferedReader(filename);
        String line;
        Coordinate[] coords = null;
        int[] demands = null;
        Integer capacity = null;
        String edgeType = null;
        String edgeWeightFormat = null;
        List<Integer> depotIds = new ArrayList<Integer>();
        boolean isCoordSection = false;
        boolean isDemandSection = false;
        boolean isDepotSection = false;
        boolean isEdgeWeightSection = false;
        List<Double> edgeWeights = new ArrayList<Double>();
        int dimensions = 0;
        int coordIndex = 0;
        Map<Integer,Integer> indexMap = new HashMap<Integer, Integer>();
        while( ( line = getLine(reader) ) != null ){
            if(line.startsWith("EOF") || line.contains("EOF")){
                break;
            }
            if(line.startsWith("DIMENSION")){
                String[] tokens = line.split(":");
                String dim = tokens[1].trim();
                dimensions = Integer.parseInt(dim);
                coords = new Coordinate[dimensions];
                demands = new int[dimensions];
                continue;
            }
            if(line.startsWith("CAPACITY")){
                String[] tokens = line.trim().split(":");
                capacity = Integer.parseInt(tokens[1].trim());
                continue;
            }
            if(line.startsWith("EDGE_WEIGHT_TYPE")){
                String[] tokens = line.trim().split(":");
                edgeType = tokens[1].trim();
                continue;
            }
            if(line.startsWith("EDGE_WEIGHT_FORMAT")){
                String[] tokens = line.trim().split(":");
                edgeWeightFormat = tokens[1].trim();
                continue;
            }
            if(line.startsWith("NODE_COORD_SECTION")){
                isCoordSection = true;
                isDemandSection = false;
                isDepotSection = false;
                isEdgeWeightSection = false;
                continue;
            }
            if(line.startsWith("DEMAND_SECTION")){
                isDemandSection = true;
                isCoordSection = false;
                isDepotSection = false;
                isEdgeWeightSection = false;
                continue;
            }
            if(line.startsWith("DEPOT_SECTION")){
                isDepotSection = true;
                isDemandSection = false;
                isCoordSection = false;
                isEdgeWeightSection = false;
                continue;
            }
            if(line.startsWith("EDGE_WEIGHT_SECTION")){
                isDepotSection = false;
                isCoordSection = false;
                isDemandSection = false;
                isEdgeWeightSection = true;
                continue;
            }
            if(line.startsWith("DISPLAY_DATA_SECTION")){
                isDepotSection = false;
                isCoordSection = true;
                isDemandSection = false;
                isEdgeWeightSection = false;
                continue;
            }
            if(isCoordSection){
                if(coords == null) throw new IllegalStateException("DIMENSION tag missing");
                String[] tokens = line.trim().split("\\s+");
                Integer id = Integer.parseInt(tokens[0]);
                coords[coordIndex] = Coordinate.newInstance(Double.parseDouble(tokens[1]), Double.parseDouble(tokens[2]));
                indexMap.put(id,coordIndex);
                coordIndex++;
                continue;
            }
            if(isDemandSection){
                if(demands == null) throw new IllegalStateException("DIMENSION tag missing");
                String[] tokens = line.trim().split("\\s+");
                Integer id = Integer.parseInt(tokens[0]);
                int index = indexMap.get(id);
                demands[index] = Integer.parseInt(tokens[1]);
                continue;
            }
            if(isDepotSection){
                if(line.equals("-1")){
                    isDepotSection = false;
                }
                else{
                    depotIds.add(Integer.parseInt(line));
                }
                continue;
            }
            if(isEdgeWeightSection){
                String[] tokens = line.trim().split("\\s+");
                for (String s : tokens) edgeWeights.add(Double.parseDouble(s));
                continue;
            }
        }
        close(reader);
        vrpBuilder.setFleetSize(VehicleRoutingProblem.FleetSize.FINITE);
        for(Integer depotId : depotIds){
            VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0,capacity).build();
            VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId(depotId.toString())
                    .setStartLocationCoordinate(coords[depotId - 1]).setType(type).build();
            vrpBuilder.addVehicle(vehicle);
        }

        for (Integer id_ : indexMap.keySet()) {
            String id = id_.toString();
            int index = indexMap.get(id_);
            if(depotIds.isEmpty()){
                if(index == 0) {
                    VehicleImpl vehicle = VehicleImpl.Builder.newInstance("traveling_salesman")
                            .setStartLocation(Location.Builder.newInstance().setId(id)
                                    .setCoordinate(coords[index]).setIndex(index).build())
                                    .build();
                    vrpBuilder.addVehicle(vehicle);
                    continue;
                }
            }
            Service service = Service.Builder.newInstance(id)
                    .setLocation(Location.Builder.newInstance().setId(id)
                            .setCoordinate(coords[index]).setIndex(index).build())
                    .addSizeDimension(0, demands[index]).build();
            vrpBuilder.addJob(service);
        }
        if(edgeType.equals("GEO")){
            List<Location> locations = new ArrayList<Location>();
            for(Vehicle v : vrpBuilder.getAddedVehicles()) locations.add(v.getStartLocation());
            for(Job j : vrpBuilder.getAddedJobs()) locations.add(((Service)j).getLocation());
            vrpBuilder.setRoutingCost(getGEOMatrix(locations));
        }
        else if(edgeType.equals("EXPLICIT")){
            if(edgeWeightFormat.equals("UPPER_ROW")){
                FastVehicleRoutingTransportCostsMatrix.Builder matrixBuilder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(dimensions,true);
                int fromIndex = 0;
                int toIndex = 1;
                for(int i=0;i<edgeWeights.size();i++){
                    if(toIndex == dimensions){
                        fromIndex++;
                        toIndex = fromIndex + 1;
                    }
                    matrixBuilder.addTransportDistance(fromIndex, toIndex, edgeWeights.get(i));
                    matrixBuilder.addTransportTime(fromIndex,toIndex,edgeWeights.get(i));
                    toIndex++;
                }
                vrpBuilder.setRoutingCost(matrixBuilder.build());
            }
            else if(edgeWeightFormat.equals("UPPER_DIAG_ROW")){
                FastVehicleRoutingTransportCostsMatrix.Builder matrixBuilder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(dimensions,true);
                int fromIndex = 0;
                int toIndex = 0;
                for(int i=0;i<edgeWeights.size();i++){
                    if(toIndex == dimensions){
                        fromIndex++;
                        toIndex = fromIndex;
                    }
                    matrixBuilder.addTransportDistance(fromIndex,toIndex,edgeWeights.get(i));
                    matrixBuilder.addTransportTime(fromIndex,toIndex,edgeWeights.get(i));
                    toIndex++;
                }
                vrpBuilder.setRoutingCost(matrixBuilder.build());
            }
            else if(edgeWeightFormat.equals("LOWER_DIAG_ROW")){
                FastVehicleRoutingTransportCostsMatrix.Builder matrixBuilder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(dimensions,true);
                int fromIndex = 0;
                int toIndex = 0;
                for(int i=0;i<edgeWeights.size();i++){
                    if(toIndex > fromIndex){
                        fromIndex++;
                        toIndex = 0;
                    }
                    matrixBuilder.addTransportDistance(fromIndex,toIndex,edgeWeights.get(i));
                    matrixBuilder.addTransportTime(fromIndex,toIndex,edgeWeights.get(i));
                    toIndex++;
                }
                vrpBuilder.setRoutingCost(matrixBuilder.build());
            }
            else if(edgeWeightFormat.equals("FULL_MATRIX")){
                FastVehicleRoutingTransportCostsMatrix.Builder matrixBuilder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(dimensions,false);
                int fromIndex = 0;
                int toIndex = 0;
                for(int i=0;i<edgeWeights.size();i++){
                    if(toIndex == dimensions){
                        fromIndex++;
                        toIndex = 0;
                    }
                    matrixBuilder.addTransportDistance(fromIndex,toIndex,edgeWeights.get(i));
                    matrixBuilder.addTransportTime(fromIndex,toIndex,edgeWeights.get(i));
                    toIndex++;
                }
                vrpBuilder.setRoutingCost(matrixBuilder.build());
            }



        }


    }