Example usage for java.lang InterruptedException getLocalizedMessage

List of usage examples for java.lang InterruptedException getLocalizedMessage

Introduction

In this page you can find the example usage for java.lang InterruptedException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.zenoss.zep.index.impl.EventIndexDaoImplIT.java

@Test
public void testSavedSearchTimeout() throws ZepException {
    /*/*ww w.ja  v  a 2  s.co  m*/
     * Verifies the behavior of a saved search to ensure it is not expired
     * during a long database operation. This test creates a saved search
     * with a short timeout of 1 second. Then it performs three queries on
     * the saved search in quick succession with the database DAO mocked
     * out to make the query take longer than 1 second on the first call.
     * Previously, this would cause the saved search to time out before
     * the second call could be issued. Now the behavior will disable the
     * timeout of the saved search until after the query returns.
     */
    EventSummary.Builder summaryBuilder = EventSummary
            .newBuilder(createArchiveClosed(EventTestUtils.createSampleEvent()));
    EventSummary summary = summaryBuilder.build();
    eventArchiveIndexDao.index(summary);

    final EventArchiveDao archiveDao = applicationContext.getBean(EventArchiveDao.class);

    // Create a mock of the current archive dao (override findByUuids to take longer)
    EventArchiveDao mockArchiveDao = new EventArchiveDao() {
        private AtomicBoolean initialDelay = new AtomicBoolean();

        @Override
        public String create(Event event, EventPreCreateContext context) throws ZepException {
            return archiveDao.create(event, context);
        }

        @Override
        public EventSummary findByUuid(String uuid) throws ZepException {
            return archiveDao.findByUuid(uuid);
        }

        @Override
        public List<EventSummary> findByUuids(List<String> uuids) throws ZepException {
            // Delay the first call to findByUuids
            if (initialDelay.compareAndSet(false, true)) {
                try {
                    Thread.sleep(1500L);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    throw new ZepException(e.getLocalizedMessage(), e);
                }
            }
            return archiveDao.findByUuids(uuids);
        }

        @Override
        public List<EventSummary> findByKey(Collection<EventSummary> toLookup) throws ZepException {
            // Delay the first call to findByUuids
            if (initialDelay.compareAndSet(false, true)) {
                try {
                    Thread.sleep(1500L);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    throw new ZepException(e.getLocalizedMessage(), e);
                }
            }
            return archiveDao.findByKey(toLookup);
        }

        @Override
        public int addNote(String uuid, EventNote note) throws ZepException {
            return archiveDao.addNote(uuid, note);
        }

        @Override
        public int updateDetails(String uuid, EventDetailSet details) throws ZepException {
            return archiveDao.updateDetails(uuid, details);
        }

        @Override
        public EventBatch listBatch(EventBatchParams batchParams, long maxUpdateTime, int limit)
                throws ZepException {
            return archiveDao.listBatch(batchParams, maxUpdateTime, limit);
        }

        @Override
        public void importEvent(EventSummary eventSummary) throws ZepException {
            archiveDao.importEvent(eventSummary);
        }

        @Override
        public void initializePartitions() throws ZepException {
            archiveDao.initializePartitions();
        }

        @Override
        public long getPartitionIntervalInMs() {
            return archiveDao.getPartitionIntervalInMs();
        }

        @Override
        public void purge(int duration, TimeUnit unit) throws ZepException {
            archiveDao.purge(duration, unit);
        }
    };

    EventQuery.Builder queryBuilder = EventQuery.newBuilder();
    queryBuilder.setTimeout(1);
    EventQuery query = queryBuilder.build();
    String searchUuid = this.eventArchiveIndexDao.createSavedSearch(query);

    try {
        ReflectionTestUtils.setField(this.eventArchiveLuceneIndexBackend, "eventSummaryBaseDao",
                mockArchiveDao);
        for (int i = 0; i < 3; i++) {
            EventSummaryResult result = this.eventArchiveIndexDao.savedSearch(searchUuid, 0, 1000);
            assertEquals(1, result.getTotal());
            assertEquals(summary.getUuid(), result.getEvents(0).getUuid());
        }
    } finally {
        ReflectionTestUtils.setField(this.eventArchiveLuceneIndexBackend, "eventSummaryBaseDao", archiveDao);
        this.eventArchiveIndexDao.deleteSavedSearch(searchUuid);
    }
}

