Example usage for java.lang Exception getStackTrace

List of usage examples for java.lang Exception getStackTrace

Introduction

In this page you can find the example usage for java.lang Exception getStackTrace.

Prototype

public StackTraceElement[] getStackTrace() 

Source Link

Document

Provides programmatic access to the stack trace information printed by #printStackTrace() .

Usage

From source file:com.castis.xylophone.adsmadapter.connectors.TambourineConnector.java

/**
 *  ? :  ?, dat ?? //from   www .  j  ava2s .c om
 * @param inventoryDataDTOList  dat
 * @param schedulerLog
 * @param previousSuccessLogList
 * @throws Exception
 */
public void insertInventoryData(List<InventoryDataDTO> inventoryDataDTOList, ADSMSchedulerLogDTO schedulerLog,
        List<ADSMSchedulerLogDTO> previousSuccessLogList) throws Exception {

    ADSMSchedulerLogDTO deleteSchedulerLog = null;
    try {
        int deleteSchedulerLogId = -1;
        if (previousSuccessLogList != null && previousSuccessLogList.size() > 0) {
            deleteSchedulerLog = startLog(ADSMJobNameType.COLLECT_DELETE_DATA.name(),
                    DeleteDataType.INVENTORY_DATA.name());

            if (deleteSchedulerLog == null) {
                throw new CiRuntimeException("deleteSchedulerLog ? ");
            } else {
                deleteSchedulerLogId = deleteSchedulerLog.getId();
            }
        }

        inventoryExportSysCompForAdapter.insertInventoryData(inventoryDataDTOList, schedulerLog,
                deleteSchedulerLogId, previousSuccessLogList);
        schedulerLog.setSchedulerStatus(ADSMSchedulerStatus.SUCCESS);
        if (deleteSchedulerLog != null) {
            deleteSchedulerLog.setSchedulerStatus(ADSMSchedulerStatus.SUCCESS);
        }
    } catch (Exception e) {
        if (deleteSchedulerLog != null) {
            deleteSchedulerLog.setMessage(e.getMessage());
            deleteSchedulerLog.setSchedulerStatus(ADSMSchedulerStatus.FAIL);
            StackTraceElement[] stackTraces = e.getStackTrace();
            if (stackTraces.length > 0) {
                String failProcess = stackTraces[0].getClassName() + " - " + stackTraces[0].getMethodName()
                        + "(" + stackTraces[0].getLineNumber() + ")";
                deleteSchedulerLog.setFailProcess(failProcess);
            }
        }
        throw e;
    } finally {
        if (deleteSchedulerLog != null)
            endLog(deleteSchedulerLog);
    }
}

From source file:org.apache.geode.internal.net.SSLSocketIntegrationTest.java

@Test
public void configureClientSSLSocketCanTimeOut() throws Exception {
    final Semaphore serverCoordination = new Semaphore(0);

    // configure a non-SSL server socket. We will connect
    // a client SSL socket to it and demonstrate that the
    // handshake times out
    final ServerSocket serverSocket = new ServerSocket();
    serverSocket.bind(new InetSocketAddress(SocketCreator.getLocalHost(), 0));
    Thread serverThread = new Thread() {
        public void run() {
            serverCoordination.release();
            try (Socket clientSocket = serverSocket.accept()) {
                System.out.println("server thread accepted a connection");
                serverCoordination.acquire();
            } catch (Exception e) {
                System.err.println("accept failed");
                e.printStackTrace();//from   ww  w  . java2 s  . c  o  m
            }
            try {
                serverSocket.close();
            } catch (IOException e) {
                // ignored
            }
            System.out.println("server thread is exiting");
        }
    };
    serverThread.setName("SocketCreatorJUnitTest serverSocket thread");
    serverThread.setDaemon(true);
    serverThread.start();

    serverCoordination.acquire();

    SocketCreator socketCreator = SocketCreatorFactory
            .getSocketCreatorForComponent(SecurableCommunicationChannel.SERVER);

    int serverSocketPort = serverSocket.getLocalPort();
    try {
        Awaitility.await("connect to server socket").atMost(30, TimeUnit.SECONDS).until(() -> {
            try {
                Socket clientSocket = socketCreator.connectForClient(
                        SocketCreator.getLocalHost().getHostAddress(), serverSocketPort, 2000);
                clientSocket.close();
                System.err.println(
                        "client successfully connected to server but should not have been able to do so");
                return false;
            } catch (SocketTimeoutException e) {
                // we need to verify that this timed out in the handshake
                // code
                System.out.println("client connect attempt timed out - checking stack trace");
                StackTraceElement[] trace = e.getStackTrace();
                for (StackTraceElement element : trace) {
                    if (element.getMethodName().equals("configureClientSSLSocket")) {
                        System.out.println("client connect attempt timed out in the appropriate method");
                        return true;
                    }
                }
                // it wasn't in the configuration method so we need to try again
            } catch (IOException e) {
                // server socket may not be in accept() yet, causing a connection-refused
                // exception
            }
            return false;
        });
    } finally {
        serverCoordination.release();
    }
}

