You searched for exceptions
. We found 168
results in 0.041 seconds.
Your fillData calls buffer.readLine(), which is declared to throw IOException - but you neither catch the exception witin fillData, nor declare that it might be thrown. The simplest fix is to change the signature of fillData to: public... more
No, they're not exactly the same. try-with-resources statements can declare multiple variables of different types; using statements can declare multiple variables, but they all have to be of the same type A using statement doesn't have... more
Contrary to the other answers, I wouldn't change your code to return null if you fail to encrypt the text - I would let that failure bubble up as an exception. I wouldn't declare that your method can throw Exception either - I'd specify... more
You'll see this if the code in the try block can't throw any checked exception. At that point, the compiler knows that the only kind of exception caught by the catch block has to be an unchecked exception, and so it can therefore be... more
This happens in Eclipse if you've got your compiler settings to target very old source compatibility. With a compatibility level of 1.5 or above, it's fine - but if you set the source compatibility level to 1.3 or 1.4, you'll get this... more
My question here is why does the FileWriter variable need to be wrapped in a BufferedWriter. It doesn't have to be - but you may well get better performance if you do, so that you avoid going to disk as often. Also, you're using... more
You're not closing the writer, which means there's data still in the buffer. You should close it (and all the other streams etc) in finally blocks, or use a try-with-resources statement if you're using Java 7. Also note that the way... more
No, you can't - Assert will throw an exception if it fails, and you can't just keep going after the exception. You could catch the exceptions, and then add them into a collection... but it's not terribly nice. If you're trying to... more
No, I wouldn't do this everywhere in your source code. Firstly, I'd use a dedicated logging package which may have cunning ways of doing a better job, and will certainly be less obtrusive in your source code. There are various options... more
the second command seems to do nothing. What is the reason? The second method is asynchronous, which means exceptions are never thrown directly to the caller - whether the exception occurs while the method is executing synchronously... more