In your "browse" button code you are initializing a local variable mod
like this:
final File mod = fc.getSelectedFile();
In the "Submit" button code you are using a class variable mod
. Same name, different variables with different scopes.
Try changing:
final File mod = fc.getSelectedFile();
to
mod = fc.getSelectedFile();
with mod
being a private class variable.
Also add null check in the "Submit" button code.