I've got a strange problem here with my application.
What the application should do: Download the source code of web pages and save them to a local file.
To do this, I use the Apache httpclient library.
My problem:
The downloader is a Swing application created with NetBeans and its GUI Builder.
To download the web page, some lines of code using httpclient are needed.
When the "Start download" button is pressed, the page should be downloaded.
It's just, if I just put the download code in the ActionListener.actionPerformed(...) method of the "Start download" button (which is called when the button is pressed), it doesn't work! The thread just stops mid-flow! On the other hand, if I download something using HttpClient
before the Swing application even starts, everything works fine afterwards if the button is pressed! Why does some random code completely detached from the main application influence the result of the latter?
I'm not asking you to solve my problem (but any help would be GREATLY appreciated!). But could you just try out the application for yourself and see if you can replicate the error? I attached a zip file (just rename it to something.zip) to this post containing two folders, which are two NetBeans projects. To build and execute them, you need the following libs (they are very small!):
http://gd.tuwien.ac.at/infosys/servers/http/apache/dist/httpcomponents/commons-httpclient/binary/commons-httpclient-3.1.tar.gz (add commons-httpclient-3.1.jar to your libs)
http://gd.tuwien.ac.at/infosys/servers/http/apache/dist/commons/logging/binaries/commons-logging-1.1.1-bin.tar.gz (add commons-logging-1.1.1.jar to your libs)
http://mirror.deri.at/apache/commons/codec/binaries/commons-codec-1.3.tar.gz (add commons-codec-1.3.jar to your libs).
If you aren't behind a proxy, comment out the lines in DownloaderApp.java following the
// Comment the next section (3 lines) out if you don't sit behind a proxy
comment.
If you would like to investigate further, please look inside DownloaderView.java . The thread hangs after the
comment.
Any help appreciated! Thanks in advance,
Sam