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:io.java.back.business.ChamadoData.java

public List<Chamado> listar() {
    List<Chamado> list = new ArrayList<Chamado>();

    try {//from  w w  w.  ja  v  a2  s  .  c om
        // consulta JPQL
        list = HibernateUtil.getSessionFactory().openSession().createQuery("from Chamado").list();
        //testes
        list.add(testaCriaModela(1));
        list.add(testaCriaModela(2));
        list.add(testaCriaModela(3));
    } catch (Exception ex) {

        ex.getStackTrace();
    }
    return list;
}

From source file:org.apache.hadoop.chukwa.util.WatchDog.java

public void run() {
    long updates = 0;
    boolean error = false;
    try {/*from w w w. j  av  a2  s. co  m*/
        // SQL query to monitor database
        DatabaseConfig dbc = new DatabaseConfig();
        log.info("cluster:" + cluster);
        DatabaseWriter db = new DatabaseWriter(cluster);
        Calendar c = Calendar.getInstance();
        long now = c.getTimeInMillis();
        String[] tableName = dbc.findTableName("system_metrics", now, now);
        String query = "select unix_TIMESTAMP(now()) - unix_timestamp(max(timestamp)) as delay from "
                + tableName[0] + " ;";
        ResultSet rs = db.query(query);
        while (rs.next()) {
            long delay = rs.getLong(1);
            if (delay > 600) {
                log.error("Chukwa: " + cluster + ": No new data for the past 30 minutes for system metrics");
                error = true;
            }
        }
        query = "select count(*) as UpdatesPerHr from " + tableName[0]
                + " where Timestamp > date_sub(now(), interval 60 minute) ;";
        rs = db.query(query);
        while (rs.next()) {
            updates = rs.getLong(1);
            if (updates == 0) {
                log.error("Chukwa: " + cluster + ": No system metrics data received for the past 60 minutes");
                error = true;
            }
        }
        String[] hodTableNames = dbc.findTableName("HodJob", now, now);
        query = "select count(*) as UpdatesPerHr from " + hodTableNames[0]
                + " where StartTime > date_sub(now(), interval 60 minute) ;";
        rs = db.query(query);
        while (rs.next()) {
            long updatesHod = rs.getLong(1);
            if (updatesHod == 0) {
                log.error("Chukwa: " + cluster + ": No hod job data received for the past 60 minutes");
            }
        }
        String[] mrTableNames = dbc.findTableName("mr_job", now, now);
        query = "select count(*) as UpdatesPerHr from " + mrTableNames
                + " where FINISH_TIME > date_sub(now(), interval 1440 minute) ;";
        rs = db.query(query);
        while (rs.next()) {
            long updatesMR = rs.getLong(1);
            if (updatesMR == 0) {
                log.error("MDL: no map reduce job data received for the past day.");
                error = true;
            }
        }
        db.close();
    } catch (Exception ex) {
        log.error("Unexpected error:" + ex.getStackTrace().toString());
        System.exit(1);
    }
    if (!error) {
        log.info("MDL: Status OK");
    }

}

From source file:com.cnm.cnmrc.fragment.rc.RcBase.java

/**
 * Loading TapPressAnimation <br>//from w ww  . jav  a  2 s . c o m
 */
protected void startLoadingAni(ImageButton view, final ImageView animView) {
    if (view != null) {
        view.post(new Runnable() {
            @Override
            public void run() {
                try {
                    mTapPressAnimation = new AnimationDrawable();
                    mTapPressAnimation.addFrame(getResources().getDrawable(R.drawable.tappress01), 60);
                    mTapPressAnimation.addFrame(getResources().getDrawable(R.drawable.tappress02), 60);
                    mTapPressAnimation.addFrame(getResources().getDrawable(R.drawable.tappress03), 60);
                    mTapPressAnimation.addFrame(getResources().getDrawable(R.drawable.tappress04), 60);
                    mTapPressAnimation.setOneShot(true);
                    animView.setImageDrawable(mTapPressAnimation);

                    // API 2.3.4?  ?... ???
                    // animView.setBackgroundResource(R.drawable.anim_tappress);
                    // mTapPressAnimation = (AnimationDrawable)
                    // animView.getBackground();

                    mTapPressDuration = 0;
                    for (int i = 0; i < mTapPressAnimation.getNumberOfFrames(); i++) {
                        mTapPressDuration += mTapPressAnimation.getDuration(i);
                    }

                    animView.setVisibility(View.VISIBLE);

                    // Start the animation (looped playback by default).
                    mTapPressAnimation.start();

                    mHandler.postDelayed(new Runnable() {
                        public void run() {
                            mTapPressAnimation.stop();
                            mTapPressAnimation = null;
                            animView.setBackgroundResource(0);
                            animView.setVisibility(View.INVISIBLE);
                            oneClickTapPress = true;
                        }
                    }, mTapPressDuration);
                } catch (Exception e) {
                    e.getStackTrace();
                }

            }
        });
    }

    //view.post(new Starter());
}

