Example usage for java.text ParseException printStackTrace

List of usage examples for java.text ParseException printStackTrace

Introduction

In this page you can find the example usage for java.text ParseException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.socialsignin.springframework.data.dynamodb.demo.config.DemoRepositoryLinkBuilder.java

@SuppressWarnings("deprecation")
@Override/*  ww w  .j  a v  a2  s . co  m*/
public RepositoryLinkBuilder slash(Object object) {

    if (object instanceof ReplyId) {
        ReplyId replyId = (ReplyId) object;
        try {
            ThreadIdMarshaller threadIdMarshaller = new ThreadIdMarshaller();
            return slash(DATE_FORMAT.parse(replyId.getReplyDateTime()).getTime() + "-"
                    + URLEncoder.encode(threadIdMarshaller.marshall(replyId.getThreadId())));
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }
    if (object instanceof ThreadId) {
        ThreadId threadId = (ThreadId) object;
        return slash(
                URLEncoder.encode(threadId.getForumName()) + "_" + URLEncoder.encode(threadId.getSubject()));

    }

    return super.slash(object);
}

From source file:com.elastacloud.aad.adal4jpassive.PassiveController.java

@RequestMapping(method = { RequestMethod.GET, RequestMethod.POST })
public String getPassiveAuth(ModelMap model, HttpServletRequest httpRequest) {
    try {/*  ww  w  .ja  va  2  s.com*/
        HttpSession session = httpRequest.getSession();
        String token = (String) session.getAttribute("token");
        boolean verified = (boolean) session.getAttribute("verified");
        if (verified == false) {
            model.addAttribute("error", new Exception("AuthenticationResult not found in session."));
            return "/error";
        } else {

            try {
                SignedJWT jwt = SignedJWT.parse(token);
                String upn = (String) jwt.getPayload().toJSONObject().get("upn");
                model.addAttribute("username", upn);

            } catch (ParseException e) {
                e.printStackTrace();
            }
        }

        return "/secure/passive";
    } catch (Exception e) {
        model.addAttribute("error", new Exception("AuthenticationResult not found in session."));
        return "/error";
    }
}

From source file:com.huateng.ebank.framework.util.DateUtil.java

public static Date get20Date(String source) throws CommonException {
    if (source == null || source.equals("")) {
        ExceptionUtil.throwCommonException(ErrorCode.DATE_IS_NULL);
    }/*from   w ww. j a v a  2  s  .co  m*/
    Date date = null;
    SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
    try {
        date = format.parse(source);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return date;
}

From source file:com.huateng.ebank.framework.util.DateUtil.java

/**
 * yyyyMMdd???yyyy-MM-dd?//  ww  w.  j a  v a  2 s  .c om
 *
 * @param  source
 * @return yyyy-MM-dd
 */
public static String get21Date(String source) {
    if (source == null || source.equals(""))
        return null;
    SimpleDateFormat format1 = new SimpleDateFormat("yyyyMMdd");
    SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd");
    Date date = null;
    try {
        date = format1.parse(source);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return format2.format(date);
}

From source file:org.openmrs.module.OT.web.controller.minorOT.queue.RescheduleProcedureController.java

@RequestMapping(method = RequestMethod.POST)
public String rescheduleProcedure(Model model, @ModelAttribute("schedule") OpdTestOrder schedule,
        @RequestParam("rescheduledDate") String rescheduledDateStr,
        @RequestParam("rescheduledTime") String rescheduledTimeStr) {
    if (schedule != null) {
        OperationTheatreService ots = (OperationTheatreService) Context
                .getService(OperationTheatreService.class);
        Date rescheduledDate;//from   www.j  a v  a 2  s . co  m
        try {
            rescheduledDate = OperationTheatreUtil.parseDate(rescheduledDateStr + " " + rescheduledTimeStr);
            String status = ots.rescheduleProcedure(schedule, rescheduledDate);
            model.addAttribute("status", status);
        } catch (ParseException e) {
            e.printStackTrace();
            model.addAttribute("status", "Invalid date!");
        }
    }
    return "/module/OT/minorOT/rescheduleResponse";
}

From source file:org.openmrs.module.radiology.web.controller.printworklist.SearchPrintWorklistController.java

@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.GET)
public String searchTest(@RequestParam(value = "date", required = false) String dateStr,
        @RequestParam(value = "phrase", required = false) String phrase,
        @RequestParam(value = "investigation", required = false) Integer investigationId,
        HttpServletRequest request, Model model) {
    RadiologyService rs = (RadiologyService) Context.getService(RadiologyService.class);
    Concept investigationConcept = Context.getConceptService().getConcept(investigationId);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Date date = null;/*from w w w. j  ava  2  s  .  co m*/
    try {
        date = sdf.parse(dateStr);
        List<RadiologyTest> radiologyTests = rs.getAllRadiologyTestsByDate(date, phrase, investigationConcept);
        Map<Concept, Set<Concept>> testTreeMap = (Map<Concept, Set<Concept>>) request.getSession()
                .getAttribute(RadiologyConstants.SESSION_TEST_TREE_MAP);
        List<TestModel> tests = RadiologyUtil.generateModelsFromTests(radiologyTests, testTreeMap);
        //ghanshyam 04/07/2012 New Requirement #274
        Collections.sort(tests);
        model.addAttribute("tests", tests);
        model.addAttribute("testNo", tests.size());
    } catch (ParseException e) {
        e.printStackTrace();
        System.out.println("Error when parsing order date!");
        return null;
    }
    return "/module/radiology/printworklist/search";
}

From source file:org.openmrs.module.laboratory.web.controller.queue.RescheduleTestController.java

@RequestMapping(method = RequestMethod.POST)
public String rescheduleTest(Model model, @ModelAttribute("order") Order order,
        @RequestParam("rescheduledDate") String rescheduledDateStr) {
    if (order != null) {
        LaboratoryService ls = (LaboratoryService) Context.getService(LaboratoryService.class);
        Date rescheduledDate;//from w  w w .jav  a  2  s.c o  m
        try {
            rescheduledDate = LaboratoryUtil.parseDate(rescheduledDateStr);
            String status = ls.rescheduleTest(order, rescheduledDate);
            model.addAttribute("status", status);
        } catch (ParseException e) {
            e.printStackTrace();
            model.addAttribute("status", "Invalid date!");
        }
    }
    return "/module/laboratory/queue/rescheduleResponse";
}

From source file:org.openmrs.module.OT.web.controller.majorOT.queue.RescheduleProcedureController.java

@RequestMapping(method = RequestMethod.POST)
public String rescheduleProcedure(Model model, @ModelAttribute("schedule") OpdTestOrder schedule,
        @RequestParam("rescheduledDate") String rescheduledDateStr,
        @RequestParam("rescheduledTime") String rescheduledTimeStr) {
    if (schedule != null) {
        OperationTheatreService ots = (OperationTheatreService) Context
                .getService(OperationTheatreService.class);
        Date rescheduledDate;/*from www  .j  av  a  2s .co  m*/
        try {
            rescheduledDate = OperationTheatreUtil_Major
                    .parseDate(rescheduledDateStr + " " + rescheduledTimeStr);
            String status = ots.rescheduleProcedure(schedule, rescheduledDate);
            model.addAttribute("status", status);
        } catch (ParseException e) {
            e.printStackTrace();
            model.addAttribute("status", "Invalid date!");
        }
    }
    return "/module/OT/majorOT/rescheduleResponse";
}

From source file:org.openmrs.module.radiology.web.controller.queue.RescheduleTestController.java

@RequestMapping(method = RequestMethod.POST)
public String rescheduleTest(Model model, @ModelAttribute("order") Order order,
        @RequestParam("rescheduledDate") String rescheduledDateStr) {
    if (order != null) {
        RadiologyService rs = (RadiologyService) Context.getService(RadiologyService.class);
        Date rescheduledDate;// w  w  w  .j  a  v  a2 s. c  o m
        try {
            rescheduledDate = RadiologyUtil.parseDate(rescheduledDateStr);
            String status = rs.rescheduleTest(order, rescheduledDate);
            model.addAttribute("status", status);
        } catch (ParseException e) {
            e.printStackTrace();
            model.addAttribute("status", "Invalid date!");
        }
    }
    return "/module/radiology/queue/rescheduleResponse";
}

From source file:com.persistent.cloudninja.service.impl.TenantTaskListServiceImpl.java

/**
 * Method to format the start and due date to yyyy/MM/dd format
 * @param taskList/*from  ww w.j  ava2s.c o m*/
 */
private void formatDateString(TaskList taskList) {
    String startDateStr = "";
    String dueDateStr = "";
    startDateStr = taskList.getStartDate();
    dueDateStr = taskList.getDueDate();

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
    SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");

    try {
        Date startDate = sdf.parse(startDateStr);
        taskList.setStartDate(sdf1.format(startDate));

        Date dueDate = sdf.parse(dueDateStr);
        taskList.setDueDate(sdf1.format(dueDate));

    } catch (ParseException e) {
        e.printStackTrace();
    }
}