Example usage for java.text ParseException getLocalizedMessage

List of usage examples for java.text ParseException getLocalizedMessage

Introduction

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

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:jp.dip.komusubi.botter.gae.module.jal5971.FlightStatusEntry.java

public Date getScheduledArrivalDate() {
    try {/*w w  w .ja v  a2 s.  co  m*/
        return DateUtils.parseDate(getElement(column, 6).getText().trim(), new String[] { HOUR_FORMAT });
    } catch (ParseException e) {
        logger.warn("scheduledArrivalDate() parse error {}", e.getLocalizedMessage());
        return resolver.resolve();
    }
}

From source file:jp.dip.komusubi.botter.gae.module.jal5971.FlightStatusEntry.java

public Date getScheduledDepartureDate() {
    try {//  w w  w.  ja  va  2s  .  c om
        return DateUtils.parseDate(getElement(column, 2).getText().trim(), new String[] { HOUR_FORMAT });
    } catch (ParseException e) {
        logger.warn("scheduledDepartureDate() parse error {}", e.getLocalizedMessage());
        return resolver.resolve();
    }
}

From source file:org.kuali.mobility.events.dao.EventsDaoUMImpl.java

public List<Event> loadEventsForCategory(final String campus, final String categoryId) {

    LOG.debug("Loading event feed for category " + categoryId);
    if (null == getEvents() || getEvents().isEmpty()) {
        LOG.debug("Events list was empty, creating a new one.");
        //setEvents( new ArrayList<Event>() );
    }/*w  w w .j a  v a  2s .  c  om*/
    if (null == getCategories() || getCategories().isEmpty()) {
        LOG.debug("Category list was empty, initializing a new one.");
        initData(campus);
    }

    List<Event> newEvents = new ArrayList<Event>();

    Category category = (Category) CollectionUtils.find(getCategories(),
            new CategoryPredicate(campus, categoryId));
    ;

    if (category != null) {
        LOG.debug("Found category object for id " + categoryId);
        XStream xstream = new XStream();
        xstream.processAnnotations(UMEventReader.class);
        xstream.processAnnotations(UMEvent.class);
        xstream.processAnnotations(UMSponsor.class);
        UMEventReader eventReader = null;
        try {
            URL url = new URL(category.getUrlString() + "&_type=xml");
            LOG.debug("Mapping events from url: " + category.getUrlString());

            if (url != null) {
                eventReader = (UMEventReader) xstream.fromXML(url);
            }
        } catch (MalformedURLException mue) {
            LOG.error(mue.getLocalizedMessage());
        }
        LOG.debug("check eventReader " + (eventReader == null ? "null" : "mnot null"));
        LOG.debug("check eventReader.getEvents " + (eventReader.getEvents() == null ? "null" : "mnot null"));

        if (eventReader != null && eventReader.getEvents() != null) {
            for (UMEvent e : eventReader.getEvents()) {
                LOG.debug("processing e " + e.getTitle());
                Event newEvent = (Event) getApplicationContext().getBean("event");
                newEvent.setEventId(e.getId());
                newEvent.setCategory(category);
                newEvent.setTitle(e.getTitle());
                newEvent.setDisplayStartTime(e.getTimeBegin());
                //Saket's Addition
                newEvent.setType(e.getType());
                newEvent.setDisplayStartDate(e.getDateBegin());
                newEvent.setLocation(e.getBuildingName());
                newEvent.setLink(e.getUrl());
                try {
                    if (e.getTsBegin() != null && e.getTsBegin().isEmpty() == false) {
                        newEvent.setStartDate(sdf.parse(e.getTsBegin()));
                    }
                    if (e.getTsEnd() != null && e.getTsEnd().isEmpty() == false) {
                        newEvent.setEndDate(sdf.parse(e.getTsEnd()));
                    }
                } catch (ParseException e1) {
                    LOG.error(e1.getLocalizedMessage());
                }
                newEvent.setDisplayEndTime(e.getTimeEnd());
                newEvent.setDisplayEndDate(e.getDateEnd());
                List<String> myDescription = new ArrayList<String>();
                myDescription.add(e.getDescription());
                newEvent.setDescription(myDescription);
                List<EventContact> myContacts = new ArrayList<EventContact>();
                for (UMSponsor f : e.getSponsors()) {
                    EventContact newContact = (EventContact) getApplicationContext().getBean("eventContact");
                    newContact.setName(f.getGroupName());
                    newContact.setUrl(f.getWebsite());
                    myContacts.add(newContact);
                }
                newEvent.setContact(myContacts);
                LOG.debug("CONTACT " + newEvent.getContact());
                newEvents.add(newEvent);
            }
        }
    }
    return (newEvents);
}

