//# 0 errors, 85 messages
//#
/*
    //#ErrorReportingThread.java:1:1: class: com.dmdirc.logger.ErrorReportingThread
    //#ErrorReportingThread.java:1:1: method: com.dmdirc.logger.ErrorReportingThread.com.dmdirc.logger.ErrorReportingThread__static_init
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc.logger;

import java.util.concurrent.BlockingQueue;

/**
 * Daemon thread which reports errors.
 *
 * @since 0.6.3m1
 * @author chris
 */
public class ErrorReportingThread extends Thread {

    /** The queue to retrieve errors from. */
    private final BlockingQueue<ProgramError> queue;

    /**
     * Thread used to report errors.
     *
     * @param queue Error queue
     */
    public ErrorReportingThread(final BlockingQueue<ProgramError> queue) {
        super("Error reporting thread");
    //#ErrorReportingThread.java:44: method: void com.dmdirc.logger.ErrorReportingThread.com.dmdirc.logger.ErrorReportingThread(BlockingQueue)
    //#input(void com.dmdirc.logger.ErrorReportingThread(BlockingQueue)): queue
    //#input(void com.dmdirc.logger.ErrorReportingThread(BlockingQueue)): this
    //#output(void com.dmdirc.logger.ErrorReportingThread(BlockingQueue)): this.queue
    //#post(void com.dmdirc.logger.ErrorReportingThread(BlockingQueue)): this.queue == queue
    //#post(void com.dmdirc.logger.ErrorReportingThread(BlockingQueue)): init'ed(this.queue)
        setDaemon(false);
    //#ErrorReportingThread.java:45: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.logger.ErrorReportingThread:setDaemon(bool)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.logger.ErrorReportingThread
    //#    method: void com.dmdirc.logger.ErrorReportingThread(BlockingQueue)
    //#    unanalyzed callee: void com.dmdirc.logger.ErrorReportingThread:setDaemon(bool)

        this.queue = queue;
    }
    //#ErrorReportingThread.java:48: end of method: void com.dmdirc.logger.ErrorReportingThread.com.dmdirc.logger.ErrorReportingThread(BlockingQueue)

