获取此错误文件过早结束

时间:2017-04-22 09:32:11

标签: java xml soap

我面临着文件过早结束的问题,但并非所有时间都有时只面临这个问题。请帮我解决这个问题。

InputStreamReader isr=new InputStreamReader(httpConn.getInputStream);
BufferedReader in = new BufferedReader(isr);
while ((responseString = in.readLine()) != null) {
            outputString = outputString + responseString;
         }
 if (outputString != null && !"".equalsIgnoreCase(outputString)) 
         {
            Document document = parseXmlFile(outputString);
            String userName = document.getElementsByTagName("UserID").item(0).getTextContent();
            if(!userName.equalsIgnoreCase("")&&userName!=null&&userName.equalsIgnoreCase(deptUserId))
            {
              String signbaseData = document.getElementsByTagName("Sign").item(0).getTextContent();
              if(signbaseData!=null&&!"".equalsIgnoreCase(signbaseData)) 
              {
                signData=new Base64().decodeBase64(signbaseData.getBytes());
              }
            }
        }

这是parseXMLFile

public Document parseXmlFile(String in) {
    try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        InputSource is = new InputSource(new StringReader(in));
        return db.parse(is);
    } catch (ParserConfigurationException e) {
        throw new RuntimeException(e);
    } catch (SAXException e) {
        throw new RuntimeException(e);
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    }catch (Exception ex) {
        throw new RuntimeException(ex);

}     }

感谢。

0 个答案:

没有答案