Java - Reading a text file from a web page sometimes doesn't update correctly
<p>I'm reading a remote text file from a site which changes fairly often, using this code:</p>

<pre><code>URL url = new URL(sourceAddress);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
while ((line = reader.readLine()) != null) {
    retrievedText += line+lineBreak;
}
reader.close();
</code></pre>

<p>Now my issue is when I read this text, it doesn't change even after the source text file changes (it is not still uploading). Even application restarts do not return the "latest" text.</p>

<p>Oddly enough, if I have the aforementioned text file open in a browser and hit refresh, the next time my Java application polls the file it will retrieve the latest content - even if the application was closed entirely.</p>

<p>This leads me to believe it may be some caching issue, but I'm completely stumped about how to get around it.</p>

<p>Any help and or advice is much appreciated!</p>