From source file:com.castis.xylophone.adsmadapter.connectors.TambourineConnector.java

public boolean insertNodeData(List<NodeDataDTO> nodeDataList, ADSMSchedulerLogDTO schedulerLog) {
    boolean result = false;

    try {//from  ww  w .ja va2s .  com
        inventoryExportSysCompForAdapter.insertNodeDataList(nodeDataList, schedulerLog);
        schedulerLog.setSchedulerStatus(ADSMSchedulerStatus.SUCCESS);
        result = true;
    } catch (Exception e) {
        //log.error("",e);
        TheLogger.getWriter().error(schedulerLog.getParam() + " Node Data insert ");
        schedulerLog.setMessage(e.getMessage());
        schedulerLog.setSchedulerStatus(ADSMSchedulerStatus.FAIL);
        StackTraceElement[] stackTraces = e.getStackTrace();
        if (stackTraces.length > 0) {
            schedulerLog.setFailProcess(stackTraces[0].getClassName() + " - " + stackTraces[0].getMethodName()
                    + "(" + stackTraces[0].getLineNumber() + ")");
        }
        result = false;
    }

    return result;
}

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

public boolean verifyTotalECUHR(TestParameters input) throws InterruptedException {
    final int MAX_WAIT = 50;
    try {// w ww.j  a  v a  2 s  . c o  m
        //ValidECU(input);
        //jsx.executeScript("document.getElementById('calculate').click()");
        //jsx.executeScript("document.getElementById('purchaseTab').click()");
        driver.findElement(By.xpath("/window[1]/UIAKey[1]/scrollview[1]/webview[1]/link[2]")).click();
        driver.findElement(By.xpath(" //window[1]/UIAKey[1]/scrollview[1]/webview[1]/button[1]")).click(); //purchase

        ((TextBox) webPage.findObject(ObjectType.TextBox, MainPageElements_ipad.CostSolution_XPATH,
                ObjectValType.XPATH, MAX_WAIT, WaitCondition.VISIBLE))
                        .enterText(input.getParamMap().get("cos"));
        ((TextBox) webPage.findObject(ObjectType.TextBox, MainPageElements_ipad.AdditionalInfra_XPATH,
                ObjectValType.XPATH, MAX_WAIT, WaitCondition.VISIBLE)).enterText(input.getParamMap().get("ai"));
        ((TextBox) webPage.findObject(ObjectType.TextBox, MainPageElements_ipad.CAS_XPATH, ObjectValType.XPATH,
                MAX_WAIT, WaitCondition.VISIBLE)).enterText(input.getParamMap().get("cas"));
        ((TextBox) webPage.findObject(ObjectType.TextBox, MainPageElements_ipad.OSLicensing_XPATH,
                ObjectValType.XPATH, MAX_WAIT, WaitCondition.VISIBLE))
                        .enterText(input.getParamMap().get("osl"));
        ((TextBox) webPage.findObject(ObjectType.TextBox, MainPageElements_ipad.Depriciation_XPATH,
                ObjectValType.XPATH, MAX_WAIT, WaitCondition.VISIBLE))
                        .enterText(input.getParamMap().get("depri"));
        ((TextBox) webPage.findObject(ObjectType.TextBox, MainPageElements_ipad.Power_XPATH,
                ObjectValType.XPATH, MAX_WAIT, WaitCondition.VISIBLE))
                        .enterText(input.getParamMap().get("power"));
        ((TextBox) webPage.findObject(ObjectType.TextBox, MainPageElements_ipad.ITMgmt_XPATH,
                ObjectValType.XPATH, MAX_WAIT, WaitCondition.VISIBLE))
                        .enterText(input.getParamMap().get("itmgmt"));
        ((TextBox) webPage.findObject(ObjectType.TextBox, MainPageElements_ipad.NetworkFee_XPATH,
                ObjectValType.XPATH, MAX_WAIT, WaitCondition.VISIBLE))
                        .enterText(input.getParamMap().get("ntwkfee"));
        float CAPEX = Float.parseFloat(
                webDriver.findElement(By.xpath(MainPageElements_ipad.CAPEXHR_XPATH)).getAttribute("value"));
        float OPEX = Float.parseFloat(
                webDriver.findElement(By.xpath(MainPageElements_ipad.OPEXHR_XPATH)).getAttribute("value"));
        float capexecuhr = CAPEX / totalECU;
        float opexecuhr = OPEX / totalECU;
        float totalecuhr = capexecuhr + opexecuhr;

        System.out.println(Math.floor(totalecuhr * 10000 + .5) / 10000);
        float totalECUHR = Float
                .parseFloat(webDriver.findElement(By.xpath(MainPageElements_ipad.TOTALECUHR_XPATH)).getText());
        System.out.println(totalECUHR);
        if (df.format(totalecuhr).equalsIgnoreCase(df.format(totalECUHR))) {
            return true;
        }
    } catch (Exception e) {
        log.error(e.getMessage());
        System.err.println(e.getCause() + "              " + e.getStackTrace());
    }
    return false;
}

From source file:com.castis.xylophone.adsmadapter.connectors.TambourineConnector.java

public boolean insertContentData(List<ContentDataDTO> contentDataList, ADSMSchedulerLogDTO schedulerLog,
        String resultDir, String dataFileName) {
    boolean result = false;
    ADSMSchedulerLogDTO deleteSchedulerLog = null;

    try {//from www  . j  a va2 s. c o m
        deleteSchedulerLog = startLog(ADSMJobNameType.COLLECT_DELETE_DATA.name(),
                DeleteDataType.CONTENT_DATA.name());

        if (deleteSchedulerLog == null) {
            result = false;
            ResultFileUtil.writeResultFile(dataFileName, "deleteSchedulerLog ??  .",
                    FileResultCode.RESULT_FAIL.getValue(), resultDir, InputDataType.INVENTORY_DAT);
        } else {
            inventoryExportSysCompForAdapter.insertContentDataList(contentDataList, schedulerLog,
                    DeleteDataType.CONTENT_DATA.name(), deleteSchedulerLog.getId());
            schedulerLog.setSchedulerStatus(ADSMSchedulerStatus.SUCCESS);
            deleteSchedulerLog.setSchedulerStatus(ADSMSchedulerStatus.SUCCESS);
            endLog(deleteSchedulerLog);
            result = true;
            ResultFileUtil.writeResultFile(dataFileName,
                    "? ?  . [size:" + contentDataList.size() + "]",
                    FileResultCode.RESULT_OK.getValue(), resultDir, InputDataType.INVENTORY_DAT);
        }
    } catch (Exception e) {
        //log.error("",e);
        //TheLogger.getWriter().error(schedulerLog.getParam() + " Content Data insert ");
        schedulerLog.setMessage(e.getMessage());
        schedulerLog.setSchedulerStatus(ADSMSchedulerStatus.FAIL);
        StackTraceElement[] stackTraces = e.getStackTrace();
        if (stackTraces.length > 0) {
            String failProcess = stackTraces[0].getClassName() + " - " + stackTraces[0].getMethodName() + "("
                    + stackTraces[0].getLineNumber() + ")";

            schedulerLog.setFailProcess(failProcess);
            deleteSchedulerLog.setFailProcess(failProcess);
        }

        deleteSchedulerLog.setMessage(e.getMessage());
        deleteSchedulerLog.setSchedulerStatus(ADSMSchedulerStatus.FAIL);
        endLog(deleteSchedulerLog);
        result = false;
        ResultFileUtil.writeResultFile(dataFileName, e.getMessage(), FileResultCode.RESULT_FAIL.getValue(),
                resultDir, InputDataType.INVENTORY_DAT);
    }
    return result;
}

From source file:com.castis.xylophone.adsmadapter.connectors.TambourineConnector.java

