Example usage for java.text DateFormat SHORT

List of usage examples for java.text DateFormat SHORT

Introduction

In this page you can find the example usage for java.text DateFormat SHORT.

Prototype

int SHORT

To view the source code for java.text DateFormat SHORT.

Click Source Link

Document

Constant for short style pattern.

Usage

From source file:at.alladin.rmbt.android.loopmode.LoopModeTestFragment.java

public void updateUi() {
    if (holder != null && loopService != null) {
        LoopModeResults loopModeResults = loopService.getLoopModeResults();
        holder.counterText.setText(holder.strings.loopModeString + ": " + loopModeResults.getNumberOfTests()
                + "/" + loopModeResults.getMaxTests()
                + (Status.RUNNING.equals(loopModeResults.getStatus()) ? ""
                        : " (" + (loopService.isActive() ? holder.strings.waiting : holder.strings.finished)
                                + ")"));

        if (Status.RUNNING.equals(loopModeResults.getStatus())) {
            loopModeResults = loopService.updateLoopModeResults(true);

            if (holder.lastTestText.getVisibility() == View.VISIBLE) {
                //loop mode just switched from idle/waiting state to test mode
                holder.lastTestText.setVisibility(View.GONE);
                holder.unimportantListAdapter = null;
            }//from w ww  . j  av  a 2 s. c  o m

            if (holder.progressBar.getVisibility() == View.GONE) {
                holder.progressBar.setVisibility(View.VISIBLE);
                holder.progressText.setVisibility(View.VISIBLE);
            }
        } else {
            if (holder.lastTestText.getVisibility() != View.VISIBLE) {
                //loop mode just switched from test mode to idle/waiting state
                holder.unimportantListAdapter = null;
                holder.lastTestText.setVisibility(View.VISIBLE);
            }

            if (holder.progressBar.getVisibility() == View.VISIBLE) {
                holder.progressBar.setVisibility(View.GONE);
                holder.progressText.setVisibility(View.GONE);
            }
        }

        //update or initialize the "not so important list" (reason why it's at the bottom of the view)
        if (holder.unimportantListAdapter != null) {
            holder.unimportantListAdapter.notifyDataSetChanged();
        } else {
            //different "not so important lists", depending on current test status (running/idle)
            if (Status.RUNNING.equals(loopModeResults.getStatus())) {
                //during test mode, show current test server and client's ip
                final List<DetailsListItem> list = new ArrayList<DetailsListItem>();
                list.add(new ServerNameItem(getActivity(), loopModeResults));
                list.add(new IpAddressItem(getActivity(), loopModeResults));
                holder.unimportantListAdapter = new DetailsInfoListAdapter(getActivity(), list);
                holder.unimportantInfoList.setAdapter(holder.unimportantListAdapter);
            } else {
                //during idle mode, show current data usage, and both loop mode trigger statuses
                final List<DetailsListItem> list = new ArrayList<DetailsListItem>();
                list.add(new TrafficUsageItem(getActivity(), loopModeResults));
                list.add(new LoopModeTriggerItem(getActivity(), loopModeResults, TriggerType.MOVEMENT));
                list.add(new LoopModeTriggerItem(getActivity(), loopModeResults, TriggerType.TIME));
                holder.unimportantListAdapter = new DetailsInfoListAdapter(getActivity(), list);
                holder.unimportantInfoList.setAdapter(holder.unimportantListAdapter);
            }
        }

        //update last test status
        if (holder.lastTestText != null && holder.lastTestText.getVisibility() == View.VISIBLE) {
            String lastTestResult = "";
            if (loopModeResults != null && loopModeResults.getLastTestResults() != null) {
                final Date d = new Date(loopModeResults.getLastTestResults().getLocalStartTimeStamp());
                final DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT,
                        Locale.getDefault());
                switch (loopModeResults.getLastTestResults().getStatus()) {
                case OK:
                    lastTestResult = getString(R.string.loop_test_last_status_ok);
                    break;
                case REJECTED:
                    lastTestResult = getString(R.string.loop_test_last_status_rejected);
                    break;
                default:
                    lastTestResult = getString(R.string.loop_test_last_status_error);
                }
                lastTestResult += " (" + df.format(d) + ")";
            }
            holder.lastTestText.setText(lastTestResult);
        }

        //update measurement list (up/down/ping/qos: last/current test + median values)
        if (holder.measurementFragment != null) {
            if (!holder.measurementFragment.hasResults()) {
                holder.measurementFragment.initList(loopService.getLoopModeResults());
            } else {
                holder.measurementFragment.updateList();
            }
        }

        //update info list (location, network, etc...)
        if (holder.infoFragment != null) {
            if (!holder.infoFragment.hasResults()) {
                holder.infoFragment.initList(infoCollector);
            } else {
                holder.infoFragment.updateList();
            }
        }

        //loop service is active (= at least one test still has to be run or finished) 
        if (loopService.isActive()) {
            int progress = 0;
            String progressText = "";
            int maxProgress = 100;

            if (rmbtService != null) {
                if (Status.RUNNING.equals(loopModeResults.getStatus())) {
                    //test currently running, test mode:
                    intermediateResult = rmbtService.getIntermediateResult(intermediateResult);
                    if (intermediateResult != null) {
                        progress = (int) (RMBTTestFragment.calculateProgress(intermediateResult,
                                rmbtService.getQoSTestProgress(), rmbtService.getQoSTestSize()) * 100d);
                        progressText = holder.strings.testRunningString + ": " + progress + "%";
                        maxProgress = 100;
                    } else if (rmbtService.isConnectionError()) {

                    } else {

                    }
                } else {
                    //no test running, waiting mode:
                    progress = loopModeResults.getNumberOfTests();
                    progressText = holder.strings.loopModeString + ": " + loopModeResults.getNumberOfTests()
                            + "/" + loopModeResults.getMaxTests();
                    maxProgress = loopModeResults.getMaxTests();
                }

                holder.progressBar.setMax(maxProgress);
                holder.progressBar.setProgress(progress);
                holder.progressText.setText(progressText);
            } else {
                //connecting?
            }
        } else {
            holder.cancelButton.setText(R.string.loop_test_quit);
        }
    } else if (holder != null) {
        //service (still) not bound...
    }
}

From source file:org.jactr.entry.iterative.IterativeMain.java

/**
 * @param url/*from w w w.j a  v  a2  s. co  m*/
 * @param listener
 * @param iterations
 * @throws Exception
 */
public void run(URL url) {
    Collection<IIterativeRunListener> listeners = Collections.EMPTY_LIST;

    try {
        Document environment = loadEnvironment(url);
        int iterations = getIterations(environment);
        listeners = createListeners(environment);

        String id = System.getProperty("iterative-id");
        if (id == null)
            id = "";
        else
            id = "-" + id;

        File rootDir = new File(System.getProperty("user.dir"));
        PrintWriter log = new PrintWriter(new FileWriter("iterative-log" + id + ".xml"));
        log.println("<iterative-run total=\"" + iterations + "\">");

        DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG);

        boolean shouldExit = false;

        for (IIterativeRunListener listener : listeners)
            try {
                listener.start(iterations);
            } catch (TerminateIterativeRunException tire) {
                shouldExit = true;
            } catch (Exception e) {
                if (LOGGER.isErrorEnabled())
                    LOGGER.error(listener + " threw an exception on start ", e);
            }

        long startTime = System.currentTimeMillis();

        for (int i = 1; i <= iterations; i++) {
            if (shouldExit)
                break;

            /*
             * create a new working directory
             */
            File workingDir = new File(rootDir, "run-" + i);
            workingDir.mkdirs();

            ACTRRuntime.getRuntime().setWorkingDirectory(workingDir);

            log.println(" <run itr=\"" + i + "\" start=\"" + format.format(new Date()) + "\">");

            try {
                /*
                 * let's do it.
                 */
                if (_aggressiveGC)
                    System.gc();

                iteration(i, iterations, environment, url, listeners, log);

                if (_aggressiveGC)
                    System.gc();
            } catch (TerminateIterativeRunException tire) {
                shouldExit = true;
            } catch (Exception e1) {
                log.print(" <exception><![CDATA[");
                e1.printStackTrace(log);
                log.print("]]></exception>");

                for (IIterativeRunListener listener : listeners)
                    try {
                        listener.exceptionThrown(i, null, e1);
                    } catch (TerminateIterativeRunException tire) {
                        shouldExit = true;
                    } catch (Exception e2) {
                        LOGGER.error(listener + " threw an exception on exception notification ", e2);
                    }
            }

            log.println(" </run>");
            log.flush();

            if (workingDir.list().length == 0)
                workingDir.delete();
        }

        String duration = duration(startTime, System.currentTimeMillis());

        if (LOGGER.isDebugEnabled())
            LOGGER.debug("Total running time : " + duration);

        log.println(" <duration value=\"" + duration + "\"/>");
        log.println("</iterative-run>");
        log.close();
    } catch (Exception e) {
        LOGGER.error("Failed to run fully", e);
        for (IIterativeRunListener listener : listeners)
            try {
                // we ignore the return value here since we're exiting anyway
                listener.exceptionThrown(0, null, e);
            } catch (TerminateIterativeRunException tire) {
                // silently swallow since we're already exiting
            } catch (Exception e2) {
                LOGGER.error(listener + " threw an exception during exception notification ", e2);
            }

    } finally {
        for (IIterativeRunListener listener : listeners)
            try {
                listener.stop();
            } catch (Exception e) {
                LOGGER.error(listener + " threw an exception on stop ", e);
            }
    }
}

From source file:org.mifos.framework.util.helpers.DateUtils.java

public static java.sql.Date getLocaleDate(Locale locale, String value) throws InvalidDateException {
    // the following line is for 1.1 release and will be removed when date
    // is localized
    locale = internalLocale;//from   w w w . j  av a 2  s . co  m
    java.sql.Date result = null;
    if (locale != null && StringUtils.isNotBlank(value)) {
        SimpleDateFormat shortFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale);
        shortFormat.setLenient(false);
        String userPattern = shortFormat.toPattern();
        String dbDate = convertUserToDbFmt(value, userPattern);
        result = java.sql.Date.valueOf(dbDate);
    }
    return result;
}

From source file:com.appeligo.showfiles.ShowFile.java

/**
 * @param request/*  w w w  .j  av a 2  s.c  o m*/
 * @param out
 * @param path
 * @param f
 */
private void listFiles(HttpServletRequest request, PrintWriter out, String path, File f) {
    header(out, path);
    String[] filenames = f.list();
    Arrays.sort(filenames);
    for (int i = 0; i < filenames.length; i++) {
        String filename = filenames[i];
        String fullPathname = documentRoot + path + "/" + filename;
        File child = new File(fullPathname);
        if (child.isHidden()) {
            continue;
        }
        if (filename.endsWith(".flv")) {
            if (new File(fullPathname.replace(".flv", ".html.gz")).exists()) {
                continue;
            }
        }
        filename = filename.replace(":", "%3a");
        if (!path.endsWith("/")) {
            path = path + "/";
        }
        String displayName = filenames[i];
        if (child.isDirectory()) {
            displayName += "/";
            if (!filename.endsWith("/")) {
                filename = filename + "/";
            }
        }
        if (filename.endsWith(".html.gz")) {
            if (new File(fullPathname.replace(".html.gz", ".flv")).exists()) {
                out.println("<a href=\"" + request.getContextPath() + "/ShowFlv" +
                //request.getServletPath()+
                        path + filename.replace(".html.gz", ".flv") + "\">" + "<img src=\""
                        + request.getContextPath() + "/skins/default/videoIcon.gif\" alt=\"video\"/>" + "</a>");
            }
            String tsString = filename.substring(0, filename.indexOf('.'));
            try {
                long timestamp = Long.parseLong(tsString);
                DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
                df.setTimeZone(TimeZone.getTimeZone("GMT"));
                String time = df.format(new Date(timestamp)) + " - ";
                if (time.indexOf(':') == 1) {
                    time = "0" + time;
                }
                out.print(time);
            } catch (NumberFormatException e) {
            }
        } else if (filename.endsWith(".flv") && (filename.indexOf(",") > 0)) {
            showPreview(request, out, path, filename);
        }
        out.print("<a href=\"" + request.getContextPath() + request.getServletPath() + path + filename + "\">"
                + displayName + "</a>");
        if (filename.endsWith(".html.gz")) {
            BufferedReader r;
            try {
                r = new BufferedReader(
                        new InputStreamReader(new GZIPInputStream(new FileInputStream(fullPathname))));
                String line;
                while ((line = r.readLine()) != null) {
                    if (line.startsWith("<title>")) {
                        int nextLT = line.indexOf('<', 7);
                        String title = line.substring(7, nextLT);
                        out.print(" " + title);
                        break;
                    }
                }
                r.close();
            } catch (FileNotFoundException e) {
            } catch (IOException e) {
            }
        }
        out.println("<br/>");
    }
    footer(out);
}

From source file:org.waterforpeople.mapping.app.web.KMLGenerator.java

