You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Tomek <to...@wp.pl> on 2026/06/26 10:59:27 UTC

Bug report: Type mismatch exception in FixedAssetMaintServices.java (assetmaint plugin)

I have found a bug in the assetmaint plugin, specifically in the 
following file:

assetmaint/src/main/java/org/apache/ofbiz/assetmaint/FixedAssetMaintServices.java

Problematic code fragment:

EntityConditionList<EntityExpr> ecl = 
EntityCondition.makeCondition(UtilMisc.toList(
                     EntityCondition.makeCondition("productId", 
EntityOperator.EQUALS, productId),
                     EntityCondition.makeCondition("facilityId", 
EntityOperator.EQUALS, facilityId),
EntityCondition.makeCondition("availableToPromiseTotal", 
EntityOperator.GREATER_THAN, "0")), // Here is the bug
                     EntityOperator.AND);

Proposed fix:

EntityConditionList<EntityExpr> ecl = 
EntityCondition.makeCondition(UtilMisc.toList(
                     EntityCondition.makeCondition("productId", 
EntityOperator.EQUALS, productId),
                     EntityCondition.makeCondition("facilityId", 
EntityOperator.EQUALS, facilityId),
EntityCondition.makeCondition("availableToPromiseTotal", 
EntityOperator.GREATER_THAN, BigDecimal.Zero)),
                     EntityOperator.AND);

Rationale:

The availableToPromiseTotal field represents a numerical value (defined 
as a fixed-point number in the entity model), not a String. Passing the 
string "0" causes a type mismatch exception or a database parsing 
failure at runtime. Replacing it with BigDecimal.ZERO resolves the issue.

Best regards,
Tomek


Re: Bug report: Type mismatch exception in FixedAssetMaintServices.java (assetmaint plugin)

Posted by Arun Patidar <ar...@hotwax.co>.
PR has been merged. Closed ticket now.

Thanks Tomek, Aditi and Nicolas.

On Mon, Jul 6, 2026 at 1:35 PM Nicolas Malin via user <us...@ofbiz.apache.org>
wrote:

> Hello,
>
> I assign it to don't forgot it, I'll try to look on it but I don't know
> when.
>
> If you or someone else want to lead it feel-free :)
>
> Nicolas
>
> Le 04/07/2026 à 08:17, Arun Patidar a écrit :
> > Hi Tomek,
> >
> > I found that you already created a Jira for this:
> > https://issues.apache.org/jira/browse/OFBIZ-13448
> >
> > Also, Aditi suggested the same fixes on the ticket.
> >
> >
> > On Sat, Jul 4, 2026 at 11:42 AM Arun Patidar<ar...@hotwax.co>
> wrote:
> >
> >> Hi Tomek,
> >>
> >> Thank you for reporting this. I can confirm this is indeed a bug.
> >>
> >> The availableToPromiseTotal field is defined as a fixed-point type in
> the
> >> entity model, which translates to a BigDecimal at runtime. Comparing it
> >> against the String "0" can lead to database parsing errors and type
> >> mismatch exceptions.
> >>
> >> Your proposed fix is correct, with a couple of minor adjustments for
> Java
> >> syntax and imports:
> >>
> >> - Use the capitalized constant BigDecimal.ZERO (instead of
> >> BigDecimal.Zero).
> >> - Add the import import java.math.BigDecimal; to the top of
> >> FixedAssetMaintServices.java
> >>
> >> Please create a ticket on Jira and attach the patch with your fix.
> >>
> >> Regards,
> >> Arun Patidar
> >>
> >>
> >>
> >> On Fri, Jun 26, 2026 at 4:29 PM Tomek<to...@wp.pl> wrote:
> >>
> >>> I have found a bug in the assetmaint plugin, specifically in the
> >>> following file:
> >>>
> >>>
> >>>
> assetmaint/src/main/java/org/apache/ofbiz/assetmaint/FixedAssetMaintServices.java
> >>>
> >>> Problematic code fragment:
> >>>
> >>> EntityConditionList<EntityExpr> ecl =
> >>> EntityCondition.makeCondition(UtilMisc.toList(
> >>>                       EntityCondition.makeCondition("productId",
> >>> EntityOperator.EQUALS, productId),
> >>>                       EntityCondition.makeCondition("facilityId",
> >>> EntityOperator.EQUALS, facilityId),
> >>> EntityCondition.makeCondition("availableToPromiseTotal",
> >>> EntityOperator.GREATER_THAN, "0")), // Here is the bug
> >>>                       EntityOperator.AND);
> >>>
> >>> Proposed fix:
> >>>
> >>> EntityConditionList<EntityExpr> ecl =
> >>> EntityCondition.makeCondition(UtilMisc.toList(
> >>>                       EntityCondition.makeCondition("productId",
> >>> EntityOperator.EQUALS, productId),
> >>>                       EntityCondition.makeCondition("facilityId",
> >>> EntityOperator.EQUALS, facilityId),
> >>> EntityCondition.makeCondition("availableToPromiseTotal",
> >>> EntityOperator.GREATER_THAN, BigDecimal.Zero)),
> >>>                       EntityOperator.AND);
> >>>
> >>> Rationale:
> >>>
> >>> The availableToPromiseTotal field represents a numerical value (defined
> >>> as a fixed-point number in the entity model), not a String. Passing the
> >>> string "0" causes a type mismatch exception or a database parsing
> >>> failure at runtime. Replacing it with BigDecimal.ZERO resolves the
> issue.
> >>>
> >>> Best regards,
> >>> Tomek
> >>>
> >>>
>

