yesamer commented on code in PR #6299:
URL:
https://github.com/apache/incubator-kie-drools/pull/6299#discussion_r2055822233
##########
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/DateAndTimeFunction.java:
##########
@@ -119,71 +124,57 @@ public FEELFnResult<TemporalAccessor>
invoke(@ParameterName( "year" ) Number yea
return invoke( year, month, day, hour, minute, second, (Number) null );
}
- public FEELFnResult<TemporalAccessor> invoke(@ParameterName( "year" )
Number year, @ParameterName( "month" ) Number month, @ParameterName( "day" )
Number day,
- @ParameterName( "hour" )
Number hour, @ParameterName( "minute" ) Number minute, @ParameterName( "second"
) Number second,
- @ParameterName( "hour offset"
) Number hourOffset ) {
- if ( year == null ) {
- return FEELFnResult.ofError(new
InvalidParametersEvent(Severity.ERROR, "year", "cannot be null"));
- }
- if ( month == null ) {
- return FEELFnResult.ofError(new
InvalidParametersEvent(Severity.ERROR, "month", "cannot be null"));
- }
- if ( day == null ) {
- return FEELFnResult.ofError(new
InvalidParametersEvent(Severity.ERROR, "day", "cannot be null"));
- }
- if ( hour == null ) {
- return FEELFnResult.ofError(new
InvalidParametersEvent(Severity.ERROR, "hour", "cannot be null"));
- }
- if ( minute == null ) {
- return FEELFnResult.ofError(new
InvalidParametersEvent(Severity.ERROR, "minute", "cannot be null"));
- }
- if ( second == null ) {
- return FEELFnResult.ofError(new
InvalidParametersEvent(Severity.ERROR, "second", "cannot be null"));
- }
-
+ public FEELFnResult<TemporalAccessor> invoke(@ParameterName("year") Number
year, @ParameterName("month") Number month, @ParameterName("day") Number day,
+ @ParameterName("hour") Number
hour, @ParameterName("minute") Number minute, @ParameterName("second") Number
second,
+ @ParameterName("hour offset")
Number hourOffset) {
try {
- if( hourOffset != null ) {
- return FEELFnResult.ofResult( OffsetDateTime.of(
year.intValue(), month.intValue(), day.intValue(),
-
hour.intValue(), minute.intValue(), second.intValue(),
- 0, ZoneOffset.ofHours(
hourOffset.intValue() ) ) );
+ int coercedYear = coerceIntegerNumber(year).orElseThrow();
+ int coercedMonth = coerceIntegerNumber(month).orElseThrow();
+ int coercedDay = coerceIntegerNumber(day).orElseThrow();
+ int coercedHour = coerceIntegerNumber(hour).orElseThrow();
+ int coercedMinute = coerceIntegerNumber(minute).orElseThrow();
+ int coercedSecond = coerceIntegerNumber(second).orElseThrow();
Review Comment:
@ChinchuAjith Apologies, my bad. Please ignore my previous comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]