Trouble with downloading
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, August 15, 2002 01:52 PM

I trying to use an app to download multiple file from a directory. Basically I have a set of keys for every file that should be there. The basics look like this constuctor (server info and what files to look for) { forloop (to look for every file) { try { looking for file from list of names in array } catch (FileNotFoundException fnfe) { //do nothing, not all files will be there } catch (IOException ioe) { document it in logs } } } The downloading and everything works fine until I get to the FileNotFoundException, then the program freezes. I don't expect everyone to have all there files prese   More>>

I trying to use an app to download multiple file from a directory. Basically I have a set of keys for every file that should be there. The basics look like this

			
constuctor (server info and what files to look for)
{
forloop (to look for every file)
{
try
{
looking for file from list of names in array
}
catch (FileNotFoundException fnfe)
{
//do nothing, not all files will be there
}
catch (IOException ioe)
{
document it in logs
}
}
}


The downloading and everything works fine until I get to the FileNotFoundException, then the program freezes. I don't expect everyone to have all there files present for a couple of weeks, so I wanted our company to be able to use what we have for now, and keep checking for new ones (that the point of going through every possible file name every time). I've tried throwing the exception as well like this:
			
constructor (blah blah) throws IOException


but it doesn't work either. any help is appreciated.    <<Less

Re: Trouble with downloading

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, August 15, 2002 02:07 PM

That method you call "constructor" is not meant to be an actual class constructor, is it?



If it is, you should probably try making a simpler real constructor for your class, which just makes empty objects and then returns quickly.



Then move your looping over files, exceptions etc. off into a separate initialization method, called separately from the constructor.



That is your client would do something like


"myobj foo = new myclass();"


"foo.initialize();"



instead of jamming all that code and handling and stuff into the constructor itself.

About | Sitemap | Contact