From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java

/**
 * Verndere das Datenverzeichnis ggf mit Verschiebung der Daten Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * //from   www. jav  a2s.  co m
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 03.08.2012
 * @throws NoDatabaseException
 */
private void testMoveDatafiles() throws NoDatabaseException {
    File srcDir, destDir;
    //
    // woher und wohin?
    //
    lg.debug("test to move Files...");
    srcDir = new File(SpxPcloggerProgramConfig.databaseDir.getAbsolutePath());
    destDir = new File(databaseDirTextField.getText());
    if (destDir.getAbsolutePath().equals(srcDir.getAbsolutePath())) {
        // Kein Grund zur Veranlassung, Gleicheit
        lg.info("no move, directory not changed...");
        return;
    }
    if (databaseUtil != null) {
        databaseUtil.closeDB();
        try {
            // Gib dem Thread etwas Zeit zum beenden
            Thread.sleep(1200);
        } catch (InterruptedException ex) {
        }
        databaseUtil = null;
    }
    try {
        lg.debug("copy directoy <" + srcDir.getAbsolutePath() + "> to <" + destDir.getAbsolutePath() + ">...");
        FileUtils.copyDirectory(srcDir, destDir);
    } catch (IOException ex) {
        if ((!destDir.exists()) || (!destDir.isDirectory())) {
            lg.error("Destination Folder <" + destDir.getName() + "> is not exist or not a directory!");
            throw new NoDatabaseException(
                    LangStrings.getString("ProgramPropertysDialog.database.isNotexistOrDir.text"));
        }
        if ((!srcDir.exists()) || (!srcDir.isDirectory())) {
            lg.error("Source Folder <" + srcDir.getName() + "> is not exist or not a directory!");
            throw new NoDatabaseException(
                    LangStrings.getString("ProgramPropertysDialog.database.srcIsNotexistOrDir.text"));
        }
        showErrorDialog(ex.getLocalizedMessage());
    }
    // if (!destDir.exists())
    // {
    // // Gibts das noch nicht?
    // lg.debug("make directorys...");
    // destDir.mkdirs();
    // }
    // // geht das nun?
    // if (destDir.exists() && destDir.isDirectory() && srcDir.exists() && srcDir.isDirectory())
    // {
    // lg.debug("all directorys exists...");
    // // ja hier geht was
    // // nach dem nchsten Programmstart dieses File anlegen/nutzen
    // SpxPcloggerProgramConfig.databaseDir = destDir;
    // lg.debug("select <" + destDir.getName() + "> as new datadir after restart.");
    // //
    // // sollen die Daten noch verschoben werden?
    // //
    // if (moveDataCheckBox.isSelected())
    // {
    // // dann wolln wir mal...
    // lg.debug("try to move Files...");
    // fileList = srcDir.listFiles();
    // for (File theFile : fileList)
    // {
    // if (theFile.renameTo(new File(destDir.getAbsolutePath() + System.getProperty("file.separator") + theFile.getName())))
    // {
    // lg.info("File <" + theFile.getName() + "> was moved to " + System.getProperty("file.separator") + destDir.getAbsolutePath());
    // }
    // else
    // {
    // moveWasOk = false;
    // lg.error("File <" + theFile.getName() + "> was NOT moved to " + destDir.getAbsolutePath());
    // }
    // }
    // // So, daten verschoben (voraussichtlich)
    // if (moveWasOk)
    // {
    // // Ok, also knnte das alte Verzeichnis ja weg...
    // lg.debug("source directory can be deleted...");
    // fileList = srcDir.listFiles();
    // if (fileList.length == 0)
    // {
    // lg.debug("source directory is empty, delete directory...");
    // // Dateien sind auch nicht mehr brig...
    // if (srcDir.delete())
    // {
    // lg.debug("source directory is empty, delete directory...OK");
    // }
    // }
    // else
    // {
    // lg.info("source directory is NOT empty, can NOT delete directory...");
    // }
    // }
    // }
    // }
    // else
    // {
    // if ((!destDir.exists()) || (!destDir.isDirectory()))
    // {
    // lg.error("Destination Folder <" + destDir.getName() + "> is not exist or not a directory!");
    // throw new NoDatabaseException(LangStrings.getString("ProgramPropertysDialog.database.isNotexistOrDir.text"));
    // }
    // if ((!srcDir.exists()) || (!srcDir.isDirectory()))
    // {
    // lg.error("Source Folder <" + srcDir.getName() + "> is not exist or not a directory!");
    // throw new NoDatabaseException(LangStrings.getString("ProgramPropertysDialog.database.srcIsNotexistOrDir.text"));
    // }
    // }
}

From source file:com.honeywell.printer.net.autobaln_websocket.WebSocketConnection.java

private void connect() {
    mSocketThread = new SocketThread(mWebSocketURI, mWebSocketOptions);

    mSocketThread.start();/*from w  w w . jav  a  2  s.  c  o m*/
    synchronized (mSocketThread) {
        try {
            mSocketThread.wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    mSocketThread.getHandler().post(new Runnable() {

        @Override
        public void run() {
            mSocketThread.startConnection();
        }
    });

    synchronized (mSocketThread) {
        try {
            mSocketThread.wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    this.mSocket = mSocketThread.getSocket();

    if (mSocket == null) {
        onClose(WebSocketCloseNotification.CANNOT_CONNECT, mSocketThread.getFailureMessage());
        //            Loger.print(TAG, "ssd close ******** ", Thread.currentThread());
    } else if (mSocket.isConnected()) {
        try {
            createReader();
            createWriter();

            WebSocketMessage.ClientHandshake clientHandshake = new WebSocketMessage.ClientHandshake(
                    mWebSocketURI, null, mWebSocketSubprotocols);
            clientHandshake.mHeaderList = mWsHeaders;
            //                Loger.print(TAG, "************** ssd start websocket ***********", Thread.currentThread());
            mWebSocketWriter.forward(clientHandshake);
        } catch (Exception e) {
            onClose(WebSocketCloseNotification.INTERNAL_ERROR, e.getLocalizedMessage());
            e.printStackTrace();
        }
    } else {
        onClose(WebSocketCloseNotification.CANNOT_CONNECT, "could not connect to WebSockets server");
        //            Loger.print(TAG, "ssd close ******** ", Thread.currentThread());
    }
}

From source file:org.openconcerto.sql.model.SQLDataSource.java

private Connection getRawConnection() {
    assert !Thread.holdsLock(
            this) : "super.getConnection() might block (see setWhenExhaustedAction()), and since return/closeConnection() need this lock, this method cannot wait while holding the lock";
    Connection result = null;//w  w w .java  2s .c  o m
    try {
        result = super.getConnection();
    } catch (SQLException e1) {
        // try to know if interrupt, TODO cleanup : patch pg Driver.java to fill the cause
        if (e1.getCause() instanceof InterruptedException
                || (e1 instanceof PSQLException && e1.getMessage().equals(pgInterrupted))) {
            throw new RTInterruptedException(e1);
        }
        final int retryWait = this.retryWait;
        if (retryWait == 0)
            throw new IllegalStateException("Impossible d'obtenir une connexion sur " + this, e1);
        try {
            // on attend un petit peu
            Thread.sleep(retryWait * 1000);
            // avant de ressayer
            result = super.getConnection();
        } catch (InterruptedException e) {
            throw new RTInterruptedException("interrupted while waiting for a second try", e);
        } catch (Exception e) {
            throw new IllegalStateException(
                    "Impossible d'obtenir une connexion sur " + this + ": " + e.getLocalizedMessage(), e1);
        }
    }
    if (State.DEBUG)
        State.INSTANCE.connectionCreated();
    return result;
}

From source file:org.apache.kylin.storage.hbase.steps.MergeGCStep.java

@Override
protected ExecuteResult doWork(ExecutableContext context) throws ExecuteException {

    try {/*from  w  w  w . j  a va  2  s  .  co  m*/
        logger.info("Sleep one minute before deleting the Htables");
        Thread.sleep(60000);
    } catch (InterruptedException e) {
        logger.warn("Thread interrupted");
    }

    logger.info("Start doing merge gc work");

    StringBuffer output = new StringBuffer();
    List<String> oldTables = getOldHTables();
    if (oldTables != null && oldTables.size() > 0) {
        String metadataUrlPrefix = KylinConfig.getInstanceFromEnv().getMetadataUrlPrefix();
        Admin admin = null;
        try {
            Connection conn = HBaseConnection.get(KylinConfig.getInstanceFromEnv().getStorageUrl());
            admin = conn.getAdmin();

            for (String table : oldTables) {
                if (admin.tableExists(TableName.valueOf(table))) {
                    HTableDescriptor tableDescriptor = admin.getTableDescriptor(TableName.valueOf((table)));
                    String host = tableDescriptor.getValue(IRealizationConstants.HTableTag);
                    if (metadataUrlPrefix.equalsIgnoreCase(host)) {
                        if (admin.isTableEnabled(TableName.valueOf(table))) {
                            admin.disableTable(TableName.valueOf(table));
                        }
                        admin.deleteTable(TableName.valueOf(table));
                        logger.debug("Dropped htable: " + table);
                        output.append("HBase table " + table + " is dropped. \n");
                    } else {
                        logger.debug("Skip htable: " + table);
                        output.append("Skip htable: " + table + ". \n");
                    }
                }
            }

        } catch (IOException e) {
            output.append("Got error when drop HBase table, exiting... \n");
            // This should not block the merge job; Orphans should be cleaned up in StorageCleanupJob
            return new ExecuteResult(ExecuteResult.State.ERROR,
                    output.append(e.getLocalizedMessage()).toString());
        } finally {
            if (admin != null)
                try {
                    admin.close();
                } catch (IOException e) {
                    logger.error(e.getLocalizedMessage());
                }
        }
    }

    return new ExecuteResult(ExecuteResult.State.SUCCEED, output.toString());
}

From source file:org.openconcerto.sql.model.SQLDataSource.java

private Object[] executeTwice(QueryInfo queryInfo) throws SQLException {
    final String query = queryInfo.getQuery();
    Object[] res;/*from w  ww. j  a v a  2  s  . c om*/
    try {
        res = executeOnce(query, queryInfo.getConnection());
    } catch (SQLException exn) {
        if (State.DEBUG)
            State.INSTANCE.addFailedRequest(query);
        // maybe this was a network problem, so wait a little
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            throw new RTInterruptedException(e.getMessage() + " : " + query, exn);
        }
        // and try to obtain a new connection
        try {
            final Connection otherConn = queryInfo.obtainNewConnection();
            if (otherConn != null) {
                res = executeOnce(query, otherConn);
            } else
                throw exn;
        } catch (Exception e) {
            if (e == exn)
                throw exn;
            else
                throw new SQLException("second exec failed: " + e.getLocalizedMessage(), exn);
        }
        // only log if the second succeeds (otherwise it's thrown)
        Log.get().log(Level.INFO, "executeOnce() failed for " + queryInfo, exn);
    }
    return res;
}

From source file:piuk.blockchain.android.WalletApplication.java

public void getBalances(final String[] addresses, final boolean notifications,
        final ObjectSuccessCallback callback) {
    new Thread(new Runnable() {
        public void run() {
            try {
                String response = null;

                try {
                    response = MyRemoteWallet.getBalances(addresses, notifications);
                } catch (Exception e) {
                    e.printStackTrace();

                    try {
                        //Sleep for a bit and retry
                        Thread.sleep(5000);
                    } catch (InterruptedException e1) {
                        e1.printStackTrace();
                    }/* w w w .j  a  va2s . c o  m*/

                    try {
                        response = MyRemoteWallet.getBalances(addresses, notifications);
                    } catch (Exception e1) {
                        e1.printStackTrace();

                        EventListeners.invokeOnMultiAddrError();

                        if (callback != null)
                            callback.onFail(e1.getLocalizedMessage());

                        return;
                    }
                }

                if (callback != null) {
                    try {
                        callback.onSuccess((JSONObject) new JSONParser().parse(response));
                    } catch (ParseException e) {
                        callback.onFail(e.getLocalizedMessage());
                    }
                }

                handler.post(new Runnable() {
                    public void run() {
                        notifyWidgets();
                    }
                });
            } finally {
            }
        }
    }).start();
}

From source file:com.iiordanov.bVNC.RemoteCanvas.java

/**
 * Create a view showing a remote desktop connection
 * @param context Containing context (activity)
 * @param bean Connection settings/*from  w  ww .j av a2 s . c  om*/
 * @param setModes Callback to run on UI thread after connection is set up
 */
void initializeCanvas(ConnectionBean bean, Database db, final Runnable setModes) {
    this.setModes = setModes;
    connection = bean;
    database = db;
    decoder.setColorModel(COLORMODEL.valueOf(bean.getColorModel()));

    // Startup the connection thread with a progress dialog
    pd = ProgressDialog.show(getContext(), getContext().getString(R.string.info_progress_dialog_connecting),
            getContext().getString(R.string.info_progress_dialog_establishing), true, true,
            new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    closeConnection();
                    handler.post(new Runnable() {
                        public void run() {
                            Utils.showFatalErrorMessage(getContext(),
                                    getContext().getString(R.string.info_progress_dialog_aborted));
                        }
                    });
                }
            });

    // Make this dialog cancellable only upon hitting the Back button and not touching outside.
    pd.setCanceledOnTouchOutside(false);

    Thread t = new Thread() {
        public void run() {
            try {
                // Initialize SSH key if necessary
                if (connection.getConnectionType() == Constants.CONN_TYPE_SSH
                        && connection.getSshHostKey().equals("")
                        && Utils.isNullOrEmptry(connection.getIdHash())) {
                    handler.sendEmptyMessage(Constants.DIALOG_SSH_CERT);

                    // Block while user decides whether to accept certificate or not.
                    // The activity ends if the user taps "No", so we block indefinitely here.
                    synchronized (RemoteCanvas.this) {
                        while (connection.getSshHostKey().equals("")) {
                            try {
                                RemoteCanvas.this.wait();
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                        }
                    }
                }

                if (isSpice) {
                    startSpiceConnection();
                } else if (isRdp) {
                    startRdpConnection();
                } else {
                    startVncConnection();
                }
            } catch (Throwable e) {
                if (maintainConnection) {
                    Log.e(TAG, e.toString());
                    e.printStackTrace();
                    // Ensure we dismiss the progress dialog before we finish
                    if (pd.isShowing())
                        pd.dismiss();

                    if (e instanceof OutOfMemoryError) {
                        disposeDrawable();
                        showFatalMessageAndQuit(getContext().getString(R.string.error_out_of_memory));
                    } else {
                        String error = getContext().getString(R.string.error_connection_failed);
                        if (e.getMessage() != null) {
                            if (e.getMessage().indexOf("SSH") < 0
                                    && (e.getMessage().indexOf("authentication") > -1
                                            || e.getMessage().indexOf("Unknown security result") > -1
                                            || e.getMessage().indexOf("password check failed") > -1)) {
                                error = getContext().getString(R.string.error_vnc_authentication);
                            }
                            error = error + "<br>" + e.getLocalizedMessage();
                        }
                        showFatalMessageAndQuit(error);
                    }
                }
            }
        }
    };
    t.start();

    clipboardMonitor = new ClipboardMonitor(getContext(), this);
    if (clipboardMonitor != null) {
        clipboardMonitorTimer = new Timer();
        if (clipboardMonitorTimer != null) {
            try {
                clipboardMonitorTimer.schedule(clipboardMonitor, 0, 500);
            } catch (NullPointerException e) {
            }
        }
    }
}

From source file:com.iiordanov.runsoft.bVNC.RemoteCanvas.java

/**
 * Create a view showing a remote desktop connection
 * @param context Containing context (activity)
 * @param bean Connection settings//from   w  w w.  ja v a2  s. co  m
 * @param setModes Callback to run on UI thread after connection is set up
 */
void initializeCanvas(ConnectionBean bean, Database db, final Runnable setModes) {
    this.setModes = setModes;
    connection = bean;
    database = db;
    decoder.setColorModel(COLORMODEL.valueOf(bean.getColorModel()));

    // Startup the connection thread with a progress dialog
    pd = ProgressDialog.show(getContext(), getContext().getString(R.string.info_progress_dialog_connecting),
            getContext().getString(R.string.info_progress_dialog_establishing), true, true,
            new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    closeConnection();
                    handler.post(new Runnable() {
                        public void run() {
                            Utils.showFatalErrorMessage(getContext(),
                                    getContext().getString(R.string.info_progress_dialog_aborted));
                        }
                    });
                }
            });

    // Make this dialog cancellable only upon hitting the Back button and not touching outside.
    pd.setCanceledOnTouchOutside(false);

    Thread t = new Thread() {
        public void run() {
            try {
                // Initialize SSH key if necessary
                if (connection.getConnectionType() == Constants.CONN_TYPE_SSH
                        && connection.getSshHostKey().equals("")
                        && Utils.isNullOrEmptry(connection.getIdHash())) {
                    handler.sendEmptyMessage(Constants.DIALOG_SSH_CERT);

                    // Block while user decides whether to accept certificate or not.
                    // The activity ends if the user taps "No", so we block indefinitely here.
                    synchronized (RemoteCanvas.this) {
                        while (connection.getSshHostKey().equals("")) {
                            try {
                                RemoteCanvas.this.wait();
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                        }
                    }
                }

                if (isSpice) {
                    startSpiceConnection();
                } else if (isRdp) {
                    startRdpConnection();
                } else {
                    startVncConnection();
                }
            } catch (Throwable e) {
                if (maintainConnection) {
                    Log.e(TAG, e.toString());
                    e.printStackTrace();
                    // Ensure we dismiss the progress dialog before we finish
                    if (pd.isShowing())
                        pd.dismiss();

                    if (e instanceof OutOfMemoryError) {
                        disposeDrawable();
                        showFatalMessageAndQuit(getContext().getString(R.string.error_out_of_memory));
                    } else {
                        String error = getContext().getString(R.string.error_connection_failed);
                        if (e.getMessage() != null) {
                            if (e.getMessage().indexOf("SSH") < 0
                                    && (e.getMessage().indexOf("authentication") > -1
                                            || e.getMessage().indexOf("Unknown security result") > -1
                                            || e.getMessage().indexOf("password check failed") > -1)) {
                                error = getContext().getString(R.string.error_vnc_authentication);
                            }
                            error = error + "<br>" + e.getLocalizedMessage();
                        }
                        showFatalMessageAndQuit(error);

                    }
                }
            }
        }

    };
    t.start();

    clipboardMonitor = new ClipboardMonitor(getContext(), this);
    if (clipboardMonitor != null) {
        clipboardMonitorTimer = new Timer();
        if (clipboardMonitorTimer != null) {
            try {
                clipboardMonitorTimer.schedule(clipboardMonitor, 0, 500);
            } catch (NullPointerException e) {
            }
        }
    }
}

From source file:com.etouch.cisco.common.CiscoMainPage_iPad.java

public void SignIn(TestParameters input) throws InterruptedException {
    final int MAX_WAIT = 20;
    try {//from ww w  . j a  v a2s.  c  o m
        try {
            Thread.sleep(8000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        WebElement element = driver.findElement(By.xpath(MainPageElements_ipad.UName_XPATH_ipad));
        element.click();
        element.sendKeys(input.getParamMap().get("uname"));

        if (TestBedManager.INSTANCE.getCurrentTestBed().getTestBedName().equalsIgnoreCase("iPhoneNativeSim")) {
            WebElement pwdelement = driver.findElement(By.xpath(MainPageElements_iphone.PWD_XPATH_ipad));
            pwdelement.click();
            pwdelement.sendKeys("April2014$");
        } else {
            WebElement pwdelement = driver.findElement(By.xpath(MainPageElements_ipad.PWD_XPATH_ipad));
            pwdelement.click();
            pwdelement.sendKeys(input.getParamMap().get("pwd"));
        }
        //pwdelement.sendKeys("Go");

        WebElement butElement = driver.findElement(By.xpath(MainPageElements_iphone.Login_BTN_XPATH_ipad));
        butElement.click();

        //System.out.println(butElement.getText());
        //WebElement butElement=driver.findElement(By.id("Log In"));

        //            WebElement element=driver.findElement(By.xpath(MainPageElements_ipad.UName_XPATH_ipad));
        //            element.click();
        //            element.sendKeys(input.getParamMap().get("uname"));
        //            
        //            element = driver.findElement(By.xpath(MainPageElements_ipad.PWD_XPATH_ipad));
        //            element.click();
        //            element.sendKeys(input.getParamMap().get("pwd"));
        //            
        //            WebElement butElement=driver.findElement(By.xpath(MainPageElements_ipad.Login_BTN_XPATH_ipad));
        //                  butElement.click();
        //            Thread.sleep(100);
    } catch (Exception e) {
        e.printStackTrace();
        System.out.println("Error: " + e.getLocalizedMessage());
    }
}