jeudi 13 août 2015

DateFormat return null java

I'm confused. I've tried, well I can not assign a null value to projects which have no date. What am i doing wrong?

 private static String projectDate = null;
    public static void main(String[] args) throws Exception {
        DateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
            List<Project> projects;
            if (projects == null || projects.size() == 0) {
            } else {
                for (Project project : projects) {
                    try {
                        projectDate = formatter.format(project.getLastAnalyzedDate().getTime());
                    }catch (Exception e) {
                        System.err.println("Last Analyzed failed");
                    }
                    outFile.println("<LastAnalyzed>" + projectDate + "</LastAnalyzed>");



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire