class ReporterHandler extends java.util.logging.Handler implements Callable<JButton>, ActionListener {

    private Throwable throwable;
    private final String MEMORY_ERROR;

    public ReporterHandler() {
        MEMORY_ERROR = NbBundle.getMessage(ReporterHandler.class, "OutOfMemoryError.message");
    }

    protected static String createMessage(Throwable thr) {
        //ignore causes with empty stacktraces -> they are just annotations
        while ((thr.getCause() != null) && (thr.getCause().getStackTrace().length != 0)) {
            thr = thr.getCause();
        }
        String message = thr.toString();
        if (message.startsWith("java.lang.")) {
            message = message.substring(10);
        }
        int indexClassName = message.indexOf(':');
        if (indexClassName == -1) { // there is no message after className
            if (thr.getStackTrace().length != 0) {
                StackTraceElement elem = thr.getStackTrace()[0];
                return message + " at " + elem.getClassName() + "." + elem.getMethodName();
            }
        }
        return message;
    }

    @Override
    public void publish(LogRecord record) {<FILL_FUNCTION_BODY>}

    @Override
    public void flush() {
    }

    @Override
    public void close() throws SecurityException {
        throwable = null;
    }

    @Override
    public JButton call() throws Exception {
        JButton btn = new JButton(NbBundle.getMessage(ReporterHandler.class, "ReportHandler.button"));
        btn.addActionListener(this);
        return btn;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        Report report = new Report();
        report.setThrowable(throwable);
        report.setSummary(createMessage(throwable));
        ReportPanel panel = new ReportPanel(report);
        panel.showDialog();
    }
}

        if (record.getThrown() == null) {
            return;
        }
        throwable = record.getThrown();
        if (throwable != null && throwable instanceof OutOfMemoryError) {
            Handler[] handlers = Logger.getLogger("").getHandlers();
            for (int i = 0; i < handlers.length; i++) {
                Handler h = handlers[i];
                h.close();
            }
            NotifyDescriptor nd = new NotifyDescriptor.Message(MEMORY_ERROR, NotifyDescriptor.ERROR_MESSAGE);
            DialogDisplayer.getDefault().notify(nd);
            LifecycleManager.getDefault().exit();
        }
    
<methods>public abstract void close() throws java.lang.SecurityException,public abstract void flush() ,public java.lang.String getEncoding() ,public java.util.logging.ErrorManager getErrorManager() ,public java.util.logging.Filter getFilter() ,public java.util.logging.Formatter getFormatter() ,public java.util.logging.Level getLevel() ,public boolean isLoggable(java.util.logging.LogRecord) ,public abstract void publish(java.util.logging.LogRecord) ,public synchronized void setEncoding(java.lang.String) throws java.lang.SecurityException, java.io.UnsupportedEncodingException,public synchronized void setErrorManager(java.util.logging.ErrorManager) ,public synchronized void setFilter(java.util.logging.Filter) throws java.lang.SecurityException,public synchronized void setFormatter(java.util.logging.Formatter) throws java.lang.SecurityException,public synchronized void setLevel(java.util.logging.Level) throws java.lang.SecurityException<variables>private volatile java.lang.String encoding,private volatile java.util.logging.ErrorManager errorManager,private volatile java.util.logging.Filter filter,private volatile java.util.logging.Formatter formatter,private volatile java.util.logging.Level logLevel,private final java.util.logging.LogManager manager,private static final int offValue