ユーザーが複数のチェック ボックス (最大 10 個) を選択できる JSP ページがあります。複数のチェック ボックスがオンになっていると、NoSuchElement 例外がスローされることがあります。
サーブレット コード:
 Iterator<ClassInfo> iterateCurrentResultSet = resultSet.iterator();
        //If the current class's location isn't contained in "locations", the user didn't select it so remove
        //It from the results.
        while(iterateCurrentResultSet.hasNext())
        {
            //Evaluate every location they checked for, remove any class that isn't one of these locations.
            for(String selectedLocation : locations)
            {
                //IF THE EXCEPTION OCCURS, IT DOES HERE. Current class location, it this doesn't match the user's selected criteria, it's removed.
                String currentClassLocation = iterateCurrentResultSet.next().getSectionLocation();
                //Check if the user wants to see other classes, if not, continue on.
                if(selectedLocation.equals("OTH"))
                {
                    //If this is false, keep it because it is an "Other" class, such as SFD, CWD, etc.
                    if(mainCampusCode.contains(currentClassLocation))
                    {
                        iterateCurrentResultSet.remove();
                    }//doNothing();
                }
                else
                {
                    //If it does not have one of the selected locations, remove it.
                    if(!currentClassLocation.contains(selectedLocation))
                    {
                        iterateCurrentResultSet.remove();
                    }//doNothing();
                }
            }
        }
JavaDocから理解したように、なぜスローなのかわかりませんが、要素がない場合に発生するように見えますが、 iterateCurrentResultSet.hasNext() が要素を処理していることを確認すると思いました。