Buggy code:
public class ActionSaveGraphics extends UMLAction { public static ActionSaveGraphics SINGLETON = new ActionSaveGraphics ( ) ; public static final String separator = "//" ; protected ActionSaveGraphics ( ) { } public void actionPerformed ( ActionEvent ae ) { } public boolean trySave ( boolean overwrite ) { <START_BUG> Object target = TheInstance . getTarget ( ) ; <END_BUG> if ( target instanceof Diagram ) { String defaultName = ( ( Diagram ) ( target ) ) . getName ( ) ; defaultName = Util . stripJunk ( defaultName ) ; ProjectBrowser pb = ProjectBrowser . TheInstance ; Project p = pb . getProject ( ) ; try { JFileChooser chooser = null ; try { if ( ( ( p != null ) && ( ( p . getURL ( ) ) != null ) ) && ( ( p . getURL ( ) . getFile ( ) . length ( ) ) > 0 ) ) { String filename = p . getURL ( ) . getFile ( ) ; if ( ! ( filename . startsWith ( "//FILE1//+//" ) ) ) chooser = new JFileChooser ( p . getURL ( ) . getFile ( ) ) ; } } catch ( Exception ex ) { System . out . println ( "exception<seq2seq4repair_space>in<seq2seq4repair_space>opening<seq2seq4repair_space>JFileChooser" ) ; ex . printStackTrace ( ) ; } if ( chooser == null ) chooser = new JFileChooser ( ) ; chooser . setDialogTitle ( ( "Save<seq2seq4repair_space>Diagram<seq2seq4repair_space>as<seq2seq4repair_space>Graphics:<seq2seq4repair_space>" + defaultName ) ) ; chooser . addChoosableFileFilter ( GIFFilter ) ; chooser . addChoosableFileFilter ( PSFilter ) ; chooser . addChoosableFileFilter ( EPSFilter ) ; chooser . addChoosableFileFilter ( SVGFilter ) ; chooser . setFileFilter ( GIFFilter ) ; File def = new File ( ( ( defaultName + "." ) + ( GIFFilter . _suffix ) ) ) ; chooser . setSelectedFile ( def ) ; int retval = chooser . showSaveDialog ( pb ) ; if ( retval == 0 ) { File theFile = chooser . getSelectedFile ( ) ; if ( theFile != null ) { String path = theFile . getParent ( ) ; String name = theFile . getName ( ) ; String extension = SuffixFilter . getExtension ( name ) ; CmdSaveGraphics cmd = null ; if ( _suffix . equals ( extension ) ) cmd = new CmdSavePS ( ) ; else if ( FileFilters . EPSFilter . _suffix . equals ( extension ) ) cmd = new CmdSaveEPS ( ) ; else if ( FileFilters . GIFFilter . _suffix . equals ( extension ) ) cmd = new CmdSaveGIF ( ) ; else if ( FileFilters . SVGFilter . _suffix . equals ( extension ) ) cmd = new CmdSaveSVG ( ) ; else { pb . showStatus ( ( "Unknown<seq2seq4repair_space>graphics<seq2seq4repair_space>file<seq2seq4repair_space>type<seq2seq4repair_space>withextension<seq2seq4repair_space>" + extension ) ) ; return false ; } if ( ! ( path . endsWith ( ActionSaveGraphics . separator ) ) ) path += ActionSaveGraphics . separator ; pb . showStatus ( ( ( ( "Writing<seq2seq4repair_space>" + path ) + name ) + "..." ) ) ; if ( ( theFile . exists ( ) ) && ( ! overwrite ) ) { System . out . println ( ( ( "Are<seq2seq4repair_space>you<seq2seq4repair_space>sure<seq2seq4repair_space>you<seq2seq4repair_space>want<seq2seq4repair_space>to<seq2seq4repair_space>overwrite<seq2seq4repair_space>" + name ) + "?" ) ) ; String t = ( "Overwrite<seq2seq4repair_space>" + path ) + name ; int response = JOptionPane . showConfirmDialog ( pb , t , t , JOptionPane . YES_NO_OPTION ) ; if ( response == ( JOptionPane . NO_OPTION ) ) return false ; } FileOutputStream fo = new FileOutputStream ( theFile ) ; cmd . setStream ( fo ) ; cmd . doIt ( ) ; fo . close ( ) ; pb . showStatus ( ( ( "Wrote<seq2seq4repair_space>" + path ) + name ) ) ; return true ; } } } catch ( FileNotFoundException ignore ) { System . out . println ( "got<seq2seq4repair_space>a<seq2seq4repair_space>FileNotFoundException" ) ; } catch ( IOException ignore ) { System . out . println ( "got<seq2seq4repair_space>an<seq2seq4repair_space>IOException" ) ; ignore . printStackTrace ( ) ; } } return false ; } }

Fix:
Object target = TheInstance . getActiveDiagram ( ) ;