#fixed code
                              public static RainbowFish readV1(String filename) throws IOException, ClassNotFoundException {
    Map<String, String> map = null;

    try (FileInputStream fileIn = new FileInputStream(filename);
        ObjectInputStream objIn = new ObjectInputStream(fileIn)) {
      map = (Map<String, String>) objIn.readObject();
    }

    return new RainbowFish(map.get("name"), Integer.parseInt(map.get("age")), Integer.parseInt(map.get("lengthMeters")),
        Integer.parseInt(map.get("weightTons")));
  }
#vulnerable code 
                              public static RainbowFish readV1(String filename) throws IOException, ClassNotFoundException {
    FileInputStream fileIn = new FileInputStream(filename);
    ObjectInputStream objIn = new ObjectInputStream(fileIn);
    Map<String, String> map = (Map<String, String>) objIn.readObject();
    objIn.close();
    fileIn.close();
    return new RainbowFish(map.get("name"), Integer.parseInt(map.get("age")), Integer.parseInt(map
        .get("lengthMeters")), Integer.parseInt(map.get("weightTons")));
  } 
                            #location 8 
                            #vulnerability type RESOURCE_LEAK