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.sisrni.managedbean.TipoPersonaMB.java

private void cargarTipoPersona() {
    try {/*w ww. ja  va2  s.  co  m*/
        actualizar = false;
        tipoPersona = new TipoPersona();
        listadoTipoPersona = tipoPersonaService.getAllByIdDesc();
    } catch (Exception e) {
        log.debug("Error al tratar de cargar las solicitudes listar para realizar un analisis..."
                + e.getStackTrace());

    }
}

From source file:com.sisrni.managedbean.TipoFacultadMB.java

private void cargarTipoFacultad() {
    try {//from  ww  w  .ja va  2s  .c o  m
        actualizar = false;
        tipoFacultad = new TipoFacultad();
        listadoTipoFacultad = tipoFacultadService.getAllByIdDesc();
    } catch (Exception e) {
        log.debug("Error al tratar de cargar las solicitudes listar para realizar un analisis..."
                + e.getStackTrace());

    }
}

From source file:com.sisrni.managedbean.EstadoMB.java

private void cargarEstado() {
    try {/*  w w w  .j a  v a 2s .co m*/
        actualizar = false;
        estado = new Estado();
        listadoEstado = estadoService.getAllByIdDesc();
    } catch (Exception e) {
        log.debug("Error al tratar de cargar las solicitudes listar para realizar un analisis..."
                + e.getStackTrace());

    }
}

From source file:com.esri.geoevent.solutions.adapter.cot.MessageParser.java

private String makeTabs(int desiredNumberOfTabs) throws Exception {
    try {//w w w. ja  v a  2s . c o m
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i <= desiredNumberOfTabs; i++) {
            sb.append("  ");
        }
        return sb.toString();
    } catch (Exception e) {
        LOG.error(e);
        LOG.error(e.getStackTrace());
        throw (e);
    }
}

From source file:org.openmrs.module.webservices.rest.web.RestUtilTest.java

/**
 * @see RestUtil#wrapErrorResponse(Exception,String)
 * @verifies set stack trace code and detail empty if not available
 *///from  w  w  w  .j a v  a2 s.  c  o  m
@Test
public void wrapErrorResponse_shouldSetStackTraceCodeAndDetailEmptyIfNotAvailable() throws Exception {
    Exception mockException = Mockito.mock(Exception.class);
    Mockito.when(mockException.getMessage()).thenReturn("exceptionmessage");
    Mockito.when(mockException.getStackTrace()).thenReturn(new StackTraceElement[] {});

    SimpleObject returnObject = RestUtil.wrapErrorResponse(mockException, "wraperrorresponsemessage");

    LinkedHashMap errorResponseMap = (LinkedHashMap) returnObject.get("error");
    Assert.assertEquals("", errorResponseMap.get("code"));
    Assert.assertEquals("", errorResponseMap.get("detail"));
}

From source file:com.esri.geoevent.solutions.adapter.cot.MessageParser.java

@Override
public void characters(char ch[], int start, int length) throws SAXException {
    try {/*from w  w  w  .  j  a v a2 s  .  c om*/
        String str = new String(ch, start, length);
        if (messageLevel == MessageLevel.inAttribute) {
            attribute = str;
        } else {
            text = str;
        }
    } catch (Exception e) {
        LOG.error(e);
        LOG.error(e.getStackTrace());
    }
}

From source file:com.nts.alphamale.monitor.EventMonitor.java

public void run() {
    try {/*from   w ww .java  2  s  . c o m*/
        if (DataQueue.IS_CONTROLED) {
            log.info("log monitoring");
            eventLogAnalysis((LineIterator) DataQueue.EVENT_EXECUTOR.peek().get("stdOut"));
        }
    } catch (Exception t) {
        log.error("Caught exception in EventMonitor. StackTrace:\n" + t.getStackTrace());
        this.run();
    }
}

From source file:com.amediamanager.controller.ExceptionHandlerController.java

private ModelAndView handle(Exception e, String msg) {
    LOG.error(msg, e);/*www  . ja  va 2s  .  c o m*/
    ModelAndView modelAndView = new ModelAndView();
    modelAndView.setViewName("base");
    modelAndView.addObject("error", msg);
    modelAndView.addObject("exMessage", e.getMessage());
    modelAndView.addObject("stackTrace", Arrays.toString(e.getStackTrace()));
    return modelAndView;
}

From source file:com.esri.geoevent.solutions.adapter.cot.MessageParser.java

