Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
日志中出现Android-IOException错误_Android_Error Handling_Android Asynctask_Ioexception - Fatal编程技术网

日志中出现Android-IOException错误

日志中出现Android-IOException错误,android,error-handling,android-asynctask,ioexception,Android,Error Handling,Android Asynctask,Ioexception,我正忍受着这种奇怪的情况。问题是,我的应用程序正在使用Asynctask从自定义web服务获取数据。这里,在同一个任务上,它在日志中给出IOException错误。不过,该任务工作正常,并返回从服务器收集所需的所有数据。也就是说,asynctask似乎工作正常,但日志中给出了“IOException”。这是日志 03-22 18:39:50.880: D/dalvikvm(586): GC_FOR_MALLOC freed 2666K, 54% free 4661K/10119K, extern

我正忍受着这种奇怪的情况。问题是,我的应用程序正在使用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;
}
公共类FetchEmployeeTask扩展了AsyncTask{
VO_EmployeeHolder vEholder=新的VO_EmployeeHolder();
核心=新核心();
字符串_empId、_用户名、_密码;
字符串_数据,_url;
私有静态最终字符串密钥\u ID=“ID”;
私有静态最终字符串键\u FNAME=“first name”;
私有静态最终字符串密钥\u LNAME=“last name”;
私有静态最终字符串键\u DESIG=“title”;
私有静态最终字符串密钥\u EMAIL=“电子邮件地址”;
私有静态最终字符串密钥\u AVATAR=“AVATAR url”;
私有静态最终字符串密钥\u CELLNO=“手机号码”;
@凌驾
受保护的VO_员工持有者背景(字符串…参数){
此参数为._empId=params[0];
此._username=params[1];
此._password=params[2];
这是.\u url=”https://somedomainhere.to.place/man/“+this._empId+”.xml”;
HttpClient HttpClient=新的DefaultHttpClient();
HttpResponse响应;
HttpHost _thost=新的HttpHost(“somedomainhere.to.place”,443,“https”);
试一试{
((AbstractHttpClient)httpclient).getCredentialsProvider().setCredentials(
新的org.apache.http.auth.AuthScope(_-thost.getHostName(),_-thost.getPort()),
新的org.apache.http.auth.UsernamePasswordCredentials(这个.u用户名,这个.u密码));
response=httpclient.execute(新的HttpGet(this._url));
StatusLine StatusLine=response.getStatusLine();
if(statusLine.getStatusCode()==HttpStatus.SC\u OK){
InputStream _Istream=response.getEntity().getContent();
Document _Document=DomTaskParse(_Istream);
NodeList _nodeRecord=_Document.getElementsByTagName(“person”);
loadEmployee(_nodeRecord);
}否则{
response.getEntity().getContent().close();
抛出新IOException(statusLine.getReasonPhrase());
}
}捕获(客户端协议异常cpe){
Log.e(“ClientProtocolException@FPT”,cpe.toString());
}捕获(例外情况除外){
Log.e(“获取员工任务时出现异常”,例如toString());
}
将本文件退还给持有人;
}
私有void loadEmployee(节点列表NLList){
元素e=(元素)nList.item(0);
this.vEholder.\u id=core.getValue(e,KEY\u id);
this.vEholder.\u fname=core.getValue(e,KEY\u fname);
this.vEholder.\u lname=core.getValue(e,KEY\u lname);
此.vEholder.\u名称=核心.getValue(e,键设计);
this.vEholder.\u email=core.getValue(e,KEY\u email);
这个.vEholder.\u avatar=core.getValue(e,KEY\u avatar);
this.vEholder.\u cellno=core.getValue(e,KEY\u cellno);
}
私有文档DomTaskParse(InputStream\u Istream){
试一试{
返回新的DomParserTask();
}捕捉(中断异常e){
//TODO自动生成的捕捉块
e、 printStackTrace();
}捕获(执行例外){
//TODO自动生成的捕捉块
e、 printStackTrace();
}
返回null;
}

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

那么它是正的还是负的?我现在该怎么办?不用麻烦了。DVM将处理此类问题。但是你应该注意内存的使用。尽可能减少内存使用。因为这是一款智能手机,根本不是处理更大内存的系统或服务器。尽可能优化每件事。如果这是您正在寻找的,则选择这件事作为正确的。不继续,因为仍然没有得到关于
03-22 18:39:58.352:E/Exception at FETCH EMPLOYEE TASK(586):java.io.IOException:Not Found
的答案。如果工作正常,为什么会出现这种情况?您可以检查该行无法保存哪个视图具有焦点,因为焦点视图是android.widget。EditText@405438d0他没有身份证。