private HashMap<String, String> loadContextBindings(AccessPoint waterAP, AccessPoint sanitationAP) {
    // log.info(waterAP.getCommunityCode());
    try {/*ww  w .  ja  v  a  2s .  co m*/
        HashMap<String, String> contextBindingsMap = new HashMap<String, String>();
        if (waterAP.getCollectionDate() != null) {
            String timestamp = DateFormatUtils.formatUTC(waterAP.getCollectionDate(),
                    DateFormatUtils.ISO_DATE_FORMAT.getPattern());
            String formattedDate = DateFormat.getDateInstance(DateFormat.SHORT)
                    .format(waterAP.getCollectionDate());
            contextBindingsMap.put("collectionDate", formattedDate);
            contextBindingsMap.put("timestamp", timestamp);
            String collectionYear = new SimpleDateFormat("yyyy").format(waterAP.getCollectionDate());
            contextBindingsMap.put("collectionYear", collectionYear);
        } else {
            // TODO: This block is a problem. We should never have data
            // without a collectionDate so this is a hack so it display
            // properly until I can sort out what to do with this data.
            String timestamp = DateFormatUtils.formatUTC(new Date(),
                    DateFormatUtils.ISO_DATE_FORMAT.getPattern());
            String formattedDate = DateFormat.getDateInstance(DateFormat.SHORT).format(new Date());
            contextBindingsMap.put("collectionDate", formattedDate);
            contextBindingsMap.put("timestamp", timestamp);
            String collectionYear = new SimpleDateFormat("yyyy").format(new Date());
            contextBindingsMap.put("collectionYear", collectionYear);
        }
        contextBindingsMap.put("communityCode", encodeNullDefault(waterAP.getCommunityCode(), "Unknown"));
        contextBindingsMap.put("communityName", encodeNullDefault(waterAP.getCommunityName(), "Unknown"));
        contextBindingsMap.put("typeOfWaterPointTechnology",
                encodeNullDefault(waterAP.getTypeTechnologyString(), "Unknown"));
        contextBindingsMap.put("constructionDateOfWaterPoint",
                encodeNullDefault(waterAP.getConstructionDateYear(), "Unknown"));
        contextBindingsMap.put("numberOfHouseholdsUsingWaterPoint",
                encodeNullDefault(waterAP.getNumberOfHouseholdsUsingPoint(), "Unknown"));
        contextBindingsMap.put("costPer20ML", encodeNullDefault(waterAP.getCostPer(), "Unknown"));
        contextBindingsMap.put("farthestHouseholdFromWaterPoint",
                encodeNullDefault(waterAP.getFarthestHouseholdfromPoint(), "Unknown"));
        contextBindingsMap.put("currentManagementStructureOfWaterPoint",
                encodeNullDefault(waterAP.getCurrentManagementStructurePoint(), "Unknown"));
        contextBindingsMap.put("waterSystemStatus", encodeStatusString(waterAP.getPointStatus()));
        contextBindingsMap.put("photoUrl", encodeNullDefault(waterAP.getPhotoURL(), "Unknown"));
        contextBindingsMap.put("waterPointPhotoCaption",
                encodeNullDefault(waterAP.getPointPhotoCaption(), "Unknown"));
        contextBindingsMap.put("primarySanitationTechnology",
                encodeNullDefault(sanitationAP.getTypeTechnologyString(), "Unknown"));
        contextBindingsMap.put("percentageOfHouseholdsWithImprovedSanitation",
                encodeNullDefault(sanitationAP.getNumberOfHouseholdsUsingPoint(), "Unknown"));
        contextBindingsMap.put("photoOfPrimarySanitationtechnology",
                encodeNullDefault(sanitationAP.getPhotoURL(), "Unknown"));
        contextBindingsMap.put("sanitationPhotoCaption",
                encodeNullDefault(sanitationAP.getPointPhotoCaption(), "Unknown"));
        contextBindingsMap.put("footer", encodeNullDefault(waterAP.getFooter(), "Unknown"));
        contextBindingsMap.put("longitude", encodeNullDefault(waterAP.getLongitude().toString(), "Unknown"));
        contextBindingsMap.put("latitude", encodeNullDefault(waterAP.getLatitude().toString(), "Unknown"));
        contextBindingsMap.put("altitude", encodeNullDefault(waterAP.getAltitude().toString(), "0.0"));
        contextBindingsMap.put("pinStyle", encodePinStyle(waterAP.getPointType(), waterAP.getPointStatus()));
        return contextBindingsMap;
    } catch (NullPointerException nex) {
        log.log(Level.SEVERE, "Could not load context bindings", nex);
    }
    return null;
}