From source file:org.dd4t.providers.impl.BrokerBinaryProvider.java

@Override
public DateTime getLastPublishDate(String tcmUri) throws ItemNotFoundException {
    TCMURI binaryTcmUri = null;//w  ww  .  j a  v a  2s  . c  o m
    try {
        binaryTcmUri = new TCMURI(tcmUri);
    } catch (ParseException e) {
        LOG.error(e.getLocalizedMessage(), e);
    }

    if (binaryTcmUri == null) {
        return Constants.THE_YEAR_ZERO;
    }

    WebComponentMetaFactory webComponentMetaFactory = FACTORY_CACHE.get(binaryTcmUri.getPublicationId());

    if (webComponentMetaFactory == null) {
        webComponentMetaFactory = new WebComponentMetaFactoryImpl(binaryTcmUri.getPublicationId());
        FACTORY_CACHE.put(binaryTcmUri.getPublicationId(), webComponentMetaFactory);
    }

    final ComponentMeta binaryMeta = webComponentMetaFactory.getMeta(tcmUri);

    if (binaryMeta != null && binaryMeta.getLastPublicationDate() != null) {
        return new DateTime(binaryMeta.getLastPublicationDate());
    }
    return Constants.THE_YEAR_ZERO;
}

From source file:com.example.parkhere.provider.ParkingSpaceReservationDetailsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    user = (User) getArguments().getSerializable(USER_KEY);
    parkingSpace = (ParkingSpace) getArguments().getSerializable(PARKING_SPACE_KEY);
    providerReservation = (ProviderReservation) getArguments().getSerializable(PROVIDER_RESERVATION_KEY);

    rootView = inflater.inflate(R.layout.fragment_parking_space_reservation_details, container, false);

    ps_resdet_resid = (TextView) rootView.findViewById(R.id.ps_resdet_resid);
    ps_resdet_address = (TextView) rootView.findViewById(R.id.ps_resdet_address);
    ps_resdet_dateres = (TextView) rootView.findViewById(R.id.ps_resdet_dateres);
    ps_resdet_time = (TextView) rootView.findViewById(R.id.ps_resdet_time);
    ps_resdet_price = (TextView) rootView.findViewById(R.id.ps_resdet_price);
    ps_resdet_seeker = (TextView) rootView.findViewById(R.id.ps_resdet_seeker);

    ps_resdet_resid.setText(Integer.toString(providerReservation.getId()));
    ps_resdet_address.setText(parkingSpace.getAddress() + " " + parkingSpace.getCity() + ", "
            + parkingSpace.getState() + " " + parkingSpace.getZipCode() + " " + parkingSpace.getCountry());
    ps_resdet_dateres.setText(providerReservation.getDateReserved());
    ps_resdet_time.setText("Start: " + providerReservation.getStartDate() + " "
            + getTime(providerReservation.getStartHour()) + "\n" + "End: " + providerReservation.getEndDate()
            + " " + getTime(providerReservation.getEndHour()));
    ps_resdet_price.setText("Total Price: $" + Double.toString(providerReservation.getTotalPrice()) + "\n"
            + "Total Paid to You: $" + providerReservation.getTotalPrice() * 0.90 + "\n"
            + "Direct Deposit Information: " + "\n" + providerReservation.getProviderPayment().getBank() + "\n"
            + providerReservation.getProviderPayment().getAccountType() + "\n" + "Account Number Ending in "
            + providerReservation.getProviderPayment().getAccountNumber() + "\n" + "Routing Number Ending in "
            + providerReservation.getProviderPayment().getRoutingNumber());

    Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.BASE_URL)
            .addConverterFactory(GsonConverterFactory.create()).build();

    RequestInterface requestInterface = retrofit.create(RequestInterface.class);

    ServerRequest request = new ServerRequest();
    request.setOperation(Constants.GET_CURRENT_TIME_OPERATION);
    Call<ServerResponse> response = requestInterface.operation(request);

    response.enqueue(new Callback<ServerResponse>() {
        @Override/*from   www  . j ava  2 s  .c om*/
        public void onResponse(Call<ServerResponse> call, retrofit2.Response<ServerResponse> response) {
            ServerResponse resp = response.body();
            try {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm a");
                Date currentDate = sdf.parse(resp.getMessage());
                Date endDate = sdf.parse(
                        providerReservation.getEndDate() + " " + getTime(providerReservation.getEndHour()));
                upcoming = endDate.after(currentDate);

                if (upcoming == true) {
                    ps_resdet_seeker.setText(providerReservation.getSeeker().getFirstName() + "\n"
                            + providerReservation.getSeeker().getEmail() + "\n"
                            + providerReservation.getSeeker().getPhoneNumber() + "\n" + "\n" + "Seeker Vehicle"
                            + "\n" + providerReservation.getSeekerVehicle().getMake() + " "
                            + providerReservation.getSeekerVehicle().getModel() + " "
                            + providerReservation.getSeekerVehicle().getYear() + "\n"
                            + providerReservation.getSeekerVehicle().getColor() + "\n"
                            + providerReservation.getSeekerVehicle().getLicensePlate());
                } else {
                    ps_resdet_seeker.setText(providerReservation.getSeeker().getFirstName() + "\n"
                            + providerReservation.getSeeker().getEmail() + "\n"
                            + providerReservation.getSeeker().getPhoneNumber());
                }
            } catch (ParseException e) {
                System.out.println("Parse Exception " + e.getLocalizedMessage());
            }
        }

        @Override
        public void onFailure(Call<ServerResponse> call, Throwable t) {
            Snackbar.make(rootView, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
        }
    });

    return rootView;
}

From source file:net.osten.watermap.convert.SanGorgonioReport.java

/**
 * Converts the SanG datafile to water reports.
 *
 * @return set of water reports/*www .  j a  v a 2 s  .  co m*/
 */
public Set<WaterReport> convert() {
    Set<WaterReport> results = new HashSet<WaterReport>();

    /*
    Multiset<String> liness = HashMultiset.create(
       Splitter.on('\t')
       .trimResults()
       .omitEmptyStrings()
       .split(
    (filePath != null ?
       Files.asCharSource(new File(filePath), Charsets.UTF_8).read()
       : Resources.asCharSource(fileURL, Charsets.UTF_8).read())));
    System.out.println("found " + liness.size() + " lines");
     */

    try {
        ImmutableList<String> lines = filePath != null
                ? Files.asCharSource(new File(filePath), Charsets.UTF_8).readLines()
                : Resources.asCharSource(fileURL, Charsets.UTF_8).readLines();
        log.fine("found " + lines.size() + " lines");

        for (String line : lines) {
            List<String> fields = Splitter.on('\t').trimResults().splitToList(line);

            /* Layout of datafile.txt -
             * String postDate = nextLine[0];
             * String location = nextLine[1];
             * String comment = nextLine[2];
             * String logDate = nextLine[3];
             * String user = nextLine[4];
             */

            WaterReport wr = new WaterReport();
            try {
                wr.setLastReport(dateFormatter.parse(fields.get(3)));
                wr.setLocation("San Gorgonio");
                wr.setDescription(fields.get(2));
                wr.setName(fields.get(1));
                wr.setSource(SOURCE_TITLE);
                wr.setUrl(SOURCE_URL);

                if (locationCoords.containsKey(wr.getName())) {
                    List<String> coords = Splitter.on(',').splitToList(locationCoords.get(wr.getName()));
                    wr.setLon(new BigDecimal(coords.get(0)));
                    wr.setLat(new BigDecimal(coords.get(1)));
                } else {
                    log.fine("==> cannot find coords for " + wr.getName());
                }

                wr.setState(WaterStateParser.parseState(wr.getDescription()));

                boolean added = results.add(wr);
                if (!added) {
                    results.remove(wr);
                    results.add(wr);
                }
            } catch (java.text.ParseException e) {
                log.severe(e.getLocalizedMessage());
            }
        }
    } catch (IOException e) {
        log.severe(e.getLocalizedMessage());
    }

    return results;
}