private void resetData() {
    try {// w w w.j  a v a  2s .  co m
        this.how = null;
        this.opex = null;
        this.qos = null;
        this.type = null;
        this.uid = null;
        this.version = null;
        this.stale = null;
        this.start = null;
        this.time = null;
        this.access = null;
        this.detail = new StringBuilder();
        this.point = new StringBuilder();
        this.inDetails = false;
        this.tabLevel = 0;
    } catch (Exception e) {
        LOG.error(e);
        LOG.error(e.getStackTrace());
    }

}

From source file:cz.zcu.kiv.eegdatabase.logic.controller.group.BookingRoomController.java

@Override
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object comm,
        BindException bindException) throws Exception {
    try {//from   w  ww.jav a  2  s  . c o  m
        BookRoomCommand command = (BookRoomCommand) comm;
        status = messageSource.getMessage("bookRoom.controllerMessages.status.fail", null,
                RequestContextUtils.getLocale(request));
        comment = messageSource.getMessage("bookRoom.controllerMessages.comment.error.unknown", null,
                RequestContextUtils.getLocale(request));

        Person user = personDao.getLoggedPerson();
        int group = command.getSelectedGroup();
        int repType = command.getRepType();
        int repCount = command.getRepCount();
        String startStr = BookingRoomUtils.getHoursAndMinutes(command.getStartTimeCal());
        String endStr = BookingRoomUtils.getHoursAndMinutes(command.getEndTimeCal());

        Reservation res = new Reservation();

        Timestamp createTime = new Timestamp(new GregorianCalendar().getTimeInMillis());
        res.setCreationTime(createTime);
        res.setStartTime(command.getStartTimeTimestamp());
        res.setEndTime(command.getEndTimeTimestamp());

        res.setPerson(user);

        //searching for ResearchGroup
        ResearchGroup grp = getResearchGroup(group);
        res.setResearchGroup(grp);

        log.debug("Reservation has been created: " + ((res == null) ? "false" : "true"));
        reservationDao.create(res);

        if (repCount > 0) {
            comment = messageSource.getMessage("bookRoom.controllerMessages.comment.booked.multiple.part1",
                    null, RequestContextUtils.getLocale(request));
            comment += command.getDate() + ", from " + startStr + " to " + endStr + "<br>\n";

            GregorianCalendar nextS = command.getStartTimeCal();
            GregorianCalendar nextE = command.getEndTimeCal();

            for (int i = 0; i < repCount; i++) {
                //shift of dates
                int add = BookingRoomUtils.getWeeksAddCount(repType, i);
                nextS.add(Calendar.WEEK_OF_YEAR, add);
                nextE.add(Calendar.WEEK_OF_YEAR, add);
                Reservation newReservation = new Reservation();
                newReservation.setCreationTime(createTime);
                newReservation.setStartTime(new Timestamp(nextS.getTimeInMillis()));
                newReservation.setEndTime(new Timestamp(nextE.getTimeInMillis()));
                newReservation.setPerson(user);
                newReservation.setResearchGroup(grp);
                reservationDao.create(newReservation);

                comment += BookingRoomUtils.getDate(nextS) + ", from "
                        + BookingRoomUtils.getHoursAndMinutes(nextS) + " to "
                        + BookingRoomUtils.getHoursAndMinutes(nextE) + "<br>\n";
            }

            comment += String.format(
                    messageSource.getMessage("bookRoom.controllerMessages.comment.booked.multiple.part2", null,
                            RequestContextUtils.getLocale(request)),
                    repCount + 1);//+1 because we need count "original" reservation!
        } else {
            comment = String
                    .format(messageSource.getMessage("bookRoom.controllerMessages.comment.booked.single", null,
                            RequestContextUtils.getLocale(request)), command.getDate(), startStr, endStr);
        }

        status = messageSource.getMessage("bookRoom.controllerMessages.status.ok", null,
                RequestContextUtils.getLocale(request));
    } catch (Exception e) {
        log.error("Exception: " + e.getMessage() + "\n" + e.getStackTrace()[0].getFileName() + " at line "
                + e.getStackTrace()[0].getLineNumber(), e);

        status = messageSource.getMessage("bookRoom.controllerMessages.status.fail", null,
                RequestContextUtils.getLocale(request));
        comment = messageSource.getMessage("bookRoom.controllerMessages.comment.error.exception", null,
                RequestContextUtils.getLocale(request)) + " " + e.getMessage();
    }

    log.debug("Returning MAV" + " with status=" + status + "&comment=" + comment);
    ModelAndView mav = new ModelAndView(getSuccessView()/* + "?status=" + status + "&comment=" + comment*/);

    return mav;
}