Buggy code:
public class JSBMLWriter implements TreeModelListener { public String sourceType ; public String databaseName ; public JSBMLWriter . SMetabolites allMeta ; public LocalConfig curConfig ; public JSBMLWriter . SReactions allReacts ; public int level ; public int version ; public Map < Integer , SBMLMetabolite > metabolitesMap ; public Map < String , Species > speciesMap ; public Map < String , Compartment > compartments ; public Map < String , SpeciesReference > speciesRefMap ; public File outFile ; public SettingsFactory curSettings ; public String optFilePath ; public boolean load ; public String getOptFilePath ( ) { } public void setOptFilePath ( String optFilePath ) { } public static void main ( String [ ] args ) throws Exception { } @ Override public void treeNodesChanged ( TreeModelEvent arg0 ) { } @ Override public void treeNodesInserted ( TreeModelEvent arg0 ) { } @ Override public void treeNodesRemoved ( TreeModelEvent arg0 ) { } @ Override public void treeStructureChanged ( TreeModelEvent arg0 ) { } public void setConfig ( LocalConfig conf ) { } public void formConnect ( LocalConfig config ) throws Exception { } public File getOutFile ( ) { } public JSBMLWriter ( ) { } public void metaMap ( ) { } public boolean setOutFile ( ) { if ( GraphicalInterface . showJSBMLFileChooser ) { JTextArea output = null ; String lastSBML_path = curSettings . get ( "LastSBML" ) ; Utilities u = new Utilities ( ) ; JFileChooser chooser = new JFileChooser ( ) ; chooser . setCurrentDirectory ( new File ( u . lastPath ( lastSBML_path , chooser ) ) ) ; chooser . setApproveButtonText ( "Save" ) ; chooser . setDialogTitle ( "Save<seq2seq4repair_space>to" ) ; chooser . setFileFilter ( new JSBMLWriter . XMLFileFilter ( ) ) ; chooser . setFileSelectionMode ( JFileChooser . FILES_AND_DIRECTORIES ) ; if ( GraphicalInterface . saveOptFile ) { String path = getOptFilePath ( ) ; File theFileToSave = new File ( path ) ; chooser . setSelectedFile ( theFileToSave ) ; } boolean done = false ; boolean cancel = false ; while ( ! done ) { <START_BUG> int option = chooser . showOpenDialog ( output ) ; <END_BUG> if ( option == ( JFileChooser . CANCEL_OPTION ) ) { cancel = true ; done = true ; } if ( option == ( JFileChooser . APPROVE_OPTION ) ) { if ( ( chooser . getSelectedFile ( ) ) != null ) { String path = chooser . getSelectedFile ( ) . getPath ( ) ; if ( ! ( path . endsWith ( ".xml" ) ) ) { path = path + ".xml" ; } File theFileToSave = new File ( path ) ; if ( theFileToSave . exists ( ) ) { int confirmDialog = JOptionPane . showConfirmDialog ( chooser , "Replace<seq2seq4repair_space>existing<seq2seq4repair_space>file?" ) ; if ( confirmDialog == ( JOptionPane . YES_OPTION ) ) { done = true ; this . setOutFile ( theFileToSave ) ; String rawPathName = chooser . getSelectedFile ( ) . getAbsolutePath ( ) ; if ( ! ( rawPathName . endsWith ( ".xml" ) ) ) { rawPathName = rawPathName + ".xml" ; } curSettings . add ( "LastSBML" , rawPathName ) ; } else if ( confirmDialog == ( JOptionPane . NO_OPTION ) ) { done = false ; } else if ( confirmDialog == ( JOptionPane . CANCEL_OPTION ) ) { cancel = true ; done = true ; } } else { done = true ; this . setOutFile ( theFileToSave ) ; String rawPathName = chooser . getSelectedFile ( ) . getAbsolutePath ( ) ; if ( ! ( rawPathName . endsWith ( ".xml" ) ) ) { rawPathName = rawPathName + ".xml" ; } curSettings . add ( "LastSBML" , rawPathName ) ; } } } } if ( done && ( ! cancel ) ) { return true ; } } else { File theFileToSave = GraphicalInterface . getSBMLFile ( ) ; this . setOutFile ( theFileToSave ) ; return true ; } return false ; } public void setOutFile ( File toFile ) { } @ SuppressWarnings ( "deprecation" ) public void create ( ) throws Exception { } public class SMetabolites { public Model model ; public ArrayList < SBMLMetabolite > allMetabolites ; public ArrayList < Species > allSpecies ; public SMetabolites ( ) { } public void setDatabase ( String name ) { } public void setModel ( Model model ) { } public void parseAllMetabolites ( ) { } public Species getSpecies ( String mName ) { } public void devModel ( ) { } } public class SReactions { public Model model ; public ArrayList < SBMLReaction > allReactions ; public SReactions ( ) { } public void setModel ( Model model ) { } public void parseAllReactions ( ) { } public void devModel ( ) { } } class XMLFileFilter extends FileFilter { public boolean accept ( File f ) { } public String getDescription ( ) { } } }

Fix:
int option = chooser . showSaveDialog ( output ) ;