File file = null;
// Set the Fuzzing Panel as the one to view
mWindow.setTabShow(JBroFuzzWindow.ID_PANEL_FUZZING);
Logger.log("Open Fuzzing Session", 1);
final JBroFuzzFileFilter filter = new JBroFuzzFileFilter();
final String dirString = JBroFuzz.PREFS.get(
JBroFuzzPrefs.DIRS[2].getId(), System.getProperty("user.dir"));
JFileChooser fc = new JFileChooser();
if (fileName.length() == 0 || fileName.equals("")) {
try {
if ((new File(dirString).isDirectory())){
fc = new JFileChooser(dirString);
} else {
fc = new JFileChooser();
}
} catch (final SecurityException e1) {
fc = new JFileChooser();
Logger.log(
"A security exception occured, while attempting to point to a directory",
4);
}
fc.setFileFilter(filter);
final int returnVal = fc.showOpenDialog(mWindow);
if (returnVal == JFileChooser.APPROVE_OPTION) {
file = fc.getSelectedFile();
}
} else {
file = new File(fileName);
}
Logger.log("Opening: " + file.getName(), 1);
final String path = file.getAbsolutePath().toLowerCase();
// If the file does not end in .jbrofuzz, return
JBroFuzzFileFilter jbfff = new JBroFuzzFileFilter();
if (!path.endsWith(".jbrofuzz") || !jbfff.accept(file)) {
JOptionPane.showMessageDialog(fc,
"The file selected is not a valid .jbrofuzz file",
" JBroFuzz - Open ", JOptionPane.WARNING_MESSAGE);
return;
}