Example usage for java.util TooManyListenersException getMessage

List of usage examples for java.util TooManyListenersException getMessage

Introduction

In this page you can find the example usage for java.util TooManyListenersException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.qspin.qtaste.ui.TestCaseTree.java

public TestCaseTree(TestCasePane testCasePn) {
    super();/*  w  w  w  .j  a  v a 2  s.c o  m*/
    mTestCaseTree = this;
    this.setCellRenderer(new TestCaseTreeCellRenderer());

    testCasePane = testCasePn;
    testCasePane.setTestCaseTree(this);
    ToolTipManager.sharedInstance().registerComponent(this);

    FileNode rootFileNode = createRootFileNode();

    TCTreeNode rootNode = new TCTreeNode(rootFileNode, true);
    DefaultTreeModel tm = new DefaultTreeModel(rootNode);
    setModel(tm);
    generateScriptsTree(rootFileNode);
    TCTreeListener listener = new TCTreeListener();
    this.addMouseListener(listener);
    addTreeWillExpandListener(listener);
    addTreeSelectionListener(listener);
    TreeSelectionModel selModel = this.getSelectionModel();
    selModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    // drag drop initialization
    ds = new DragSource();
    dt = new DropTarget();

    ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, this);
    try {
        dt.setComponent(this);
        dt.addDropTargetListener(this);
    } catch (java.util.TooManyListenersException e) {
        logger.error(e.getMessage());
    }

}

From source file:org.energy_home.jemma.javagal.layers.data.implementations.SerialCommRxTx.java

/**
 * @inheritDoc/*from  w w w .j  a  v a 2  s  .  c  om*/
 */
private boolean connect(String portName, int speed) throws Exception {

    try {
        System.setProperty("gnu.io.rxtx.SerialPorts", portName);
        portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
        if (portIdentifier.isCurrentlyOwned()) {
            logger.error("Error: Port is currently in use:" + portName);
            disconnect();
            return false;
        } else {

            serialPort = (SerialPort) portIdentifier.open(this.getClass().getName(), 2000);
            if (serialPort instanceof SerialPort) {
                /*Freescale code*/
                serialPort.setSerialPortParams(speed, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
                        SerialPort.PARITY_NONE);
                serialPort.setFlowControlMode(
                        SerialPort.FLOWCONTROL_RTSCTS_IN | SerialPort.FLOWCONTROL_RTSCTS_OUT);
                serialPort.setRTS(true);
                serialPort.setDTR(true);
                serialPort.enableReceiveTimeout(1000);
                in = serialPort.getInputStream();
                serialReader = new SerialReader(in, this);
                try {
                    serialPort.addEventListener(serialReader);
                } catch (TooManyListenersException e) {
                    disconnect();
                    throw new Exception("Error Too Many Listeners Exception on  serial port:" + e.getMessage());
                }
                serialPort.notifyOnDataAvailable(true);
                if (DataLayer.getPropertiesManager().getDebugEnabled())
                    logger.info("Connection on " + portName + " established");

                /*
                serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
                serialPort.setSerialPortParams(speed, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
                in = serialPort.getInputStream();
                serialReader = new SerialReader(in, this);
                try {
                   serialPort.addEventListener(serialReader);
                } catch (TooManyListenersException e) {
                   disconnect();
                   throw new Exception("Error Too Many Listeners Exception on  serial port:" + e.getMessage());
                }
                serialPort.notifyOnDataAvailable(true);
                if (DataLayer.getPropertiesManager().getDebugEnabled())
                   logger.info("Connection on " + portName + " established");
                */
                return true;
            } else {
                if (DataLayer.getPropertiesManager().getDebugEnabled())
                    logger.error("Error on serial port connection:" + portName);
                disconnect();
                return false;
            }
        }

    } catch (NoSuchPortException e) {
        if (DataLayer.getPropertiesManager().getDebugEnabled())
            logger.error("the connection could not be made: NoSuchPortException " + portName);
        disconnect();
        return false;
    } catch (PortInUseException e) {
        if (DataLayer.getPropertiesManager().getDebugEnabled())
            logger.error("the connection could not be made: PortInUseException");
        disconnect();
        return false;
    } catch (UnsupportedCommOperationException e) {
        if (DataLayer.getPropertiesManager().getDebugEnabled())
            logger.error("the connection could not be made: UnsupportedCommOperationException");
        disconnect();
        return false;
    }

}

From source file:org.openhab.binding.dscalarm.internal.handler.IT100BridgeHandler.java

/**
 * Set the serial event handler.//from   w  w  w. j av  a 2  s  . c o m
 *
 * @param serialPortEventListenser
 */
private void setSerialEventHandler(SerialPortEventListener serialPortEventListenser) {
    try {
        // Add the serial port event listener
        serialPort.addEventListener(serialPortEventListenser);
        serialPort.notifyOnDataAvailable(true);
    } catch (TooManyListenersException tooManyListenersException) {
        logger.error("setSerialEventHandler(): Too Many Listeners Exception: {}",
                tooManyListenersException.getMessage());
    }
}