boolean reportHandled = false; Enumeration names = phaseComponents.keys(); while ( names.hasMoreElements() ) { Component component = (Component) phaseComponents.get ( names.nextElement() ); if ( component instanceof ReportDisplay ) { if ( reportHandled ) { continue; } else { reportHandled = true; } } if ( component instanceof Distractable ) { ( (Distractable) component ).removeAllListeners(); }  }
    public void die() {        connected = false;        pump = null;        // shut down threads & sockets        try {            frame.removeAll();            socket.close();            in.close();            out.close();        } catch (IOException e) {            e.printStackTrace();        } catch (NullPointerException e) {            // not a big deal, just never connected        }        frame.setVisible(false);/* Avoid the infinite loop until we can fix this bug!!!        boolean disposed = false;        while ( !disposed ) {*/        {            try {                frame.dispose();/*                disposed = true;*/            }            catch ( Throwable error ) {                error.printStackTrace();                System.err.println( "Attempting to close the InputContext in java.client.Client#die()..." );                try {                    curPanel.getInputContext().endComposition();                }                catch ( Throwable thr ) {                    thr.printStackTrace();                    frame.dispose();                }            }        }        System.out.println("client: died");    }