0

したがって、何らかの理由で、私の while ループには try catch があり、catch が起動すると、何らかの理由で、catch ブロックの後のコードがまだ catch ブロック内の continue ステートメントで実行されています。だから私は何が起こっているのか分かりません。

    ArrayList<File> mapFileList = new ArrayList<File>();
    HashMap<String,Map> mapHash = new HashMap<String,Map>();

    // Player Variables
    ArrayList<Player> playerList = new ArrayList<Player>();
    Iterator<Player> playerIter;
    HashMap<String,Stats> statsMap = new HashMap<String,Stats>();
    File playerStatsFile;
    File newPlayerStatsFile;

    /*
     * Choose a map or make a new one
     */
    // Make a list of all existing files
    File mapFolder = new File("bin/maps/");
    // If the maps folder does not already exist, make it
    if(mapFolder.mkdir()){
        System.out.println("Maps folder does not exist. Creating.");
    }
    // For ever map file in the directory, save it to the map file list
    for(File fMap : mapFolder.listFiles()){
        if(fMap.getName().endsWith(".map")){
            mapFileList.add(fMap);
        }
    }
    // Load those maps into the mapHash HashMap
    Iterator<File> itMap = mapFileList.iterator();

        while(itMap.hasNext()){
        Map map = null;
        File fMap;
        // Get each map
        fMap = itMap.next();
        // Load them into memory and deserialize the map
        try{
            MapReader.openFile(fMap);
        }catch(IOException e){
            System.out.println("Error: Cannot open file.");
            continue;
        }

        try{
            map = MapReader.readRecords();
        }catch(Exception e){
            System.out.println("Error: Problem with reading the map.");
            //System.exit(1);
            continue;
        }
        // Let the user know the map loaded successfully
        System.out.println("Map "+map.getName()+" loaded.");
        // Then store the map into the mapHash
        mapHash.put(map.getName().toLowerCase(), map);
    }
4

0 に答える 0