Bug 724350 (BRMS-296) - Packge build fails if Fact Model contains Fields with capitol letters
Summary: Packge build fails if Fact Model contains Fields with capitol letters
Keywords:
Status: CLOSED UPSTREAM
Alias: BRMS-296
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion)
Version: 5.0.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ER1
: BRMS 5.3.0.GA
Assignee: Nobody
QA Contact:
URL: http://jira.jboss.org/jira/browse/BRM...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-06 07:47 UTC by Eric D. Schabell
Modified: 2025-02-10 03:13 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Linux (Fedora 12), x86, EAP-4.3, java5, BRMS 5.0.1
Last Closed: 2025-02-10 03:13:46 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker BRMS-296 0 Minor Closed Packge build fails if Fact Model contains Fields with capitol letters 2019-06-24 16:21:03 UTC

Description Eric D. Schabell 2010-04-06 07:47:53 UTC
Workaround: Workaround Exists
Workaround Description: All Fields must be named starting with small letters (non-capitols/lower-cased).
securitylevel_name: Public

I just spent three weeks teaching masters students a lab with BRMS.
They used 5.0.1 and only the Guided Rule Editor interface (they are
students attempting to become analysts) and it was amazing to watch
what worked and did not with regards to non-Java people trying to
create rules/dsl's/packages/tests/model's.

One thing encountered was what I would consider a bug for analysts:

Create a Model from the Guided Rule Editor GUI and you can create
Objects (Facts) with attributes (Fields). It turns out that the
packages will not build if the field names start with capital letters.
This seems strange and very Java conventional, something I would not
expect an analyst to adhere to.

Comment 1 Anne-Louise Tangring 2011-09-13 18:02:23 UTC
Making On-QA to retest to see if underlying components have changed. If not, we may want to release note it and may want to set for next release?

Comment 2 Jiri Locker 2011-09-15 14:41:30 UTC
Reproduced with 5.2.0 ER3. However, I can build a package if there is a field that is completely upper-case (like FIELD1).

After some experimenting with declarative model editor, I have found:

- fields that are OK: myFieldXYZ, FIELD123

- fields that break the package build: Field, aField

Comment 3 Tihomir Surdilovic 2011-09-20 17:21:06 UTC
Fix committed by Mario Fusco.

Comment 4 lcarlon 2011-09-23 02:24:36 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When rules were constructed with the Guided Editor inconsistent case conventions were being enforced to field names, as a result packages that contained fields that started with capital letters would not build.

Comment 5 lcarlon 2011-09-23 02:25:23 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-When rules were constructed with the Guided Editor inconsistent case conventions were being enforced to field names, as a result packages that contained fields that started with capital letters would not build.+When rules were constructed with the Guided Editor inconsistent case conventions were enforced on field names, as a result packages that contained fields that started with capital letters would not build.

Comment 6 Zuzana Krejčová 2011-09-30 12:17:21 UTC
Tested with field names provided by Jiri Locker - build fails with "Field" and "aField", package builds ok with "myFieldXYZ", "FIELD123".

Comment 7 Lukáš Petrovický 2011-09-30 13:16:21 UTC
Re-requesting this for 5.3

Comment 8 manstis 2011-09-30 13:29:28 UTC
Edson, Mario, FYI, these are the RegEx used by Guvnors UI: 

Field Name = "^[a-zA-Z][a-zA-Z\\d_$]*$"

Data Type = "^([a-zA-Z][a-zA-Z\\d_$]*\\.)*[a-zA-Z][a-zA-Z\\d_$]*$" (A qualified
Java type). 

If PackageBuilder (or where-ever) expects something different let me know - at
least we should be consistent!

Comment 9 Edson Tirelli 2011-09-30 15:39:47 UTC
Hi All,

I was investigating the root cause of this and it turns out there are some weird rules for capitalization in JavaBeans. From the Java API documentation:

"
Utility method to take a string and convert it to normal Java variable name capitalization. This normally means converting the first character from upper case to lower case, but in the (unusual) special case when there is more than one character and both the first and second characters are upper case, we leave it alone.
Thus "FooBah" becomes "fooBah" and "X" becomes "x", but "URL" stays as "URL".
"

http://download.oracle.com/javase/6/docs/api/java/beans/Introspector.html#decapitalize(java.lang.String)

This basically makes it impossible to have a "property name" with first letter in lower case and second letter in uppercase, as:

aField 

Will be inferred as:

AField 

Due to the naming rules above.

I will try to find if we can have some kind of fallback algorithm in Drools in a way that if the above defined rule fails to find a valid field/method name, we fallback to other naming conventions.

I will keep you posted.

Comment 10 Edson Tirelli 2011-09-30 20:28:09 UTC
I implemented the fallback algorithm.

https://github.com/droolsjbpm/drools/compare/5bea637...10f4a0e

It should work now.

Comment 11 Lukáš Petrovický 2011-10-04 13:58:11 UTC
(In reply to comment #10)
> I implemented the fallback algorithm.
> 
> https://github.com/droolsjbpm/drools/compare/5bea637...10f4a0e
> 
> It should work now.

Edson, would you please back out these changes on the 5.2.x branch? The bug didn't receive the 5.2.0 ack and we can't possibly risk a regression this late in the cycle.

Thanks for fixing this, we will pick it up in 5.3.

Comment 12 Lukáš Petrovický 2011-10-04 14:20:28 UTC
Edson did revert the changes. -> MODIFIED

Comment 13 Jiri Locker 2011-11-18 23:32:30 UTC
Fix verified in BRMS 5.3.0.DEV5.

Comment 16 lcarlon 2012-04-02 01:24:38 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-When rules were constructed with the Guided Editor inconsistent case conventions were enforced on field names, as a result packages that contained fields that started with capital letters would not build.+When rules were constructed with the Guided Editor inconsistent case conventions were enforced on field names, as a result packages that contained fields that started with capital letters would not build. This has been resolved by including a fallback algorithm that checks names and converts them to adhere with the case conventions if necessary.

Comment 26 Red Hat Bugzilla 2025-02-10 03:13:46 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.


Note You need to log in before you can comment on or make changes to this bug.