0

これをより適切にデバッグする方法について何か提案はありますか? line = in.readLine()すべきではない場合でもnull を返していることを知っています。1 層上にすべてのキャッチを追加しましたthrowablesが、残念ながら、エラーは出力されていません。次に何を試すことができるかについて何か提案はありますか?

public static String pullString(int id) throws IOException {

    String price;
    logError("Checkpoint 1");
    URL url = new URL("http://www.example.com");
    URLConnection con = url.openConnection();
    logError("Checkpoint 2");
    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    logError("Checkpoint 3");
    String line;

    while ((line = in.readLine()) != null) {
    //^ for some reason this becomes null, but on identical pages it works fine. 


          //Removed unneeded info


                return ---;
            } catch (NumberFormatException e) {
                logError("NumberFormatException");

                return null;
            }
        }
    }
    logError("left out the back");
    return null;
}
4

0 に答える 0