Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO sentence from line 363 in Photo.java #720

Open
quagmir3 opened this issue Feb 28, 2024 · 0 comments
Open

TODO sentence from line 363 in Photo.java #720

quagmir3 opened this issue Feb 28, 2024 · 0 comments

Comments

@quagmir3
Copy link

quagmir3 commented Feb 28, 2024

Subject of the issue

We found that at line 363 in Photo.java, we were expected to write code that handled the ParseException. So, we wrote code that could do that.
Our code throws a ParseException and displays a message that contains the date with an incorrect format and where that error is located. The latter is achieved with the method getErrorOffset().

Your environment

  • version of Flickr4Java = 3.0.8
  • version of JDK = JDK 17

Steps to reproduce

public void setDateTaken(String dateTaken) throws ParseException {
if (dateTaken == null || "".equals(dateTaken)) {
return;
}
try {
DateFormat dateFormat = DATE_FORMATS.get();
Date parsedDate = dateFormat.parse(dateTaken);
if (!dateFormat.format(parsedDate).equals(dateTaken)) {
System.out.println("The date is not valid: " + dateTaken);
} else {
setDateTaken(parsedDate);
}
} catch (ParseException e) {
throw new ParseException("Failed to parse date: " + dateTaken, e.getErrorOffset());
}
}

This code is the one written at the setDateTaken2() method. You can look at the screenshots and compare the output between the previous code and the actual code we are proposing.

Expected behaviour

erro_fechhas
erro_fechhas_resultado_1

Actual behaviour

erro_fechhas_resultado_2

Log

Please copy paste the log here if available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant