Example usage for java.text ParseException getMessage

List of usage examples for java.text ParseException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.googlecode.phisix.api.resource.StocksResource.java

@GET
@Path(value = "/{symbol}.{date}")
public Stocks getStockByDate(@PathParam(value = "symbol") String symbol,
        @PathParam(value = "date") String date) {
    Date tradingDate;//from   w w  w .ja v  a2  s.  c  o m
    try {
        tradingDate = dateParser.parse(date);
    } catch (ParseException e) {
        throw new BadRequestException(e.getMessage());
    }
    return stocksRepository.findBySymbolAndTradingDate(symbol.toUpperCase(), tradingDate);
}

From source file:org.kuali.student.r2.core.process.krms.termresolver.StudentDeceasedTermResolver.java

@Override
public Boolean resolve(Map<String, Object> resolvedPrereqs, Map<String, String> parameters)
        throws TermResolutionException {

    String studentId = (String) resolvedPrereqs.get(RulesExecutionConstants.PERSON_ID_TERM.getName());
    Date currentDate = (Date) resolvedPrereqs.get(RulesExecutionConstants.AS_OF_DATE_TERM.getName());

    Entity entity = identityService.getEntity(studentId);

    Date deceasedDate = null;//from w  w w .j  a v a  2  s  .co m

    if (entity.getBioDemographics().getDeceasedDate() != null) {
        try {
            deceasedDate = DateUtils.parseDate(entity.getBioDemographics().getDeceasedDate(),
                    new String[] { EntityBioDemographicsContract.DECEASED_DATE_FORMAT });
        } catch (ParseException e) {
            throw new TermResolutionException(e.getMessage(), this, parameters, e);
        }
    }

    if (deceasedDate != null) {
        return deceasedDate.before(currentDate);
    }

    return false;
}

From source file:tasly.greathealth.oms.order.services.impl.OmsOrderAutoApprovalServiceImpl.java

@Override
@Transactional//from   w ww .  j  a  v  a 2 s  .c om
public List<TaslyOrderData> getOrdersByOrderQuerys(final String approvalStatus,
        final String shippingLockStatus) {
    // get the order list by approvalStatus and shippingLockStatus
    Date d = new Date();
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String startDate = df.format(new Date(d.getTime() - timeInterval * 60 * 60 * 1000));
    List<TaslyOrderData> taslyOrderDataList = new ArrayList<TaslyOrderData>();
    try {
        taslyOrderDataList = this.findAll(orderQueryFactory.findTaslyOrdersByQuery(approvalStatus,
                shippingLockStatus, df.parse(startDate)));
    } catch (ParseException e) {
        LOG.error("?" + e.getMessage(), e);
    }
    return taslyOrderDataList;
}

From source file:com.turborep.turbotracker.home.WeatherSer.java

public ArrayList<WeatherForecastBean> getWeathrtForecast() throws WeatherException, ParseException {
    WeatherForecastBean aWeatherForecastBean = null;
    String aStr = connectWebservice();
    ArrayList<WeatherForecastBean> aWeatherForecastList = new ArrayList<WeatherForecastBean>();
    try {//ww w . j  a v a2  s  .  c  o  m
        String aCurrentweatherDesc;
        JSONObject aWeatherObj = new JSONObject(aStr).getJSONObject("data");
        WeatherForecastBean aCurrentWeatherBean = new WeatherForecastBean();
        JSONObject aCurrentWeatherObj = aWeatherObj.getJSONArray("current_condition").getJSONObject(0);
        JSONArray aWeatherDescObj = aCurrentWeatherObj.getJSONArray("weatherDesc");
        JSONObject aCurrDescObj = (JSONObject) aWeatherDescObj.get(0);
        aCurrentweatherDesc = aCurrDescObj.getString("value");
        aCurrentWeatherBean.setItsCurrentWeatherDescription(aCurrentweatherDesc);
        aCurrentWeatherBean.setItsCurrentTempCelc(aCurrentWeatherObj.getInt("temp_C"));
        aCurrentWeatherBean.setItsCurrentWeatherIconlocation(
                ((JSONObject) aCurrentWeatherObj.getJSONArray("weatherIconUrl").get(0)).getString("value"));
        aWeatherForecastList.add(aCurrentWeatherBean);
        JSONArray aWeatherArray = aWeatherObj.getJSONArray("weather");
        for (int index = 0; index < aWeatherArray.length(); index++) {
            aWeatherForecastBean = new WeatherForecastBean();
            JSONObject aWeatherForecastArr = aWeatherArray.getJSONObject(index);
            aWeatherForecastBean.setItsForecastDate(aWeatherForecastArr.getString("date"));
            aWeatherForecastBean.setItsMaxTempCelc((int) aWeatherForecastArr.getInt("tempMaxC"));
            aWeatherForecastBean.setItsMinTempCelc((int) aWeatherForecastArr.getInt("tempMinC"));
            aWeatherForecastBean.setItsMaxTempFH((int) aWeatherForecastArr.getInt("tempMaxF"));
            aWeatherForecastBean.setItsMinTempFH((int) aWeatherForecastArr.getInt("tempMinF"));
            aWeatherForecastBean.setItsWeatherDescription(
                    ((JSONObject) aWeatherForecastArr.getJSONArray("weatherDesc").get(0)).getString("value"));
            aWeatherForecastBean.setItsWeatherIconlocation(
                    ((JSONObject) aWeatherForecastArr.getJSONArray("weatherIconUrl").get(0))
                            .getString("value"));
            aWeatherForecastList.add(aWeatherForecastBean);
        }
    } catch (ParseException e) {
        logger.error(e.getMessage(), e);
        ParseException aParseException = new ParseException(e.getMessage(), e.getErrorOffset());
        throw aParseException;
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        WeatherException aWeatherException = new WeatherException(e.getMessage(), e);
        throw aWeatherException;
    }
    return aWeatherForecastList;
}