From source file:de.dreier.mytargets.features.statistics.StatisticsFragment.java

@NonNull
private Evaluator getEntryEvaluator(final List<Pair<Float, DateTime>> values) {
    boolean singleTraining = Stream.of(rounds).groupBy(r -> r.trainingId).count() == 1;

    Evaluator eval;/*from   ww  w . ja va 2 s.  co  m*/
    if (singleTraining) {
        eval = new Evaluator() {
            private DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.SHORT);

            @Override
            public long getXValue(List<Pair<Float, DateTime>> values, int i) {
                return values.get(i).second.getMillis() - values.get(0).second.getMillis();
            }

            @Override
            public String getXValueFormatted(float value) {
                final long diffToFirst = (long) value;
                return dateFormat.format(new Date(values.get(0).second.getMillis() + diffToFirst));
            }
        };
    } else {
        eval = new Evaluator() {
            private DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);

            @Override
            public long getXValue(List<Pair<Float, DateTime>> values, int i) {
                return i;
            }

            @Override
            public String getXValueFormatted(float value) {
                return dateFormat.format(values.get((int) value).second.toDate());
            }
        };
    }
    return eval;
}

From source file:mobisocial.bento.anyshare.util.DBHelper.java

public long storePicobjInDatabase(DbObj obj, Context context) {
    long localId = -1; // if replace entry, set ID
    long hash = obj.getHash();
    byte[] raw = obj.getRaw();

    String feedname = obj.getFeedName();
    long parentid = 0;
    try {// w  w  w .j a v  a  2s.c om
        if (obj.getJson().has("target_relation") && obj.getJson().getString("target_relation").equals("parent")
                && obj.getJson().has("target_hash")) {
            parentid = objIdForHash(obj.getJson().getLong("target_hash"));
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    DbUser usr = obj.getSender();
    String sender = "";
    if (usr != null) {
        sender = usr.getName();
    }

    long timestamp = 0;
    String title = "Picture";
    try {
        timestamp = Long.parseLong(obj.getJson().getString("timestamp"));
    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // add object
    long objId = (localId == -1) ? getNextId() : localId;
    String desc = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT)
            .format(new Date(timestamp));
    if (!sender.isEmpty()) {
        desc += " by " + sender;
    }

    ContentValues cv = new ContentValues();
    cv.put(ItemObject._ID, objId);
    cv.put(ItemObject.FEEDNAME, feedname);
    cv.put(ItemObject.TITLE, title);
    cv.put(ItemObject.DESC, desc);
    cv.put(ItemObject.TIMESTAMP, timestamp);
    cv.put(ItemObject.OBJHASH, hash);
    cv.put(ItemObject.PARENT_ID, parentid);

    if (raw != null) {
        cv.put(ItemObject.RAW, raw);
    }

    long newObjId = getWritableDatabase().insertOrThrow(ItemObject.TABLE, null, cv);

    return objId;
}

From source file:org.hyperic.hq.measurement.shared.MeasTabManagerUtil.java

private static String getDateStr(long timems) {
    return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)
            .format(new java.util.Date(timems));
}

From source file:org.svij.taskwarriorapp.activities.TaskAddActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    if (savedInstanceState != null) {
        timestamp = savedInstanceState.getLong("timestamp");

        if (timestamp != 0) {
            cal.setTimeInMillis(timestamp);

            TextView tvDueTime = (TextView) findViewById(R.id.tvDueTime);
            tvDueTime.setText(DateFormat.getTimeInstance(DateFormat.SHORT).format(timestamp));
            TextView tvDueDate = (TextView) findViewById(R.id.tvDueDate);
            tvDueDate.setText(DateFormat.getDateInstance(DateFormat.SHORT).format(timestamp));
        }//w  w w.  jav a  2s  .  c  om
    }
}

From source file:org.cesecore.certificates.endentity.ExtendedInformation.java

/** Implementation of UpgradableDataHashMap function upgrade. */