From source file:org.openestate.io.is24_csv.records.StellplatzMiete.java

public Calendar getFreiAb() {
    try {//from   www . j  a  v  a  2  s. c o  m
        return Is24CsvFormat.parseDateAsCalendar(this.get(FIELD_FREI_AB));
    } catch (ParseException ex) {
        LOGGER.warn("Can't read 'frei ab'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.is24_csv.records.StellplatzMiete.java

public Calendar getFreiBis() {
    try {//from w w  w  .  j  a va2  s .c o  m
        return Is24CsvFormat.parseDateAsCalendar(this.get(FIELD_FREI_BIS));
    } catch (ParseException ex) {
        LOGGER.warn("Can't read 'frei bis'!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:com.nextgis.maplibui.control.DateTime.java

public void setValue(Object val) {
    if (val instanceof Long) {
        mValue = (long) val;
    } else if (val instanceof Date) {
        mValue = ((Date) val).getTime();
    } else if (val instanceof Calendar) {
        mValue = ((Calendar) val).getTimeInMillis();
    } else if (val instanceof String) {
        try {/*from   w ww. ja  v a  2  s .c  o  m*/
            String stringVal = (String) val;
            Date date = mDateFormat.parse(stringVal);
            mValue = date.getTime();
        } catch (ParseException e) {
            Log.d(TAG, "Date parse error, " + e.getLocalizedMessage());
            mValue = 0L;
        }
    } else {
        return;
    }

    setText(getText());

    setSingleLine(true);
    setFocusable(false);
    setOnClickListener(getDateUpdateWatcher(mPickerType));

    String pattern = mDateFormat.toLocalizedPattern();
    setHint(pattern);
}

From source file:org.kalypso.wspwin.core.WspWinProfProj.java

/**
 * Reads the file profproj.txt//from   w  w w  .j a  v a  2 s  .c o  m
 */
public void read(final File wspwinDir) throws IOException, ParseException {
    final WspWinProject wspWinProject = new WspWinProject(wspwinDir);
    final File profprojFile = wspWinProject.getProfProjFile();

    try (LineNumberReader reader = new LineNumberReader(new FileReader(profprojFile));) {
        final int[] counts = readStrHeader(reader);
        final int profilCount = counts[0];
        final int relationCount = counts[1];

        if (relationCount == 0) {
            // ignore for now; later we may do sanity checks, if there are unused profiles
        }

        final ProfileBean[] profiles = ProfileBean.readProfiles(reader, profilCount);
        m_profiles.addAll(Arrays.asList(profiles));
    } catch (final ParseException pe) {
        final String msg = Messages.getString("org.kalypso.wspwin.core.WspCfg.6") //$NON-NLS-1$
                + profprojFile.getAbsolutePath() + " \n" + pe.getLocalizedMessage(); //$NON-NLS-1$
        final ParseException newPe = new ParseException(msg, pe.getErrorOffset());
        newPe.setStackTrace(pe.getStackTrace());
        throw newPe;
    }
}