Re: Bug report: Type mismatch exception in FixedAssetMaintServices.java (assetmaint plugin)

Posted by Nicolas Malin via user <us...@ofbiz.apache.org>.
Hello,

I assign it to don't forgot it, I'll try to look on it but I don't know 
when.

If you or someone else want to lead it feel-free :)

Nicolas

Le 04/07/2026 à 08:17, Arun Patidar a écrit :
> Hi Tomek,
>
> I found that you already created a Jira for this:
> https://issues.apache.org/jira/browse/OFBIZ-13448
>
> Also, Aditi suggested the same fixes on the ticket.
>
>
> On Sat, Jul 4, 2026 at 11:42 AM Arun Patidar<ar...@hotwax.co> wrote:
>
>> Hi Tomek,
>>
>> Thank you for reporting this. I can confirm this is indeed a bug.
>>
>> The availableToPromiseTotal field is defined as a fixed-point type in the
>> entity model, which translates to a BigDecimal at runtime. Comparing it
>> against the String "0" can lead to database parsing errors and type
>> mismatch exceptions.
>>
>> Your proposed fix is correct, with a couple of minor adjustments for Java
>> syntax and imports:
>>
>> - Use the capitalized constant BigDecimal.ZERO (instead of
>> BigDecimal.Zero).
>> - Add the import import java.math.BigDecimal; to the top of
>> FixedAssetMaintServices.java
>>
>> Please create a ticket on Jira and attach the patch with your fix.
>>
>> Regards,
>> Arun Patidar
>>
>>
>>
>> On Fri, Jun 26, 2026 at 4:29 PM Tomek<to...@wp.pl> wrote:
>>
>>> I have found a bug in the assetmaint plugin, specifically in the
>>> following file:
>>>
>>>
>>> assetmaint/src/main/java/org/apache/ofbiz/assetmaint/FixedAssetMaintServices.java
>>>
>>> Problematic code fragment:
>>>
>>> EntityConditionList<EntityExpr> ecl =
>>> EntityCondition.makeCondition(UtilMisc.toList(
>>>                       EntityCondition.makeCondition("productId",
>>> EntityOperator.EQUALS, productId),
>>>                       EntityCondition.makeCondition("facilityId",
>>> EntityOperator.EQUALS, facilityId),
>>> EntityCondition.makeCondition("availableToPromiseTotal",
>>> EntityOperator.GREATER_THAN, "0")), // Here is the bug
>>>                       EntityOperator.AND);
>>>
>>> Proposed fix:
>>>
>>> EntityConditionList<EntityExpr> ecl =
>>> EntityCondition.makeCondition(UtilMisc.toList(
>>>                       EntityCondition.makeCondition("productId",
>>> EntityOperator.EQUALS, productId),
>>>                       EntityCondition.makeCondition("facilityId",
>>> EntityOperator.EQUALS, facilityId),
>>> EntityCondition.makeCondition("availableToPromiseTotal",
>>> EntityOperator.GREATER_THAN, BigDecimal.Zero)),
>>>                       EntityOperator.AND);
>>>
>>> Rationale:
>>>
>>> The availableToPromiseTotal field represents a numerical value (defined
>>> as a fixed-point number in the entity model), not a String. Passing the
>>> string "0" causes a type mismatch exception or a database parsing
>>> failure at runtime. Replacing it with BigDecimal.ZERO resolves the issue.
>>>
>>> Best regards,
>>> Tomek
>>>
>>>

Re: Bug report: Type mismatch exception in FixedAssetMaintServices.java (assetmaint plugin)

Posted by Arun Patidar <ar...@hotwax.co>.
Hi Tomek,

I found that you already created a Jira for this:
https://issues.apache.org/jira/browse/OFBIZ-13448

Also, Aditi suggested the same fixes on the ticket.


On Sat, Jul 4, 2026 at 11:42 AM Arun Patidar <ar...@hotwax.co> wrote:

> Hi Tomek,
>
> Thank you for reporting this. I can confirm this is indeed a bug.
>
> The availableToPromiseTotal field is defined as a fixed-point type in the
> entity model, which translates to a BigDecimal at runtime. Comparing it
> against the String "0" can lead to database parsing errors and type
> mismatch exceptions.
>
> Your proposed fix is correct, with a couple of minor adjustments for Java
> syntax and imports:
>
> - Use the capitalized constant BigDecimal.ZERO (instead of
> BigDecimal.Zero).
> - Add the import import java.math.BigDecimal; to the top of
> FixedAssetMaintServices.java
>
> Please create a ticket on Jira and attach the patch with your fix.
>
> Regards,
> Arun Patidar
>
>
>
> On Fri, Jun 26, 2026 at 4:29 PM Tomek <to...@wp.pl> wrote:
>
>> I have found a bug in the assetmaint plugin, specifically in the
>> following file:
>>
>>
>> assetmaint/src/main/java/org/apache/ofbiz/assetmaint/FixedAssetMaintServices.java
>>
>> Problematic code fragment:
>>
>> EntityConditionList<EntityExpr> ecl =
>> EntityCondition.makeCondition(UtilMisc.toList(
>>                      EntityCondition.makeCondition("productId",
>> EntityOperator.EQUALS, productId),
>>                      EntityCondition.makeCondition("facilityId",
>> EntityOperator.EQUALS, facilityId),
>> EntityCondition.makeCondition("availableToPromiseTotal",
>> EntityOperator.GREATER_THAN, "0")), // Here is the bug
>>                      EntityOperator.AND);
>>
>> Proposed fix:
>>
>> EntityConditionList<EntityExpr> ecl =
>> EntityCondition.makeCondition(UtilMisc.toList(
>>                      EntityCondition.makeCondition("productId",
>> EntityOperator.EQUALS, productId),
>>                      EntityCondition.makeCondition("facilityId",
>> EntityOperator.EQUALS, facilityId),
>> EntityCondition.makeCondition("availableToPromiseTotal",
>> EntityOperator.GREATER_THAN, BigDecimal.Zero)),
>>                      EntityOperator.AND);
>>
>> Rationale:
>>
>> The availableToPromiseTotal field represents a numerical value (defined
>> as a fixed-point number in the entity model), not a String. Passing the
>> string "0" causes a type mismatch exception or a database parsing
>> failure at runtime. Replacing it with BigDecimal.ZERO resolves the issue.
>>
>> Best regards,
>> Tomek
>>
>>

Re: Bug report: Type mismatch exception in FixedAssetMaintServices.java (assetmaint plugin)

Posted by Arun Patidar <ar...@hotwax.co>.
Hi Tomek,

Thank you for reporting this. I can confirm this is indeed a bug.

The availableToPromiseTotal field is defined as a fixed-point type in the
entity model, which translates to a BigDecimal at runtime. Comparing it
against the String "0" can lead to database parsing errors and type
mismatch exceptions.

Your proposed fix is correct, with a couple of minor adjustments for Java
syntax and imports:

- Use the capitalized constant BigDecimal.ZERO (instead of BigDecimal.Zero).
- Add the import import java.math.BigDecimal; to the top of
FixedAssetMaintServices.java

Please create a ticket on Jira and attach the patch with your fix.

Regards,
Arun Patidar



On Fri, Jun 26, 2026 at 4:29 PM Tomek <to...@wp.pl> wrote:

> I have found a bug in the assetmaint plugin, specifically in the
> following file:
>
>
> assetmaint/src/main/java/org/apache/ofbiz/assetmaint/FixedAssetMaintServices.java
>
> Problematic code fragment:
>
> EntityConditionList<EntityExpr> ecl =
> EntityCondition.makeCondition(UtilMisc.toList(
>                      EntityCondition.makeCondition("productId",
> EntityOperator.EQUALS, productId),
>                      EntityCondition.makeCondition("facilityId",
> EntityOperator.EQUALS, facilityId),
> EntityCondition.makeCondition("availableToPromiseTotal",
> EntityOperator.GREATER_THAN, "0")), // Here is the bug
>                      EntityOperator.AND);
>
> Proposed fix:
>
> EntityConditionList<EntityExpr> ecl =
> EntityCondition.makeCondition(UtilMisc.toList(
>                      EntityCondition.makeCondition("productId",
> EntityOperator.EQUALS, productId),
>                      EntityCondition.makeCondition("facilityId",
> EntityOperator.EQUALS, facilityId),
> EntityCondition.makeCondition("availableToPromiseTotal",
> EntityOperator.GREATER_THAN, BigDecimal.Zero)),
>                      EntityOperator.AND);
>
> Rationale:
>
> The availableToPromiseTotal field represents a numerical value (defined
> as a fixed-point number in the entity model), not a String. Passing the
> string "0" causes a type mismatch exception or a database parsing
> failure at runtime. Replacing it with BigDecimal.ZERO resolves the issue.
>
> Best regards,
> Tomek
>
>