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

[Incubator-kie-issues#1345] It shouldn't be possible to add\subtract a DateTime with a number #6040

Merged
merged 3 commits into from
Aug 5, 2024

Conversation

bncriju
Copy link
Contributor

@bncriju bncriju commented Aug 1, 2024

Fixes apache/incubator-kie-issues#1345

It was possible to add a number with a Temporal and was returning the result, which was not right. According to DMN specification, addition of Temporal with a number shouldn't be supported. This PR has the changes to bring the behavior supported by DMN spec.

@yesamer yesamer added the DMN label Aug 1, 2024
Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @bncriju well done!!!

@@ -51,6 +51,8 @@ protected void instanceTest(String expression, Object result, FEELEvent.Severity
private static Collection<Object[]> data() {
final Object[][] cases = new Object[][] {
// date/time/duration function invocations
{ "@\"2021-01-01\" + 10", null , FEELEvent.Severity.ERROR},
{ "@\"2021-01-01T10:10:10\" + 10", null , FEELEvent.Severity.ERROR},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bncriju Can you please add here those additional test cases:

  • number + Date
  • number + DateTime
  • number - Date
  • number - DateTime
  • Date - number
  • DateTime - number

They should all return null with an error.

Just for the sake of completeness :)
Thank you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bncriju Don't forget this please :)

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sry @bncriju - I missed one detail

@gitgabrio gitgabrio merged commit 5456bc3 into apache:main Aug 5, 2024
10 checks passed
rgdoliveira pushed a commit to rgdoliveira/drools that referenced this pull request Aug 6, 2024
…a DateTime with a number (apache#6040)

* Removed the addition of temporal with number and added test cases

* removed unused import

* replaced null object with list of null
@bncriju bncriju deleted the kie-issues#1345 branch September 3, 2024 13:48
rodrigonull pushed a commit to rodrigonull/incubator-kie-drools that referenced this pull request Oct 7, 2024
…a DateTime with a number (apache#6040)

* Removed the addition of temporal with number and added test cases

* removed unused import

* replaced null object with list of null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It shouldn't be possible to add\subtract a DateTime with a number
3 participants