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:com.huateng.ebank.framework.util.DateUtil.java

/**
 *@param dateString date 20091221//ww w . j  a v  a 2s .c o  m
 */
public static String convertStringToTimeString(String dateString) {
    Date date1 = null;
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
    try {
        date1 = simpleDateFormat.parse(dateString);
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    SimpleDateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    String day = format1.format(date1);
    return day;

}

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

/**
 * @param dateString date 20091221//from  ww w  .  j  ava2  s  . c  o m
 * @param adateStrteStr
 * @return
 */
public static String convertString2TimeString(String adateStrteStr) {
    Date date1 = null;
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssS");
    try {
        date1 = simpleDateFormat.parse(adateStrteStr);
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    SimpleDateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");

    String day = format1.format(date1);
    return day;

}

From source file:com.dare2date.externeservice.lastfm.LastfmAPI.java

/**
 * Makes a call to an external Lastfm service and processes this set of LastfmEvent objects.
 * @param username The user from whom the event will be requested.
 * @return A LastfmData object from a specific user, which hold data from all visited last fm events.
 *///w  w w  . jav a 2  s .  c  o m
public TreeSet<LastfmEvent> getUserEventHistory(String username) {
    TreeSet<LastfmEvent> result = new TreeSet<LastfmEvent>();
    String response = httpClient.get("http://ws.audioscrobbler.com/2.0/?method=user.getpastevents&user="
            + username + "&api_key=" + apiKey + "&format=JSON");
    if (response != null) {
        try {
            List<JSONObject> eventsData = JsonPath.read(response, "$..event");
            for (JSONObject eventData : eventsData) {
                result.add(createEventFromJSONData(eventData));
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
    return result;
}

From source file:fr.bde_eseo.eseomega.events.tickets.model.EventTicketItem.java

public Date getParsedDate() {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.FRANCE);
    Date date = null;//from   w  w  w .ja  va 2  s. c o m
    try {
        date = format.parse(datetime);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return date;
}

From source file:lolthx.autohome.buy.AutohomePriceListFetch.java

private boolean isTime(String time, Date start, Date end) {
    try {//from w  w w.  ja va  2  s . c o  m
        Date srcDate = DateUtils.parseDate(time.trim(), "yyyy-MM-dd");
        return between(start, end, srcDate);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return false;
}

From source file:org.noorganization.instalistsynch.controller.local.dba.impl.ClientLogDbController.java

@Override
public Date getLeastRecentUpdateTimeForUuid(String _clientUuid) {
    Cursor cursor = mContentResolver.query(Uri.withAppendedPath(InstalistProvider.BASE_CONTENT_URI, "log"),
            LogInfo.COLUMN.ALL_COLUMNS, LogInfo.COLUMN.ITEM_UUID + " LIKE ? ", new String[] { _clientUuid },
            LogInfo.COLUMN.ACTION_DATE + " DESC ");
    if (cursor == null) {
        return null;
    }/*from   w  w  w.  j a v  a2s . com*/
    if (cursor.getCount() == 0) {
        cursor.close();
        return null;
    }
    cursor.moveToFirst();

    String date = cursor.getString(cursor.getColumnIndex(LogInfo.COLUMN.ACTION_DATE));
    try {
        return ISO8601Utils.parse(date, new ParsePosition(0));
    } catch (ParseException e) {
        e.printStackTrace();
        return null;
    } finally {
        cursor.close();
    }
}

From source file:org.openmrs.module.radiology.web.controller.patientreport.SearchPatientReportController.java

@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.GET)
public String searchTest(@RequestParam(value = "date", required = false) String dateStr,
        @RequestParam(value = "patientId") Integer patientId, HttpServletRequest request, Model model) {
    RadiologyService rs = (RadiologyService) Context.getService(RadiologyService.class);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Date date = null;// w w  w .j av a 2 s .  c  o m
    try {
        date = sdf.parse(dateStr);
        Patient patient = Context.getPatientService().getPatient(patientId);
        if (patient != null) {
            List<RadiologyTest> radiologyTests = rs.getRadiologyTestsByDateAndPatient(date, patient);
            if ((radiologyTests != null) && (!radiologyTests.isEmpty())) {
                Map<Concept, Set<Concept>> testTreeMap = (Map<Concept, Set<Concept>>) request.getSession()
                        .getAttribute(RadiologyConstants.SESSION_TEST_TREE_MAP);
                List<TestResultModel> trms = renderTests(radiologyTests, testTreeMap);
                trms = formatTestResult(trms);
                model.addAttribute("tests", trms);
            }
        }
    } catch (ParseException e) {
        e.printStackTrace();
        System.out.println("Error when parsing order date!");
        return null;
    }
    return "/module/radiology/patientreport/search";
}

From source file:com.envirover.spl.stream.RockBlockService.java

@POST
@Produces(MediaType.TEXT_HTML)/* w  ww . ja  v  a 2  s. c  om*/
public String postMobileOriginatedMessage(@FormParam(PARAM_IMEI) String imei,
        @FormParam(PARAM_MOMSN) String momsn, @FormParam(PARAM_TRANSMIT_TIME) String transmitTime,
        @FormParam(PARAM_IRIDIUM_LATITUDE) String iridiumLatitude,
        @FormParam(PARAM_IRIDIUM_LONGITUDE) String iridiumLongitude,
        @FormParam(PARAM_IRIDIUM_CEP) String iridiumCep, @FormParam(PARAM_DATA) String data) {

    Date time = new Date();

    try {
        //Time stamp like '17-04-03 02:11:35'
        SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
        time = sdf.parse(transmitTime);
    } catch (ParseException e) {
        e.printStackTrace();
    }

    try {
        MAVLinkPacket packet = getPacket(data);

        if (packet != null) {
            MAVLinkOutputStream stream = MAVLinkOutputStreamFactory.getMAVLinkOutputStream();

            stream.writePacket(imei, time, packet);
        } else {
            logger.warning("Invalid MAVLink message received: " + data);
        }
    } catch (DecoderException e) {
        logger.severe(e.toString());
    } catch (IOException e) {
        logger.severe(e.toString());
    }

    return "";
}

From source file:org.openmrs.module.billingui.page.controller.ListOfOrderPageController.java

public String get(PageModel model, UiSessionContext sessionContext, PageRequest pageRequest, UiUtils ui,
        @RequestParam("patientId") Integer patientId,
        @RequestParam(value = "date", required = false) String dateStr) {
    pageRequest.getSession().setAttribute(ReferenceApplicationWebConstants.SESSION_ATTRIBUTE_REDIRECT_URL,
            ui.thisUrl());/*from w ww . ja va2s.  co m*/
    sessionContext.requireAuthentication();
    Boolean isPriviledged = Context.hasPrivilege("Access Billing");
    if (!isPriviledged) {
        return "redirect: index.htm";
    }
    BillingService billingService = Context.getService(BillingService.class);
    PatientService patientService = Context.getPatientService();
    Patient patient = patientService.getPatient(patientId);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Date date = null;
    try {
        date = sdf.parse(dateStr);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    List<OpdTestOrder> listOfOrders = billingService.listOfOrder(patientId, date);
    // Add Patient Details on the page where Order ID is clicked
    HospitalCoreService hospitalCoreService = Context.getService(HospitalCoreService.class);
    PatientSearch patientSearch = hospitalCoreService.getPatientByPatientId(patientId);

    model.addAttribute("age", patient.getAge());

    if (patient.getGender().equals("M")) {
        model.addAttribute("gender", "Male");
    }
    if (patient.getGender().equals("F")) {
        model.addAttribute("gender", "Female");
    }
    model.addAttribute("category", patient.getAttribute(14));
    model.addAttribute("previousVisit", hospitalCoreService.getLastVisitTime(patient));

    if (patient.getAttribute(43) == null) {
        model.addAttribute("fileNumber", "");
    } else if (StringUtils.isNotBlank(patient.getAttribute(43).getValue())) {
        model.addAttribute("fileNumber", "(File: " + patient.getAttribute(43) + ")");
    } else {
        model.addAttribute("fileNumber", "");
    }
    /*
    if(patient.getAttribute(14).getValue() == "Waiver"){
     model.addAttribute("exemption", patient.getAttribute(32));
    }
    else if(patient.getAttribute(14).getValue()!="General" && patient.getAttribute(14).getValue()!="Waiver"){
     model.addAttribute("exemption", patient.getAttribute(36));
    }
    else {
     model.addAttribute("exemption", " ");
    }
    */

    model.addAttribute("patientSearch", patientSearch);
    model.addAttribute("listOfOrders", listOfOrders);
    model.addAttribute("patientId", patientId);
    model.addAttribute("date", dateStr);
    return null;
}

From source file:com.davidmogar.alsa.infraestructure.populators.TestPopulator.java

@PostConstruct
private void populate() {
    Place origin = new Place();
    origin.setName("Oviedo");
    origin.setLatitude(1L);/*from   www. j av a  2  s . c  om*/
    origin.setLongitude(2L);
    origin.setDescription("bajkl bajjklb jfsdjhga jklbaj bajkl bajkl bajjjds bajlba jbal baj");

    Place destination = new Place();
    destination.setName("San Sebastian");
    destination.setLatitude(1L);
    destination.setLongitude(2L);
    destination.setDescription("bajkl bajjklb jfsdjhga jklbaj bajkl bajkl bajjjds bajlba jbal baj");

    placeDataService.deleteAll();
    placeDataService.save(origin);
    placeDataService.save(destination);

    LOGGER.debug("Added places Oviedo and San Sebastian");

    Route routeOneWay = Route.getBuilder("Oviedo-Donosti", origin, destination).distance(400L).build();

    routeDataService.deleteAll();
    routeOneWay = routeDataService.save(routeOneWay);

    LOGGER.debug("Added route Oviedo-Donosti");

    Route routeReturn = Route.getBuilder("Donosti-Oviedo", destination, origin).distance(400L).build();

    routeReturn = routeDataService.save(routeReturn);

    LOGGER.debug("Added route Donosti-Oviedo");

    busDataService.deleteAll();
    Bus bus = busDataService.save(new Bus("54308", new Date(), BusType.NORMAL));

    LOGGER.debug("Added bus with license plate 54308");

    try {
        Date date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse("2015-01-12 15:00:00");

        Schedule schedule = new Schedule();
        schedule.setRoute(routeOneWay);
        schedule.setBus(bus);
        schedule.setDate(date);
        schedule.setHours(5.5);
        schedule.setPrice(50.5);

        scheduleDataService.save(schedule);

        LOGGER.debug("Added schedule for route Oviedo-Donosti");

        schedule = new Schedule();
        schedule.setRoute(routeReturn);
        schedule.setBus(bus);
        schedule.setDate(date);
        schedule.setHours(5.5);
        schedule.setPrice(50.5);

        scheduleDataService.save(schedule);

        LOGGER.debug("Added schedule for route Donosti-Oviedo");
    } catch (ParseException e) {
        e.printStackTrace();
    }
}