Originally posted by: notfred
Are you bragging about your stupidity, or do find this comical?
Originally posted by: amdfanboy
Maybe I'm missing something, but I don't see a reason why you would need the try/catch block at all if they only place it catches on is your exception. How does ini force you to throw an exception? I don't quite follow.
Umm, either your ini class declares that it throws a non-RuntimeException from one of those methods or it doesn't. If it doesn't, you don't have to catch anything. If it does, you have to catch it but you don't have to throw anything. It doesn't work both ways.Originally posted by: EyeMWing
Originally posted by: amdfanboy
Maybe I'm missing something, but I don't see a reason why you would need the try/catch block at all if they only place it catches on is your exception. How does ini force you to throw an exception? I don't quite follow.
ini throws an exception - I either need to handle one, or throw one, or the damn thing won't compile. I can't take my normal cop-out and have the object throw one since this ActionListener is an inner class and I'm 99% certain that that's syntactically impossible, but feel free to correct me if I'm wrong. So I both handle the exception and include a token stupid-throw because I was bored and to give the code maintainers something to do.
Originally posted by: kamper
Umm, either your ini class declares that it throws a non-RuntimeException from one of those methods or it doesn't. If it doesn't, you don't have to catch anything. If it does, you have to catch it but you don't have to throw anything. It doesn't work both ways.Originally posted by: EyeMWing
Originally posted by: amdfanboy
Maybe I'm missing something, but I don't see a reason why you would need the try/catch block at all if they only place it catches on is your exception. How does ini force you to throw an exception? I don't quite follow.
ini throws an exception - I either need to handle one, or throw one, or the damn thing won't compile. I can't take my normal cop-out and have the object throw one since this ActionListener is an inner class and I'm 99% certain that that's syntactically impossible, but feel free to correct me if I'm wrong. So I both handle the exception and include a token stupid-throw because I was bored and to give the code maintainers something to do.
If this 3rd party class does throw an IOException it's probably for a good reason. When you catch it you should probably log it and/or wrap it in some form of RuntimeException and throw it again. Swallowing exceptions silently makes for a difficult to debug program and calling System.exit() almost anywhere except within short range of a main() method is very bad practise.
And if you have to copy the same code over 500 times you really need to rethink why.
Originally posted by: BingBongWongFooey
I am VERY skeptical that there is a good reason to repeat a block of code 500 times.