public void upgrade() {
    if (Float.compare(LATEST_VERSION, getVersion()) != 0) {
        // New version of the class, upgrade
        String msg = intres.getLocalizedMessage("endentity.extendedinfoupgrade", new Float(getVersion()));
        log.info(msg);/*www .  j  av a 2  s  .  com*/

        if (data.get(SUBJECTDIRATTRIBUTES) == null) {
            data.put(SUBJECTDIRATTRIBUTES, "");
        }
        if (data.get(MAXFAILEDLOGINATTEMPTS) == null) {
            setMaxLoginAttempts(DEFAULT_MAXLOGINATTEMPTS);
        }
        if (data.get(REMAININGLOGINATTEMPTS) == null) {
            setRemainingLoginAttempts(DEFAULT_REMAININGLOGINATTEMPTS);
        }
        // In EJBCA 4.0.0 we changed the date format
        if (getVersion() < 3) {
            final DateFormat oldDateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT,
                    Locale.US);
            final FastDateFormat newDateFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm");
            try {
                final String oldCustomStartTime = getCustomData(ExtendedInformation.CUSTOM_STARTTIME);
                if (!isEmptyOrRelative(oldCustomStartTime)) {
                    // We use an absolute time format, so we need to upgrade
                    final String newCustomStartTime = newDateFormat
                            .format(oldDateFormat.parse(oldCustomStartTime));
                    setCustomData(ExtendedInformation.CUSTOM_STARTTIME, newCustomStartTime);
                    if (log.isDebugEnabled()) {
                        log.debug("Upgraded " + ExtendedInformation.CUSTOM_STARTTIME + " from \""
                                + oldCustomStartTime + "\" to \"" + newCustomStartTime
                                + "\" in ExtendedInformation.");
                    }
                }
            } catch (ParseException e) {
                log.error("Unable to upgrade " + ExtendedInformation.CUSTOM_STARTTIME
                        + " in extended user information.", e);
            }
            try {
                final String oldCustomEndTime = getCustomData(ExtendedInformation.CUSTOM_ENDTIME);
                if (!isEmptyOrRelative(oldCustomEndTime)) {
                    // We use an absolute time format, so we need to upgrade
                    final String newCustomEndTime = newDateFormat.format(oldDateFormat.parse(oldCustomEndTime));
                    setCustomData(ExtendedInformation.CUSTOM_ENDTIME, newCustomEndTime);
                    if (log.isDebugEnabled()) {
                        log.debug(
                                "Upgraded " + ExtendedInformation.CUSTOM_ENDTIME + " from \"" + oldCustomEndTime
                                        + "\" to \"" + newCustomEndTime + "\" in ExtendedInformation.");
                    }
                }
            } catch (ParseException e) {
                log.error("Unable to upgrade " + ExtendedInformation.CUSTOM_ENDTIME
                        + " in extended user information.", e);
            }
        }
        // In 4.0.2 we further specify the storage format by saying that UTC TimeZone is implied instead of local server time
        if (getVersion() < 4) {
            final String[] timePatterns = { "yyyy-MM-dd HH:mm" };
            final String oldStartTime = getCustomData(ExtendedInformation.CUSTOM_STARTTIME);
            if (!isEmptyOrRelative(oldStartTime)) {
                try {
                    final String newStartTime = ValidityDate
                            .formatAsUTC(DateUtils.parseDateStrictly(oldStartTime, timePatterns));
                    setCustomData(ExtendedInformation.CUSTOM_STARTTIME, newStartTime);
                    if (log.isDebugEnabled()) {
                        log.debug("Upgraded " + ExtendedInformation.CUSTOM_STARTTIME + " from \"" + oldStartTime
                                + "\" to \"" + newStartTime + "\" in EndEntityProfile.");
                    }
                } catch (ParseException e) {
                    log.error("Unable to upgrade " + ExtendedInformation.CUSTOM_STARTTIME
                            + " to UTC in EndEntityProfile! Manual interaction is required (edit and verify).",
                            e);
                }
            }
            final String oldEndTime = getCustomData(ExtendedInformation.CUSTOM_ENDTIME);
            if (!isEmptyOrRelative(oldEndTime)) {
                // We use an absolute time format, so we need to upgrade
                try {
                    final String newEndTime = ValidityDate
                            .formatAsUTC(DateUtils.parseDateStrictly(oldEndTime, timePatterns));
                    setCustomData(ExtendedInformation.CUSTOM_ENDTIME, newEndTime);
                    if (log.isDebugEnabled()) {
                        log.debug("Upgraded " + ExtendedInformation.CUSTOM_ENDTIME + " from \"" + oldEndTime
                                + "\" to \"" + newEndTime + "\" in EndEntityProfile.");
                    }
                } catch (ParseException e) {
                    log.error("Unable to upgrade " + ExtendedInformation.CUSTOM_ENDTIME
                            + " to UTC in EndEntityProfile! Manual interaction is required (edit and verify).",
                            e);
                }
            }
        }
        data.put(VERSION, Float.valueOf(LATEST_VERSION));
    }
}