From source file:com.appjma.appdeployer.service.Parser.java

private Date getTimeOrThrow(JSONObject json, String key) throws JSONException {
    String time = JSONHelper.getStrinOrNull(json, key);
    try {//w  ww .  j ava  2s. c  om
        return mDateFormat.parse(time);
    } catch (ParseException e) {
        throw new JSONException("Could not parse time field \"" + key + "\" because: " + e.getMessage());
    }
}

From source file:com.googlecode.phisix.api.parser.GsonAwareParser.java

protected Calendar parseAsOfDate(JsonObject jsonObject) {
    String asOfDate = jsonObject.get("securityAlias").getAsString();
    Calendar calendar = null;/*w  ww  .  ja  v a2s.c o m*/
    try {
        Date date = dateParser.parse(asOfDate);
        calendar = Calendar.getInstance(ASIA_MANILA);
        calendar.setTime(date);
    } catch (ParseException e) {
        if (LOGGER.isWarnEnabled()) {
            LOGGER.warn(e.getMessage(), e);
        }
    }
    return calendar;
}

From source file:ilarkesto.form.DateFormField.java

@Override
public void validate() throws ValidationException {
    if (value == null) {
        if (isRequired())
            throw new ValidationException("Eingabe erforderlich");

    } else {/* w  ww  .  ja  v a  2  s.  c  om*/
        try {
            DateParser.parseDate(value);
        } catch (ParseException ex) {
            throw new ValidationException("Eingabe muss ein Datum sein. " + ex.getMessage());
        }
    }
}

From source file:ch.aonyx.broker.ib.api.execution.CommissionReport.java

public DateTime getYieldRedemptionDateTime() {
    try {/*from w  ww .  j  av a 2s.  c  om*/
        return new DateTime(DateUtils.parseDate(String.valueOf(yieldRedemptionDate), DATE_PATTERN).getTime());
    } catch (final ParseException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:br.msf.commons.persistence.springframework.beans.propertyeditors.CustomCalendarEditor.java

/**
 * Parse the Date from the given text, using the specified DateFormat.
 *///from   w  ww  .ja  v a  2s  .  c o m
@Override
public void setAsText(String text) throws IllegalArgumentException {
    if (this.allowEmpty && CharSequenceUtils.isBlankOrNull(text)) {
        // Treat empty String as null value.
        setValue(null);
    } else {
        try {
            Calendar c = new GregorianCalendar();
            c.setTime(this.dateFormat.parse(text));
            setValue(c);
        } catch (ParseException ex) {
            throw new IllegalArgumentException("Could not parse date: " + ex.getMessage(), ex);
        }
    }
}

From source file:org.easyrec.service.web.PluginTimerTask.java

/**
 * This functions returns the time when the plugins have to be executed for the first time for a given time String.
 *
 * @param exeTime: e.g. 23:45/*from  w  w  w.  j  a  va 2 s .c  o m*/
 *
 */
private Date getExecutionTime(String exeTime) {
    try {
        if (exeTime == null) {
            exeTime = "02:00";
        }
        Date now = new Date();
        DateFormat exeTimeFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm");
        DateFormat todayDateFormat = new SimpleDateFormat("dd.MM.yyyy");
        Date execDate = (Date) exeTimeFormat.parse(todayDateFormat.format(now) + " " + exeTime);
        if (now.after(execDate)) {
            Calendar cal = Calendar.getInstance();
            cal.setTime(execDate);
            cal.add(Calendar.DATE, 1);
            execDate = cal.getTime();
        }
        return execDate;
    } catch (ParseException ex) {
        logger.info(ex.getMessage());
    }
    return null;
}