public boolean insertCategoryData(List<CategoryDataDTO> categoryDataList, ADSMSchedulerLogDTO schedulerLog,
        String resultDirectory, String dataFileName, InputDataType inputDataType, DeleteDataType deleteData,
        ADSMJobNameType jobType) {//from   w  w  w .  ja  v  a  2s  .  c  om
    boolean result = false;
    ADSMSchedulerLogDTO deleteSchedulerLog = null;
    try {
        deleteSchedulerLog = startLog(ADSMJobNameType.COLLECT_DELETE_DATA.name(), deleteData.name());

        if (deleteSchedulerLog == null) {
            result = false;
            ResultFileUtil.writeResultFile(dataFileName, "deleteSchedulerLog ??  .",
                    FileResultCode.RESULT_FAIL.getValue(), resultDirectory, inputDataType);
        } else {
            inventoryExportSysCompForAdapter.insertCategoryDataList(categoryDataList, schedulerLog,
                    deleteData.name(), deleteSchedulerLog.getId(), jobType);

            schedulerLog.setSchedulerStatus(ADSMSchedulerStatus.SUCCESS);
            deleteSchedulerLog.setSchedulerStatus(ADSMSchedulerStatus.SUCCESS);
            endLog(deleteSchedulerLog);
            result = true;
            ResultFileUtil.writeResultFile(dataFileName,
                    "? ?  . [size:" + categoryDataList.size() + "]",
                    FileResultCode.RESULT_OK.getValue(), resultDirectory, inputDataType);
        }

    } catch (Exception e) {
        //log.error("",e);
        //TheLogger.getWriter().error(schedulerLog.getParam() + " Category Data insert ");
        schedulerLog.setMessage(e.getMessage());
        schedulerLog.setSchedulerStatus(ADSMSchedulerStatus.FAIL);
        StackTraceElement[] stackTraces = e.getStackTrace();
        if (stackTraces.length > 0) {
            String failProcess = stackTraces[0].getClassName() + " - " + stackTraces[0].getMethodName() + "("
                    + stackTraces[0].getLineNumber() + ")";

            schedulerLog.setFailProcess(failProcess);
            deleteSchedulerLog.setFailProcess(failProcess);
        }

        deleteSchedulerLog.setMessage(e.getMessage());
        deleteSchedulerLog.setSchedulerStatus(ADSMSchedulerStatus.FAIL);
        endLog(deleteSchedulerLog);

        result = false;
        ResultFileUtil.writeResultFile(dataFileName, e.getMessage(), FileResultCode.RESULT_FAIL.getValue(),
                resultDirectory, inputDataType);
    }
    return result;
}

From source file:org.alfresco.reporting.processor.NodeRefBasedPropertyProcessor.java

/**
 * Harvests 1) objects 2) closed tasks after date x
 *///  www  .ja v  a 2 s  . c o m
