这个方法 前半部分正常 到后面 从
reader = new XmlReader(is, httpConnection.getHeaderField("Content-Type"), true);
就不执行了。怎么回事?
public SyndFeed GetFeed() {
SyndFeed tmp = null;
InputStream inputStream = null;
try {
inputStream = httpConnection.getInputStream();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BufferedInputStream is = null;
if ("gzip".equalsIgnoreCase(httpConnection.getContentEncoding())) {
// handle gzip encoded content
try {
is = new BufferedInputStream(new GZIPInputStream(inputStream));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
is = new BufferedInputStream(inputStream);
}     XmlReader reader = null;     
    if (httpConnection.getHeaderField("Content-Type") != null) {
        try {
reader = new XmlReader(is, httpConnection.getHeaderField("Content-Type"), true);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();

    } else {
        try {
reader = new XmlReader(is, true);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();

    }
try {
tmp= new SyndFeedInput().build(reader);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();

return tmp;
}

解决方案 »

  1.   

    inputStream = httpConnection.getInputStream(); 
    这里有错误  httpConnection 我没猜错的话不是你自定义的,没有这个httpConnection 
    应该是这个样子的吧
    HttpURLConnectioninputStream =HttpURLConnection.getInputStream();
      

  2.   

    inputStream = httpConnection.getInputStream(); 
    这里有错误  httpConnection 我没猜错的话不是你自定义的,没有这个httpConnection 
    应该是这个样子的吧
    HttpURLConnectioninputStream =HttpURLConnection.getInputStream();
      

  3.   

    inputStream = httpConnection.getInputStream(); 
    这里有错误  httpConnection 我没猜错的话不是你自定义的,没有这个httpConnection 
    应该是这个样子的吧
    HttpURLConnectioninputStream =HttpURLConnection.getInputStream();