Campbell Ritchie wrote:Are you sure you didn't miss out a "not" from that error message.
It is impossible at compile-time to predict whether an exception will or will not occur. The compiler queries all possible paths of execution through the entire method, and sees whether there are any where the field is not assigned to.
The compiler is not complaining that the field may not have been assigned a value. It is complaining that it is possible it may have been assigned a value twice - once in the try block and once in the catch block. It doesn't realise that the line in the try block that throws the exception is also the line that assigns the value.