Skip to content

Fixed: Type mismatch when filtering InventoryItem by availableToPromiseTotal in FixedAssetMaintServices (OFBIZ-13448)#309

Open
toaditi wants to merge 1 commit into
apache:trunkfrom
toaditi:ofbiz-13448-atp-bigdecimal
Open

Fixed: Type mismatch when filtering InventoryItem by availableToPromiseTotal in FixedAssetMaintServices (OFBIZ-13448)#309
toaditi wants to merge 1 commit into
apache:trunkfrom
toaditi:ofbiz-13448-atp-bigdecimal

Conversation

@toaditi

@toaditi toaditi commented Jun 30, 2026

Copy link
Copy Markdown

Jira: https://issues.apache.org/jira/browse/OFBIZ-13448

Problem

In FixedAssetMaintServices.issueInventory, the InventoryItem lookup builds a condition comparing availableToPromiseTotal against the String literal "0":

EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.GREATER_THAN, "0")

InventoryItem.availableToPromiseTotal is a fixed-point field (java.math.BigDecimal, NUMERIC(18,6)). When the query executes, SqlJdbcUtil binds the value by casting it to java.math.BigDecimal, so passing a String throws a ClassCastException (String cannot be cast to BigDecimal). The equivalent EECA (product/entitydef/eecas.xml) avoids this by declaring type="BigDecimal" on the value; the Java path had no such coercion.

Fix

Use BigDecimal.ZERO instead of the string "0", and add the java.math.BigDecimal import.

Verification

  • ./gradlew compileJava → BUILD SUCCESSFUL.

This is the same fix proposed on the Jira issue, corrected: the issue text used BigDecimal.Zero (does not compile) and omitted the required import.

…seTotal in FixedAssetMaintServices (OFBIZ-13448)

The condition compared the availableToPromiseTotal field against the String
literal "0". InventoryItem.availableToPromiseTotal is a fixed-point (BigDecimal)
field, so binding a String value throws a ClassCastException when the query is
executed (SqlJdbcUtil casts the value to java.math.BigDecimal). Use
BigDecimal.ZERO instead.
@sonarqubecloud

Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

1 participant