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:org.egov.ptis.domain.entity.property.DailyCollectionReportSearchVLT.java

public void setToDate(final String toDate) {
    if (isNotBlank(toDate))
        try {/*from   w ww. j a  v a  2  s .  c  om*/
            Calendar cal = Calendar.getInstance();
            cal.setTime(dtft.parse(toDate));
            cal.set(Calendar.HOUR_OF_DAY, 23);
            cal.set(Calendar.SECOND, 59);
            cal.set(Calendar.MINUTE, 59);
            cal.set(Calendar.MILLISECOND, 999);
            this.toDate = ft.format(cal.getTime());
        } catch (ParseException e) {
            throw new ValidationException(e.getMessage());
        }
}

From source file:org.egov.wtms.application.entity.DailyWTCollectionReportSearch.java

public void setToDate(final String toDate) {

    if (isNotBlank(toDate)) {
        try {//from   w w w  .  ja  v a2s.com
            Calendar endOfToDate = Calendar.getInstance();
            endOfToDate.setTime(dtft.parse(toDate));
            endOfToDate.set(Calendar.HOUR_OF_DAY, 23);
            endOfToDate.set(Calendar.MINUTE, 59);
            endOfToDate.set(Calendar.SECOND, 59);
            endOfToDate.set(Calendar.MILLISECOND, 999);
            this.toDate = ft.format(endOfToDate.getTime());
        } catch (ParseException e) {
            throw new ValidationException(e.getMessage());
        }
    }
}

From source file:com.persistent.cloudninja.scheduler.PerformanceMonitor.java

@Override
public boolean execute() {
    StopWatch watch = new StopWatch();
    try {/*from  w  w  w  .  jav a 2s  .  com*/
        LOGGER.debug("PerformanceMonitor : Execute");
        watch.start();
        Date lastReadTime = kpiValueTempDao.getMaxTimestamp();
        Date lastBatchTime = null;
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S z");
        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        String date = null;
        if (lastReadTime == null) {
            date = dateFormat.format(calendar.getTime());
            lastReadTime = dateFormat.parse(date);
        }
        calendar = Calendar.getInstance();
        date = dateFormat.format(calendar.getTime());
        Date currentUTCTime = dateFormat.parse(date);
        List<KpiValueTempEntity> listKpiValueTempEntities = null;
        while (lastReadTime.getTime() <= currentUTCTime.getTime()) {
            LOGGER.debug("PerformanceMonitor : Process performance counters");
            calendar.setTime(lastReadTime);
            calendar.add(Calendar.MINUTE, 30);
            date = dateFormat.format(calendar.getTime());
            lastBatchTime = dateFormat.parse(date);

            WADPerformanceCountersEntity[] arrPerfCounter = storageUtility
                    .getPerfCounterEntities(lastReadTime.getTime(), lastBatchTime.getTime());

            listKpiValueTempEntities = convertAzureEntityToDBEntity(arrPerfCounter);

            kpiValueTempDao.addAll(listKpiValueTempEntities);
            kpiValueTempDao.executeProcessKpiValues();
            LOGGER.debug("PerformanceMonitor : Process complete");
            lastReadTime = lastBatchTime;
        }
        watch.stop();
        taskCompletionDao.updateTaskCompletionDetails(watch.getTotalTimeSeconds(), "ProcessPerformanceCounters",
                "");
        LOGGER.debug("PerformanceMonitor : Finish");
    } catch (ParseException e) {
        LOGGER.error(e.getMessage(), e);
    }
    return true;
}

From source file:com.quancheng.saluki.core.grpc.router.internal.ConditionRouter.java

@Override
protected void parseRouter() {
    whenCondition = Maps.newHashMap();/* w  w w  .  j  av a2  s  .c o m*/
    thenCondition = Maps.newHashMap();
    String rulestr = super.getRule();
    String[] rules = StringUtils.split(rulestr, "\n");
    for (String rule : rules) {
        int i = rule.trim().indexOf("=>");
        String whenRule = i < 0 ? null : rule.substring(0, i).trim();
        String thenRule = i < 0 ? rule.trim() : rule.substring(i + 2).trim();
        try {
            whenCondition.putAll(doParseRule(whenRule));
            thenCondition.putAll(doParseRule(thenRule));
        } catch (ParseException e) {
            log.error(e.getMessage(), e);
        }
    }
}

From source file:org.entrystore.repository.backup.BackupScheduler.java