public void havestNodes(final NodeRef harvestDefinition) {
    /*
     * for each store:stores for each table:tables while continue search
     * continue = search.size>0 for each result:resultset if isVersioned
     * addAllOlderVersionsToQueue(result) addToQueue(result) processQueue()
     * // end while continue // end for each table // end for each store
     */
    logger.info("harvest run start...");
    ;
    try {
        final ArrayList<StoreRef> storeList = getStoreRefList();

        final Properties queries = getTableQueries(harvestDefinition);
        final String language = reportingHelper.getSearchLanguage(harvestDefinition);

        // Make sure there is a connection
        dbhb.openReportingConnection();

        Enumeration<Object> keys = queries.keys();

        String fullQuery; // is the actual query appending orderby
                          // node-dbid, and lastmodifued clause

        // Cycle all Lucene queries
        while (keys.hasMoreElements()) {

            String tableName = (String) keys.nextElement();
            String query = (String) queries.get(tableName);

            tableName = dbhb.fixTableColumnName(tableName);

            if (logger.isDebugEnabled())
                logger.debug("harvest: preparing table =" + tableName);

            // get a clean iterator to cycle all stores
            Iterator<StoreRef> storeIterator = storeList.iterator();
            Date lastModified = null;

            boolean archiveAllowed = false;

            // prevent having two threads doing the same
            if (!dbhb.tableIsRunning(tableName)) {

                String nowFormattedDate = getNowAsFormattedString();

                String timestamp = "";
                // old school all-in-one harvesting
                if (!getBatchTimestampEnabled()) {
                    dbhb.setLastTimestampStatusRunning(tableName);
                    timestamp = dbhb.getLastTimestamp(tableName);
                } // else, see 5 lines below

                dbhb.createEmptyTables(tableName);
                int maxItems = getMaxLoopSize();

                while (storeIterator.hasNext()) {

                    StoreRef storeRef = storeIterator.next();

                    // mew insight, limit the number of loops, treat
                    // mechanism with more care
                    if (getBatchTimestampEnabled()) {
                        dbhb.setLastTimestampStatusRunning(
                                tableName + "_" + storeRef.getProtocol().substring(0, 1));
                        timestamp = dbhb
                                .getLastTimestamp(tableName + "_" + storeRef.getProtocol().substring(0, 1));
                    }

                    if (logger.isDebugEnabled())
                        logger.debug("harvest: StoreRef=" + storeRef.getProtocol() + ", archiveAllowed="
                                + archiveAllowed);

                    // (re)set some essential process markers.
                    // These are local to the run-per-storeRef
                    long startDbId = 0; // the original database id of
                    // the noderef
                    long loopcount = 0; // count the number of
                    // harvesting loops. Should be
                    // <=2 for initial harvesting
                    // agaist factory repo
                    boolean letsContinue = true;

                    // break if we process the archive before the
                    // workspace is done...
                    if (storeRef.getProtocol().equals(StoreRef.PROTOCOL_ARCHIVE) && !archiveAllowed) {
                        letsContinue = false;
                    }

                    if (logger.isDebugEnabled())
                        logger.debug("harvest: before while, letsContinue=" + letsContinue);

                    while (letsContinue) {
                        loopcount++;

                        // hasEverRun is needed to determine if an
                        // update of lastModifiedTimestamp has occured
                        // ever in a batch, or never.
                        boolean hasEverRun = false;
                        if (logger.isInfoEnabled()) {
                            logger.info("++ Loop number: " + loopcount + ", tablename: " + tableName
                                    + ", archive: " + archiveAllowed);
                        }
                        if (getBatchTimestampEnabled()) { // default =
                            // true
                            nowFormattedDate = getNowAsFormattedString();
                        }

                        fullQuery = query + queryClauseTimestamp(language, timestamp, storeRef.getProtocol())
                                + queryClauseOrderBy(language, startDbId, storeRef.getProtocol());

                        if (logger.isDebugEnabled()) {
                            logger.debug("harvest: StoreProtocol = " + storeRef.getProtocol() + ", archive: "
                                    + archiveAllowed + "\nfullQuery = " + fullQuery);
                        }

                        SearchParameters sp = new SearchParameters();
                        sp.setLanguage(language);
                        sp.addStore(storeRef);
                        sp.setQuery(fullQuery);
                        // sp.addSort(getOrderBy(language), true);
                        if (maxItems > 0) {
                            sp.setMaxItems(maxItems);
                        }
                        if (logger.isDebugEnabled()) {
                            logger.debug("Searchparameter query: " + sp.getQuery());
                        }
                        ResultSet results = getSearchService().query(sp);

                        if (logger.isDebugEnabled())
                            logger.debug("harvest: prepare flipping: archiveAllowed=" + archiveAllowed
                                    + ", length=" + results.length());

                        // allow harvesting the archive if the workspace
                        // has been done!
                        // workspace is done if there are no more search
                        // results
                        if (results.length() == 0 && !archiveAllowed) {
                            if (logger.isDebugEnabled())
                                logger.debug("harvest: flipping to archiveAllowed=true");
                            archiveAllowed = true;
                        }

                        letsContinue = stillContinueHarvesting(loopcount, results.length());

                        logger.debug("harvest: loopcount= " + loopcount + "\n" + "harvest: resultsize   = "
                                + results.length() + "\n" + "harvest: letsContinue = " + letsContinue + "\n"
                                + "harvest: archiveAllow = " + archiveAllowed + "\n"
                                + "harvest: tablename    = " + tableName);
                        SimpleDateFormat sdf = getSimpleDateFormat();

                        if (letsContinue) {

                            Iterator<ResultSetRow> resultsIterator = results.iterator();
                            while (resultsIterator.hasNext()) {
                                try { // be tolerant for non-existing
                                      // nodes... happens to hurt
                                      // leaving status=Running
                                    NodeRef result = resultsIterator.next().getNodeRef();
                                    logger.debug("harvest noderef " + result);
                                    if (!storeRef.getProtocol().equalsIgnoreCase("archive")) {

                                        if (getNodeService().hasAspect(result, ContentModel.ASPECT_VERSIONABLE)
                                                // versionService.isVersioned(result)
                                                && versionService.getVersionHistory(result).getAllVersions()
                                                        .size() > 1) {
                                            VersionHistory vh = versionService.getVersionHistory(result);
                                            Iterator<Version> vhi = vh.getAllVersions().iterator();
                                            String latestVersionLabel = (String) nodeService.getProperty(
                                                    vh.getHeadVersion().getVersionedNodeRef(),
                                                    ContentModel.PROP_VERSION_LABEL);
                                            // Date latestDate =
                                            // (Date)nodeService.getProperty(result,
                                            // ContentModel.PROP_MODIFIED);
                                            while (vhi.hasNext()) {
                                                Version version = vhi.next();
                                                String currentVersionLabel = version.getVersionLabel();
                                                // Date versionDate =
                                                // version.getFrozenModifiedDate();
                                                // logger.debug("comparing:
                                                // " +
                                                // currentVersionLabel +
                                                // "/" +
                                                // latestVersionLabel
                                                // );//+ " and " +
                                                // sdf.format(versionDate)
                                                // +"/"+
                                                // sdf.format(latestDate));
                                                if (!currentVersionLabel.equals(latestVersionLabel)) {
                                                    if (logger.isInfoEnabled())
                                                        logger.info(
                                                                "harvest: Adding Version " + currentVersionLabel
                                                                        + " " + version.getFrozenStateNodeRef()
                                                                        + " - " + result.toString()); // version.getVersionedNodeRef());
                                                    addToQueue(version.getFrozenStateNodeRef(), result);
                                                } else {
                                                    if (logger.isDebugEnabled())
                                                        logger.info("Ignoring version " + currentVersionLabel);
                                                } // end ifelse

                                            } // end while
                                        } // id if
                                          // hasAspect(versionable)

                                    } // end exclude Archive

                                    // all versions should be post-fixed
                                    // with their head version workspace
                                    // ref
                                    if (!result.toString().startsWith("version")) {
                                        if (logger.isDebugEnabled())
                                            logger.debug("harvest: " + " adding NodeRef " + result);
                                        addToQueue(result);
                                    }
                                } catch (Exception e) {
                                    // ignore, we need to buffer for
                                    // non-existing nodes...
                                    logger.info("NodeRef appears broken: " + e.getMessage());
                                    logger.info("   " + e.getStackTrace());
                                }
                            } // end resultsIterator

                            try {
                                // process the current queue
                                Properties props = processQueueDefinition(tableName);
                                if (logger.isDebugEnabled())
                                    logger.debug("harvest: queueDef done, setting tableDefinition");

                                setTableDefinition(tableName, props);
                                if (logger.isDebugEnabled())
                                    logger.debug("harvest: tableDef done. Processing queue Values");

                                processQueueValues(tableName);

                                // prep the queue for the next run
                                resetQueue();

                                if (results.length() > 0) {
                                    // prepare the dbid for the next run
                                    startDbId = Long.parseLong(String.valueOf(getNodeService().getProperty(
                                            results.getNodeRef(results.length() - 1),
                                            ContentModel.PROP_NODE_DBID)));

                                    lastModified = (Date) getNodeService().getProperty(
                                            results.getNodeRef(results.length() - 1),
                                            ContentModel.PROP_MODIFIED);
                                    if (logger.isDebugEnabled()) {
                                        logger.debug("harvest: StoreProtocol = " + storeRef.getProtocol());
                                        logger.debug("harvest: New start DBID=" + startDbId);
                                        logger.debug("harvest: New lastModified=" + lastModified);
                                    }
                                }
                            } catch (Exception e) {
                                logger.info("harvest: something wrong with the noderef, skipping");
                            }

                            if ((results.length() > 0) && getBatchTimestampEnabled()
                                    && (lastModified != null)) {
                                if (logger.isDebugEnabled())
                                    logger.debug("Setting Batch-based timestamp: "
                                            + getDateAsFormattedString(lastModified));
                                dbhb.setLastTimestamp(tableName + "_" + storeRef.getProtocol().substring(0, 1),
                                        getDateAsFormattedString(lastModified));
                                hasEverRun = true;
                            }

                        } // end if(letsContinue)
                        if ((!letsContinue) && (results.length() == 0)) {
                            // register lastruntimestamp anyway
                            if (hasEverRun) {
                                dbhb.setAllStatusesDoneForTable();
                            } else {
                                dbhb.setLastTimestampAndStatusDone(
                                        tableName + "_" + storeRef.getProtocol().substring(0, 1),
                                        nowFormattedDate);
                            }
                        }
                        letsContinue = stillContinueHarvesting(loopcount, results.length());
                    } // end while letsContinue

                } // end storeProtocol

                if (getBatchTimestampEnabled()) {
                    // dbhb.setLastTimestamp(tableName,
                    // getDateAsFormattedString(lastModified));
                    if (lastModified != null) {
                        if (logger.isDebugEnabled())
                            logger.debug("Setting Batch-based status to done");
                        dbhb.setAllStatusesDoneForTable();
                    }
                } else {
                    if (logger.isDebugEnabled())
                        logger.debug("Setting end-last-run-based timestamp");
                    dbhb.setLastTimestampAndStatusDone(tableName, nowFormattedDate);
                }
                // startDbId=0;

            } // end if tableIsRunning
            else {
                if (logger.isDebugEnabled())
                    logger.debug("harvest: table is running; leaving...");
            }
        } // end while keys

    } catch (Exception e) {
        // e.printStackTrace();
        logger.info("Fatality: " + e);
    } finally {
        // make sure we gently close the connection
        dbhb.closeReportingConnection();
    }
    logger.info("harvest run done...");
}

