Java Android-get请求收到EOFEException

Java Android-get请求收到EOFEException,java,php,android,get,Java,Php,Android,Get,代码: String recipeName = this.recipe.getName().replace(" ", "%20");; String recipeIngredients = this.recipe.getIngredients().replace(" ", "%20");; String recipeInstructions = this.recipe.getInstructions().replace(" ", "%20");; String r

代码

    String recipeName = this.recipe.getName().replace(" ", "%20");;
    String recipeIngredients = this.recipe.getIngredients().replace(" ", "%20");;
    String recipeInstructions = this.recipe.getInstructions().replace(" ", "%20");;
    String recipeUserName = this.recipe.getUserName().replace(" ", "%20");;
    int recipeRate = this.recipe.getRate();
    int recipeAmountOfRate = this.recipe.getAmountOfRates();
    String link = "http://***My_Site***/createRecipe.php?recipeName="+recipeName+"&recipeIngredients="+recipeIngredients
            +"&recipeInstructions="+recipeInstructions+"&recipeUserName="+recipeUserName+"&recipeRate="+recipeRate+
            "&recipeAmountOfRate="+recipeAmountOfRate;
    URL url = new URL(link);
    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
    urlConnection.setChunkedStreamingMode(0);
    try {
        InputStream in = new BufferedInputStream(urlConnection.getInputStream());
        int ch;
        StringBuffer sb = new StringBuffer();
        while ((ch = in.read()) != -1) {
            sb.append((char) ch);
        }
        Log.e("Error", sb.toString());
    } catch(Exception e) {
        Log.e("Error", e.toString());
    } finally {
        urlConnection.disconnect();
    }
}
但我得到了一个错误:

E/错误:java.io.EOFException

为什么呢? 在以前的请求中,请求很顺利。
URL请求是否太长?

添加完整的堆栈跟踪(如果有)。@LunarWatcher没有堆栈跟踪的原因是您捕获异常而没有打印出来
e。toString
只给出异常情况。如果您在
catch
中添加stacktrace的日志记录,您应该会看到一个。添加完整的stacktrace(如果有)。@LunarWatcher没有stacktrace的原因是您捕获异常而没有将其打印出来
e。toString
只给出异常情况。如果您在
catch
中添加stacktrace的日志记录,您应该会看到一个。