public void run() {
    String backupStatus = rm.getConfiguration().getString(Settings.BACKUP_SCHEDULER, "off");
    if ("off".equalsIgnoreCase(backupStatus.trim())) {
        log.warn("Backup is disabled in configuration");
        return;//from   w w w  .  j  a  v a  2 s .c o m
    }

    try {
        String[] names = scheduler.getJobNames("backupGroup");

        int index = 1;
        if (names.length > 0) {
            // this only works for up to 10 jobs in this group
            index = Integer.valueOf(names[names.length - 1]);
            index++;
        }
        String jobIndex = String.valueOf(index);

        job = new JobDetail(jobIndex, "backupGroup", BackupJob.class);
        job.getJobDataMap().put("rm", this.rm);
        job.getJobDataMap().put("gzip", this.gzip);
        job.getJobDataMap().put("contextURI", this.backupEntryURI);
        job.getJobDataMap().put("maintenance", this.maintenance);
        job.getJobDataMap().put("upperLimit", this.upperLimit);
        job.getJobDataMap().put("lowerLimit", this.lowerLimit);
        job.getJobDataMap().put("expiresAfterDays", this.expiresAfterDays);

        CronTrigger trigger = new CronTrigger("trigger" + jobIndex, "backupGroup", jobIndex, "backupGroup",
                this.timeRegularExpression);
        scheduler.addJob(job, true);
        scheduler.scheduleJob(trigger);
        scheduler.start();
    } catch (ParseException e) {
        log.error(e.getMessage());
    } catch (SchedulerException e) {
        log.error(e.getMessage());
    }
}

From source file:action.ShowTimeSeriesWithForecastAction.java

