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

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "timePeroidsWithBreaksExcluded" (class com.example.slabiak.appointmentscheduler.model.DayPlan) #39

Open
ptilli79 opened this issue Jun 6, 2023 · 10 comments

Comments

@ptilli79
Copy link

ptilli79 commented Jun 6, 2023

Hi, I cloned your AppointmentScheduler Repo, and followed the README for project setup. I am able to run the application, I can create a retail user, but when login in as a retail user and try to setup an appointment, the following error pups up:

On the broser:
Tue Jun 06 18:18:32 EDT 2023
There was an unexpected error (type=Internal Server Error, status=500).
The given string value: {"workingHours":{"start":[6,0],"end":[18,0]},"breaks":[],"timePeroidsWithBreaksExcluded":[{"start":[6,0],"end":[18,0]}]} cannot be transformed to Json object; nested exception is java.lang.IllegalArgumentException: The given string value: {"workingHours":{"start":[6,0],"end":[18,0]},"breaks":[],"timePeroidsWithBreaksExcluded":[{"start":[6,0],"end":[18,0]}]} cannot be transformed to Json object

On the IDE log:
2023-06-06 18:18:32.912 ERROR 31572 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: The given string value: {"workingHours":{"start":[6,0],"end":[18,0]},"breaks":[],"timePeroidsWithBreaksExcluded":[{"start":[6,0],"end":[18,0]}]} cannot be transformed to Json object; nested exception is java.lang.IllegalArgumentException: The given string value: {"workingHours":{"start":[6,0],"end":[18,0]},"breaks":[],"timePeroidsWithBreaksExcluded":[{"start":[6,0],"end":[18,0]}]} cannot be transformed to Json object] with root cause

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "timePeroidsWithBreaksExcluded" (class com.example.slabiak.appointmentscheduler.model.DayPlan), not marked as ignorable (2 known properties: "breaks", "workingHours"])
at [Source: (String)"{"workingHours":{"start":[6,0],"end":[18,0]},"breaks":[],"timePeroidsWithBreaksExcluded":[{"start":[6,0],"end":[18,0]}]}"; line: 1, column: 91] (through reference chain: com.example.slabiak.appointmentscheduler.model.DayPlan["timePeroidsWithBreaksExcluded"])

@peterboivin
Copy link

peterboivin commented Jun 6, 2023 via email

@peterboivin
Copy link

peterboivin commented Jun 6, 2023 via email

@ptilli79
Copy link
Author

ptilli79 commented Jun 6, 2023

Ohh didn't notice that, thanks for bringing that up! So, you would recomend to use your forked branch?

@peterboivin
Copy link

peterboivin commented Jun 6, 2023 via email

@ptilli79
Copy link
Author

ptilli79 commented Jun 6, 2023

I checked your branch, but I still see the spelling incorrectly in some DayPlan (for instance):

public List<TimePeroid> time**Peroids**WithBreaksExcluded() {
    ArrayList<TimePeroid> timePeroidsWithBreaksExcluded = new ArrayList<>();
    time**Peroids**WithBreaksExcluded.add(getWorkingHours());
    List<TimePeroid> breaks = getBreaks();

    if (!breaks.isEmpty()) {
        ArrayList<TimePeroid> toAdd = new ArrayList();
        for (**TimePeroid** break1 : breaks) {
            if (break1.getStart().isBefore(workingHours.getStart())) {
                break1.setStart(workingHours.getStart());
            }
            if (break1.getEnd().isAfter(workingHours.getEnd())) {
                break1.setEnd(workingHours.getEnd());
            }
            for (TimePeroid peroid : time**Peroids**WithBreaksExcluded) {

@peterboivin
Copy link

peterboivin commented Jun 7, 2023 via email

@ptilli79
Copy link
Author

ptilli79 commented Jun 7, 2023

Same error but correctly spelled jajaja.... I am using your "spelling_corrections" branch. Not sure what to do now?

2023-06-06 21:43:47.552 ERROR 33336 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: The given string value: {"workingHours":{"start":[6,0],"end":[18,0]},"breaks":[],"timePeriodsWithBreaksExcluded":[{"start":[6,0],"end":[18,0]}]} cannot be transformed to Json object; nested exception is java.lang.IllegalArgumentException: The given string value: {"workingHours":{"start":[6,0],"end":[18,0]},"breaks":[],"timePeriodsWithBreaksExcluded":[{"start":[6,0],"end":[18,0]}]} cannot be transformed to Json object] with root cause

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "timePeriodsWithBreaksExcluded" (class com.example.slabiak.appointmentscheduler.model.DayPlan), not marked as ignorable (2 known properties: "breaks", "workingHours"])
at [Source: (String)"{"workingHours":{"start":[6,0],"end":[18,0]},"breaks":[],"timePeriodsWithBreaksExcluded":[{"start":[6,0],"end":[18,0]}]}"; line: 1, column: 91] (through reference chain: com.example.slabiak.appointmentscheduler.model.DayPlan["timePeriodsWithBreaksExcluded"])

@peterboivin
Copy link

peterboivin commented Jun 7, 2023 via email

@ptilli79
Copy link
Author

ptilli79 commented Jun 8, 2023

Hi, yes I cleaned up the DB and make sure I was using your "spelling_corrections" branch, but still got stuck with that error. I then tried to modify the "appointmentscheduler.sql" by deleting the "timePeriodsWithBreaksExcluded" attribute, and the app started to work. I am now able to book appointments, create works, providers, customers, etc. But now I am curious about Mail Service. I resgistered myself as a retail customer and configured my email, and was expecting that when booking an appointment a confirmation email should be received, but that is not happening. Any advises on that particular? Thanks!

@slabiak
Copy link
Owner

slabiak commented Aug 10, 2023

@ptilli79 sorry for late reply, do you still need some help with this?

Repository owner deleted a comment from boloboloda Feb 23, 2024
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

3 participants