title: Getting this error Premature end of file
body: <p>I am facing the problem of Premature end of file but not all the time only sometimes am facing this issue. Please help me to resolve this issue.</p>
  
  <pre><code>InputStreamReader isr=new InputStreamReader(httpConn.getInputStream);
  BufferedReader in = new BufferedReader(isr);
  while ((responseString = in.readLine()) != null) {
              outputString = outputString + responseString;
           }
   if (outputString != null &amp;&amp; !"".equalsIgnoreCase(outputString)) 
           {
              Document document = parseXmlFile(outputString);
              String userName = document.getElementsByTagName("UserID").item(0).getTextContent();
              if(!userName.equalsIgnoreCase("")&amp;&amp;userName!=null&amp;&amp;userName.equalsIgnoreCase(deptUserId))
              {
                String signbaseData = document.getElementsByTagName("Sign").item(0).getTextContent();
                if(signbaseData!=null&amp;&amp;!"".equalsIgnoreCase(signbaseData)) 
                {
                  signData=new Base64().decodeBase64(signbaseData.getBytes());
                }
              }
          }
  </code></pre>
  
  <p>this is the parseXMLFile</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>}
      }</p>
  
  <p>Thanks.</p>