title: swing download not works in windows xp
body: <p>I have a sample code to download some data (pdf,gif and mp3) from a web and its a swing application.It works perfectly in Windows 7 but  not working in Windows xp.</p>
  
  <p>My code is </p>
  
  <pre><code> public static Float downloadFile(String targetUrl,File filePath)
          {
              try
              {
  
                  Integer count=0;
                  URL url = new URL(targetUrl);
                  HttpURLConnection connection=(HttpURLConnection) url.openConnection();
                  connection.setRequestMethod("GET");
                  connection.setDoOutput(true);
                  connection.setConnectTimeout(10000);
                  connection.connect();
  
                  int lenghtOfFile = connection.getContentLength();
                  Thread.sleep(100);
                  InputStream input = new BufferedInputStream(url.openStream());
                  Thread.sleep(100);
                  OutputStream output = new FileOutputStream(filePath);
                  byte data[] = new byte[input.available()];
                  long total = 0;
                  while ((count = input.read(data)) != -1)
                  {
                      total += count;
                      output.write(data, 0, count);
                  }
                  output.flush();
                  output.close();
                  input.close();
              }
              catch (Exception e)
              {
                  e.printStackTrace();
              }
              return 2.5f;
              }  
      }
  </code></pre>
  
  <p>It enters into the infinite while loop by setting the code to 0</p>