/**
* Metoda obslugujaca zdarzenie, odpowiedzialna za inicjalizacje algorytmu genetycznego
*//*from  w ww.  jav a 2  s.com*/
public void actionPerformed(ActionEvent e) {

    try {

        if (window.getSliderSelekcji().getValue() + window.getSliderKrzyzowania().getValue()
                + window.getSliderMutacji().getValue() != 100)
            throw new ParseException(
                    "Please insert correct data for Selection, Crossing and Mutation. The sum of the three has to equal 100%",
                    0);

        TimeSeries timeSeries = window.getCurrentTimeSeries();
        if (timeSeries == null || timeSeries.isEmpty())
            throw new DataLengthException();

        SlidingTimeWindow slidingTimeWindow = new SlidingTimeWindow(
                this.parseToWindowForm(window.getTimeWindowField().getText()));

        if (window.getRdBtnStochastic().isSelected())
            GASettings.getInstance()
                    .setSelectionMethod(SelectionMethod.STOCHASTIC_UNIVERSAL_SAMPLING_SELECTION);

        if (window.getRdbtnArmaForecast().isSelected())
            GASettings.getInstance().setForecastMethod(ForecastMethod.ARMA_FORECAST);

        GASettings.getInstance().setConcurrent(true);

        ApplicationContext context = new AnnotationConfigApplicationContext(ForecastConfig.class);
        AbstractForecast forecast = (AbstractForecast) context.getBean("forecast");

        forecast.initializeGeneticAlgorithm((TimeSeries) timeSeries.clone(),
                (Integer) window.getPopulSizeField().getValue(), slidingTimeWindow,
                (Integer) window.getIterNumberField().getValue(),
                (double) window.getSliderProbOfCross().getValue() / 100,
                (double) window.getSliderProbOfMutat().getValue() / 100,
                (double) window.getSliderSelekcji().getValue() / 100,
                (double) window.getSliderKrzyzowania().getValue() / 100,
                (double) window.getSliderMutacji().getValue() / 100);
        forecast.initializeForecast((Integer) window.getPeriodOfPredField().getValue());

        forecast.addObserver(new GAChartObserver(window.getFitnessChart(),
                window.getTimeSeriesChartWithForecast(), (Integer) window.getPeriodOfPredField().getValue()));
        forecast.addObserver(new GAStatisticObserver(window.getForecast(),
                (Integer) window.getPeriodOfPredField().getValue()));
        forecast.execute();
        window.getTabbedPane().setSelectedIndex(3);

    } catch (CloneNotSupportedException e1) {
        e1.printStackTrace();
    } catch (DataLengthException de) {
        JOptionPane.showMessageDialog(window, "Current data is not set or empty", "Error",
                JOptionPane.ERROR_MESSAGE);
    } catch (ParseException pe) {
        JOptionPane.showMessageDialog(window, pe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    } catch (Exception exc) {
        JOptionPane.showMessageDialog(window, "Wrong data", "Error", JOptionPane.ERROR_MESSAGE);
    }
}

From source file:ch.cyberduck.core.ftp.parser.CommonUnixFTPEntryParser.java

protected FTPFile parseFTPEntry(String typeStr, String usr, String grp, long filesize, String datestr,
        String name, String endtoken) {
    final FTPExtendedFile file = new FTPExtendedFile();
    int type;//from w  w w.jav  a2  s  . c  om
    try {
        file.setTimestamp(this.parseTimestamp(datestr));
    } catch (ParseException e) {
        log.warn(e.getMessage());
    }

    // bcdlfmpSs-
    switch (typeStr.charAt(0)) {
    case 'd':
        type = FTPFile.DIRECTORY_TYPE;
        break;
    case 'l':
        type = FTPFile.SYMBOLIC_LINK_TYPE;
        break;
    case 'b':
    case 'c':
    case 'f':
    case '-':
        type = FTPFile.FILE_TYPE;
        break;
    default:
        type = FTPFile.UNKNOWN_TYPE;
    }

    file.setType(type);
    file.setUser(usr);
    file.setGroup(grp);

    int g = 4;
    for (int access = 0; access < 3; access++, g += 4) {
        // Use != '-' to avoid having to check for suid and sticky bits.
        file.setPermission(access, FTPFile.READ_PERMISSION, (!group(g).equals("-")));
        file.setPermission(access, FTPFile.WRITE_PERMISSION, (!group(g + 1).equals("-")));

        String execPerm = group(g + 2);
        if (execPerm.equals("-")) {
            file.setPermission(access, FTPFile.EXECUTE_PERMISSION, false);
        } else {
            file.setPermission(access, FTPFile.EXECUTE_PERMISSION, Character.isLowerCase(execPerm.charAt(0)));
            if (0 == access) {
                file.setSetuid(execPerm.charAt(0) == 's' || execPerm.charAt(0) == 'S');
            }
            if (1 == access) {
                file.setSetgid(execPerm.charAt(0) == 's' || execPerm.charAt(0) == 'S');
            }
            if (2 == access) {
                file.setSticky(execPerm.charAt(0) == 't' || execPerm.charAt(0) == 'T');
            }
        }
    }

    file.setSize(filesize);

    if (null == endtoken) {
        file.setName(name);
    } else {
        // oddball cases like symbolic links, file names
        // with spaces in them.
        name += endtoken;
        if (type == FTPFile.SYMBOLIC_LINK_TYPE) {

            int end = name.indexOf(" -> ");
            // Give up if no link indicator is present
            if (end == -1) {
                file.setName(name);
            } else {
                file.setName(name.substring(0, end));
                file.setLink(name.substring(end + 4));
            }

        } else {
            file.setName(name);
        }
    }
    return file;
}

From source file:com.omertron.slackbot.model.sheets.GameLogRow.java

/**
 * Take the row from the sheet API and convert it to this object
 *
 * @param valueRange//from  w w  w .  j a  v a  2  s.  c o  m
 */
public final void processValueRange(ValueRange valueRange) {
    if (valueRange.getValues() == null || valueRange.getValues().isEmpty()) {
        return;
    }

    List<Object> row = valueRange.getValues().get(0);

    if (!row.isEmpty()) {
        try {
            this.date = DateUtils.parseDate(row.get(0).toString().substring(5), "dd MMM yy");
        } catch (ParseException ex) {
            LOG.info("Failed to parse date: '{}'", ex.getMessage());
        }
    }
    if (row.size() >= 2) {
        this.gameName = row.get(1).toString();
    }
    if (row.size() >= 3) {
        this.gameId = NumberUtils.toInt(row.get(2).toString(), 0);
    }
    if (row.size() >= 5) {
        this.chooser = row.get(4).toString();
    }
    if (row.size() >= 6) {
        this.attendees = row.get(5).toString();
    }
    if (row.size() >= 7) {
        this.winners = row.get(6).toString();
    }
    if (row.size() >= 9) {
        this.owner = row.get(8).toString();
    }

    LOG.info("{}", ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE));
}

From source file:com.eryansky.common.utils.DateUtil.java

/**
 * // w  ww. ja  v a  2  s .  co  m
 * @date1?date2? ? 2008-08-08 16:16:34
 * @param date1
 * @param date2
 * @return
 */
public static boolean isDateBefore(String date1, String date2) {
    try {
        DateFormat df = DateFormat.getDateTimeInstance();
        return df.parse(date1).before(df.parse(date2));
    } catch (ParseException e) {
        System.out.print("[SYS] " + e.getMessage());
        return false;
    }
}

From source file:com.eryansky.common.utils.DateUtil.java

public static boolean isDateBefore(String date2) {
    try {/*from   w w w  .j a  va2 s .  c  o m*/
        Date date1 = new Date();
        DateFormat df = DateFormat.getDateTimeInstance();
        return date1.before(df.parse(date2));
    } catch (ParseException e) {
        System.out.print("[SYS] " + e.getMessage());
        return false;
    }
}