From source file:org.openmrs.module.patientnarratives.web.controller.MultiFileUploadController.java

@RequestMapping(FORM_PATH)
public ModelAndView handleRequest(HttpServletRequest request) throws Exception {

    if (request instanceof MultipartHttpServletRequest) {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        List<MultipartFile> uploadedFiles = multipartRequest.getFiles("files[]");

        try {//from  w  ww.j  a  v  a 2s .  c om
            Iterator<MultipartFile> iterator = uploadedFiles.iterator();
            while (iterator.hasNext()) {
                MultipartFile multipartFile = iterator.next();
                tempFile = multipartToFile(multipartFile);
                saveAndTransferFileComplexObs();
            }
        } catch (Exception e) {
            log.error(e);
            e.getStackTrace();
        }
    }

    returnUrl = request.getContextPath() + "/module/patientnarratives/patientNarrativesForm.form";
    return new ModelAndView(new RedirectView(returnUrl));
}

From source file:it.smartcommunitylab.aac.controller.BasicProfileController.java

@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(Exception.class)
@ResponseBody/* ww w.ja  v  a2  s  .c  om*/
ErrorInfo handleBadRequest(HttpServletRequest req, Exception ex) {
    StackTraceElement ste = ex.getStackTrace()[0];
    return new ErrorInfo(req.getRequestURL().toString(), ex.getClass().getTypeName(), ste.getClassName(),
            ste.getLineNumber());
}

From source file:com.esri.geoevent.solutions.processor.polygon2pt.Polygon2PtProcessorService.java

public void start() {
    try {/*from w w  w.  ja  va 2s. c o  m*/
        Polygon2PtProcessorDefinition bDef = (Polygon2PtProcessorDefinition) definition;
    } catch (Exception e) {
        LOG.error("Geometry processor");
        LOG.error(e.getMessage());
        LOG.error(e.getStackTrace());
    }
}

From source file:com.esri.geoevent.solutions.processor.buffer.BufferProcessorService.java

public void start() {
    try {/*w w w  . j a v  a2s .  c  o m*/
        BufferProcessorDefinition bDef = (BufferProcessorDefinition) definition;
        bDef.setManager(manager);
    } catch (Exception e) {
        LOG.error("Geometry processor");
        LOG.error(e.getMessage());
        LOG.error(e.getStackTrace());
    }
}

From source file:com.esri.geoevent.solutions.processor.ellipse.EllipseProcessorService.java

public void start() {
    try {//from   w  w w.  j  a va2  s. c om
        EllipseProcessorDefinition eDef = (EllipseProcessorDefinition) definition;
        eDef.setManager(manager);
    } catch (Exception e) {
        LOG.error("Geometry processor");
        LOG.error(e.getMessage());
        LOG.error(e.getStackTrace());
    }
}

From source file:com.esri.geoevent.solutions.processor.geometry.PolygonProcessorService.java

public void start() {
    try {// ww w.j a v a2  s . com
        PolygonProcessorDefinition pDef = (PolygonProcessorDefinition) definition;
        pDef.setManager(manager);
    } catch (Exception e) {
        LOG.error("Geometry processor");
        LOG.error(e.getMessage());
        LOG.error(e.getStackTrace());
    }
}

From source file:com.esri.geoevent.solutions.processor.geometry.VisibilityProcessorService.java

public void start() {
    try {/*from w w w.j  av  a2  s. co m*/
        VisibilityProcessorDefinition vDef = (VisibilityProcessorDefinition) definition;
        vDef.setManager(manager);
    } catch (Exception e) {
        LOG.error("Geometry processor");
        LOG.error(e.getMessage());
        LOG.error(e.getStackTrace());
    }
}