From source file:base.BasePlayer.BedTable.java

void getAminos(BedNode transcript) {

    try {//from   w  w  w .  j  ava  2 s.c o m
        aminoarray = null;
        VarNode varnode = null;

        for (int t = 0; t < transcript.varnodes.size(); t++) {

            if (Main.drawCanvas.hideNode(transcript.varnodes.get(t))) {

                continue;
            }

            varnode = transcript.varnodes.get(t);

            for (int v = 0; v < varnode.vars.size(); v++) { // Map.Entry<String, ArrayList<SampleNode>> entry : varnode.vars) {
                entry = varnode.vars.get(v);
                mutcount = 0;
                if (Main.drawCanvas.hideNodeVar(varnode, entry)) {
                    continue;
                }
                for (int m = 0; m < entry.getValue().size(); m++) {
                    if (entry.getValue().get(m).alleles != null) {
                        break;
                    }
                    if (!Main.drawCanvas.hideVar(entry.getValue().get(m), entry.getKey().length() > 1)) {
                        mutcount++;
                    } else {
                        entry.getValue().remove(m);
                        m--;
                    }
                }

                if (mutcount == 0) {
                    continue;
                }
                base = entry.getKey();
                String[] addrow = new String[6];
                addrow[0] = transcript.name;
                addrow[1] = "" + mutcount;
                addrow[2] = transcript.getChrom() + ":"
                        + MethodLibrary.formatNumber((varnode.getPosition() + 1));

                if (base.length() == 1) {
                    addrow[3] = "" + Main.getBase.get(varnode.getRefBase()) + ">" + base;
                } else {
                    addrow[3] = base;
                }
                if (varnode.isRscode() != null) {
                    addrow[4] = varnode.rscode;
                } else {
                    addrow[4] = "N/A";
                }
                addrow[5] = base;

                AminoEntry aminoentry = new AminoEntry(addrow, varnode);
                if (aminoarray == null) {
                    aminoarray = new ArrayList<AminoEntry>();
                }
                aminoarray.add(aminoentry);
            }
        }
        varnode = null;
    } catch (Exception e) {
        ErrorLog.addError(e.getStackTrace());
        e.printStackTrace();
    }

}

From source file:com.cyberway.issue.crawler.framework.CrawlController.java

protected FatalConfigurationException convertToFatalConfigurationException(Exception e) {
    FatalConfigurationException fce = new FatalConfigurationException("Converted exception: " + e.getMessage());
    fce.setStackTrace(e.getStackTrace());
    return fce;/*from w  w w. j a  v  a2s . c  o  m*/
}