    /** {@inheritDoc} */
    @Override
    public void run() {
        try {
            while (true) {
                final ProgramError error = queue.take();
    //#ErrorReportingThread.java:55: method: void com.dmdirc.logger.ErrorReportingThread.run()
    //#input(void run()): com.dmdirc.logger.ErrorManager__static_init.new ErrorManager(ErrorManager__static_init#1).errorListeners
    //#input(void run()): com.dmdirc.logger.ErrorReportStatus__static_init.new ErrorReportStatus(ErrorReportStatus__static_init#2).terminal
    //#input(void run()): com.dmdirc.logger.ErrorReportStatus__static_init.new ErrorReportStatus(ErrorReportStatus__static_init#3).terminal
    //#input(void run()): com.dmdirc.logger.ErrorReportStatus__static_init.new ErrorReportStatus(ErrorReportStatus__static_init#4).terminal
    //#input(void run()): com.dmdirc.ui.FatalErrorDialog$4__static_init.new int[](FatalErrorDialog$4__static_init#1).length
    //#input(void run()): com.dmdirc.ui.FatalErrorDialog$4__static_init.new int[](FatalErrorDialog$4__static_init#1)[0..4_294_967_295]
    //#input(void run()): com/dmdirc/logger/ErrorFixedStatus.FIXED
    //#input(void run()): com/dmdirc/logger/ErrorFixedStatus.INVALID
    //#input(void run()): com/dmdirc/logger/ErrorFixedStatus.KNOWN
    //#input(void run()): com/dmdirc/logger/ErrorFixedStatus.NEW
    //#input(void run()): com/dmdirc/logger/ErrorFixedStatus.TOOOLD
    //#input(void run()): com/dmdirc/logger/ErrorListener.__Descendant_Table[com/dmdirc/logger/ErrorListener]
    //#input(void run()): com/dmdirc/logger/ErrorListener.__Descendant_Table[com/dmdirc/ui/FatalErrorDialog]
    //#input(void run()): com/dmdirc/logger/ErrorListener.__Descendant_Table[others]
    //#input(void run()): com/dmdirc/logger/ErrorListener.__Dispatch_Table.errorStatusChanged(Lcom/dmdirc/logger/ProgramError;)V
    //#input(void run()): com/dmdirc/logger/ErrorManager.me
    //#input(void run()): com/dmdirc/logger/ErrorReportStatus.ERROR
    //#input(void run()): com/dmdirc/logger/ErrorReportStatus.FINISHED
    //#input(void run()): com/dmdirc/logger/ErrorReportStatus.QUEUED
    //#input(void run()): com/dmdirc/logger/ErrorReportStatus.SENDING
    //#input(void run()): com/dmdirc/logger/ProgramError.__Descendant_Table[com/dmdirc/logger/ProgramError]
    //#input(void run()): com/dmdirc/logger/ProgramError.__Descendant_Table[others]
    //#input(void run()): com/dmdirc/ui/FatalErrorDialog$4.$SwitchMap$com$dmdirc$logger$ErrorReportStatus
    //#input(void run()): com/dmdirc/ui/FatalErrorDialog.__Dispatch_Table.errorStatusChanged(Lcom/dmdirc/logger/ProgramError;)V
    //#input(void run()): this
    //#input(void run()): this.queue
    //#pre[2] (void run()): (soft) init'ed(com.dmdirc.ui.FatalErrorDialog$4__static_init.new int[](FatalErrorDialog$4__static_init#1)[0..4_294_967_295])
    //#pre[4] (void run()): (soft) this.queue != null
    //#presumption(void run()): error.fixedStatus@55 != null
    //#presumption(void run()): error.trace.length@55 <= 4_294_967_295
    //#presumption(void run()): error.trace@55 != null
    //#presumption(void run()): java.util.concurrent.BlockingQueue:take(...).__Tag@55 == com/dmdirc/logger/ProgramError
    //#presumption(void run()): java.util.concurrent.BlockingQueue:take(...)@55 != null
    //#unanalyzed(void run()): Effects-of-calling:getReportStatus
    //#unanalyzed(void run()): Effects-of-calling:java.util.Arrays:copyOf
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.logger.ErrorReportStatus:equals
    //#unanalyzed(void run()): Effects-of-calling:getErrorManager
    //#unanalyzed(void run()): Effects-of-calling:fireErrorStatusChanged
    //#unanalyzed(void run()): Effects-of-calling:java.lang.Object:notifyAll
    //#unanalyzed(void run()): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.logger.ErrorFixedStatus:equals
    //#unanalyzed(void run()): Effects-of-calling:java.util.List:isEmpty
    //#unanalyzed(void run()): Effects-of-calling:java.util.List:size
    //#unanalyzed(void run()): Effects-of-calling:java.util.List:get
    //#unanalyzed(void run()): Effects-of-calling:java.lang.String:equalsIgnoreCase
    //#unanalyzed(void run()): Effects-of-calling:java.lang.String:matches
    //#unanalyzed(void run()): Effects-of-calling:java.util.HashMap
    //#unanalyzed(void run()): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void run()): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void run()): Effects-of-calling:java.util.Arrays:toString
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.config.ConfigManager:getOption
    //#unanalyzed(void run()): Effects-of-calling:java.lang.Thread:sleep
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.util.Downloader:getPage
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.util.ListenerList:get
    //#unanalyzed(void run()): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void run()): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void run()): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.logger.ErrorReportStatus:ordinal
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JButton:setText
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JButton:setEnabled
    //#unanalyzed(void run()): Effects-of-calling:equals
    //#unanalyzed(void run()): Effects-of-calling:errorStatusChanged
    //#unanalyzed(void run()): Effects-of-calling:java.lang.Object:getClass
    //#unanalyzed(void run()): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void run()): Effects-of-calling:java.util.Arrays:equals
    //#test_vector(void run()): error.reportStatus@55: Inverse{&com.dmdirc.logger.ErrorReportStatus__static_init.new ErrorReportStatus(ErrorReportStatus__static_init#5)}, Addr_Set{&com.dmdirc.logger.ErrorReportStatus__static_init.new ErrorReportStatus(ErrorReportStatus__static_init#5)}

                if (error.getReportStatus() == ErrorReportStatus.QUEUED) {
                    error.send();
                }
            }
        } catch (InterruptedException ex) {
            // Do nothing
        }
    }
    //#ErrorReportingThread.java:64: end of method: void com.dmdirc.logger.ErrorReportingThread.run()

}
    //#output(com.dmdirc.logger.ErrorReportingThread__static_init): __Descendant_Table[com/dmdirc/logger/ErrorReportingThread]
    //#output(com.dmdirc.logger.ErrorReportingThread__static_init): __Dispatch_Table.run()V
    //#post(com.dmdirc.logger.ErrorReportingThread__static_init): __Descendant_Table[com/dmdirc/logger/ErrorReportingThread] == &__Dispatch_Table
    //#post(com.dmdirc.logger.ErrorReportingThread__static_init): __Dispatch_Table.run()V == &run
    //#ErrorReportingThread.java:: end of method: com.dmdirc.logger.ErrorReportingThread.com.dmdirc.logger.ErrorReportingThread__static_init
    //#ErrorReportingThread.java:: end of class: com.dmdirc.logger.ErrorReportingThread
