Android-日志中出现IOException错误



我正遭受着这种奇怪的情况。问题是,我的应用程序正在使用Asynctask从我的自定义web服务中获取数据。在这里,在同一个任务中,它在日志中给出IOException错误。不过,该任务运行良好,并返回从服务器收集所需的所有数据。意思是,asynctask似乎工作得很好,但在日志中给出了"IOException"。这是的日志

03-22 18:39:50.880: D/dalvikvm(586): GC_FOR_MALLOC freed 2666K, 54% free 4661K/10119K, external 2108K/2633K, paused 73ms
03-22 18:39:54.370: D/PhoneWindow(586): couldn't save which view has focus because the focused view android.widget.EditText@405438d0 has no id.
03-22 18:39:58.352: E/Exception at FETCH EMPLOYEE TASK(586): java.io.IOException: Not Found
03-22 18:40:00.210: D/dalvikvm(586): GC_CONCURRENT freed 1189K, 53% free 4778K/10119K, external 2113K/2215K, paused 9ms+10ms
03-22 18:40:03.670: D/dalvikvm(586): GC_CONCURRENT freed 1360K, 53% free 4767K/10119K, external 2108K/2215K, paused 9ms+5ms
03-22 18:40:07.230: E/Exception at FETCH EMPLOYEE TASK(586): java.io.IOException: Not Found
03-22 18:40:09.070: D/dalvikvm(586): GC_CONCURRENT freed 1129K, 51% free 5041K/10119K, external 2108K/2215K, paused 8ms+6ms
03-22 18:40:12.810: E/Exception at FETCH EMPLOYEE TASK(586): java.io.IOException: Not Found
03-22 18:40:14.610: D/dalvikvm(586): GC_CONCURRENT freed 1312K, 49% free 5231K/10119K, external 2108K/2215K, paused 9ms+6ms
03-22 18:40:21.220: D/dalvikvm(586): GC_CONCURRENT freed 1354K, 47% free 5437K/10119K, external 2108K/2215K, paused 9ms+6ms
03-22 18:40:22.210: E/Exception at FETCH EMPLOYEE TASK(586): java.io.IOException: Not Found
03-22 18:40:26.880: D/dalvikvm(586): GC_CONCURRENT freed 2246K, 53% free 4803K/10119K, external 2108K/2215K, paused 19ms+7ms
03-22 18:40:27.891: E/Exception at FETCH EMPLOYEE TASK(586): java.io.IOException: Not Found
03-22 18:40:32.540: D/dalvikvm(586): GC_CONCURRENT freed 1319K, 52% free 4896K/10119K, external 2108K/2215K, paused 8ms+6ms
03-22 18:40:36.183: E/Exception at FETCH EMPLOYEE TASK(586): java.io.IOException: Not Found
03-22 18:40:38.081: D/dalvikvm(586): GC_CONCURRENT freed 1293K, 51% free 5000K/10119K, external 2108K/2215K, paused 8ms+8ms
03-22 18:40:40.330: I/dalvikvm(586): Jit: resizing JitTable from 2048 to 4096
03-22 18:40:40.780: W/IInputConnectionWrapper(586): finishComposingText on inactive InputConnection
03-22 18:40:43.390: E/Exception at FETCH EMPLOYEE TASK(586): java.io.IOException: Not Found
03-22 18:40:44.790: D/dalvikvm(586): GC_CONCURRENT freed 1715K, 54% free 4700K/10119K, external 2108K/2215K, paused 9ms+7ms

这是我的异步任务。

public class FetchEmployeeTask extends AsyncTask<String, Void, VO_EmployeeHolder> {
VO_EmployeeHolder vEholder  = new VO_EmployeeHolder();
Core core                   = new Core();
String _empId,_username,_password;
String _data,_url;
private static final String KEY_ID          = "id";
private static final String KEY_FNAME       = "first-name";
private static final String KEY_LNAME       = "last-name";
private static final String KEY_DESIG       = "title";
private static final String KEY_EMAIL       = "email-address";
private static final String KEY_AVATAR      = "avatar-url";
private static final String KEY_CELLNO      = "phone-number-mobile";
@Override
protected VO_EmployeeHolder doInBackground(String... params) {
    this._empId         = params[0];
    this._username      = params[1];
    this._password      = params[2];
    this._url           = "https://somedomainhere.to.place/man/"+this._empId+".xml";
    HttpClient httpclient = new DefaultHttpClient();
    HttpResponse response;
    HttpHost _thost = new HttpHost("somedomainhere.to.place",443,"https");
    try {
         ((AbstractHttpClient) httpclient).getCredentialsProvider().setCredentials(
                new org.apache.http.auth.AuthScope(_thost.getHostName(),_thost.getPort()),
                new org.apache.http.auth.UsernamePasswordCredentials(this._username, this._password));
        response = httpclient.execute(new HttpGet(this._url));
        StatusLine statusLine = response.getStatusLine();
        if(statusLine.getStatusCode() == HttpStatus.SC_OK) {
            InputStream _Istream = response.getEntity().getContent();
            Document _Document = DomTaskParse(_Istream);
            NodeList _nodeRecord = _Document.getElementsByTagName("person");
            loadEmployee(_nodeRecord);
        } else {
            response.getEntity().getContent().close();
            throw new IOException(statusLine.getReasonPhrase());
        }
    } catch(ClientProtocolException cpe) {
        Log.e("ClientProtocolException @ FPT",cpe.toString());
    } catch(Exception ex) {
        Log.e("Exception at FETCH EMPLOYEE TASK",ex.toString());
    }

    return this.vEholder;
}
private void loadEmployee(NodeList nList) {
    Element e = (Element) nList.item(0);
    this.vEholder._id               = core.getValue(e, KEY_ID);
    this.vEholder._fname            = core.getValue(e, KEY_FNAME);
    this.vEholder._lname            = core.getValue(e, KEY_LNAME);
    this.vEholder._designation      = core.getValue(e, KEY_DESIG);
    this.vEholder._email            = core.getValue(e, KEY_EMAIL);
    this.vEholder._avatar           = core.getValue(e, KEY_AVATAR);
    this.vEholder._cellno           = core.getValue(e, KEY_CELLNO);
}
private Document DomTaskParse(InputStream _Istream) {
    try {
        return new DomParserTask().execute(_Istream).get();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ExecutionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}

}

Android的垃圾回收器正在后台运行。DVM通过调用GC来清除不需要的数据,并增加为此特定应用程序分配的RAM。RAM将增加,直到它达到可以提供给应用程序的最大RAM,之后如果它仍然想扩展,则DVM将抛出内存不足异常。

最新更新