Ticket #34 (reopened defect)

Opened 3 years ago

Last modified 3 months ago

Partial case-sensitivity to alias names on reactorFactory.createRecord()

Reported by: jfirsenbaum@… Owned by: dhughes
Type: defect Priority: normal
Milestone: 1.0 Release Component: Reactor - Reactor Factory
Version: 1.0 Severity: normal
Keywords: alias case-sensitive spam Cc:

Description

Reactor is partially case-sensitive to the alias used to create a new record. It should either be stricty case-sensitive or strictly not - I'd vote for not.

The problem occurs in validation while parsing the dictionary xml in the following scenario:
<object name="CreditCard">
<hasOne name="Address">
...

Calling the child address with the wrong case:
<cfset address = getReactor().createRecord('address')>
<cfset card.setAddress(address)>

Here's where the error is thrown:
<cfset card.validate()>


Here's a stack trace:

Message An error occured while Transforming an XML document.
Detail Empty expression!
Extended Info
Tag Context /usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/core/objectTranslator.cfc (144)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/core/objectTranslator.cfc (151)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/core/objectTranslator.cfc (151)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/core/objectTranslator.cfc (100)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/core/objectFactory.cfc (201)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/reactorFactory.cfc (80)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/base/abstractRecord.cfc (332)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/project/club/Validator/AddressValidator.cfc (10)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/base/abstractRecord.cfc (83)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/base/abstractRecord.cfc (145)
/usr/local/apache-tomcat-5.5.16/webapps/cfusion/reactor/base/abstractRecord.cfc (85)

The problem occurs because the alias passed into reactorFactory.createRecord('alias') is used by the objectFactory to configure the record:

line 145: <cfset GeneratedObject = GeneratedObject.configure(getConfig(), arguments.alias, getReactorFactory(), getConvention(), metadata) />

The objectTranslator chokes on line 144 because it does a XMLSearch() on "address", not "Address"

Here's a possible fix:
at the top of objectFactory.create()
<cfset arguments.alias = getconfig().getobjectconfig(arguments.alias).object.xmlAttributes.alias>

Change History

  Changed 3 years ago by jfirsenbaum@…

Well, it turns out that the above error was not due to case sensitivity.

It has something to do with the dictionary xml files, but I'm not sure what. I'm going back and forth between development and production modes (dev is just too slow with many objects) on OS X with Tomcat/Mysql.
One file was locked and after deleting it the error went away. It happened again with another set of objects and I simply touched the dictionary file and the error went away.

Not sure what's going on here, but if anyone else sees the objectTranslator error please document it.

  Changed 3 years ago by dhughes

  • milestone set to Beta

What DBMS are you using? Oracle? PostgreSQL? Those two DBMS are case sensitive and will probably remain that way.

On the other hand, the dictionary objects rely on CF's XML functions which (at least XmlSearch) are case sensitive. I've been considering removing all usages of Xml functions but I probably won't do that for 1.0.

Please let me know if you have any more information.

  Changed 2 years ago by bbowden

  • status changed from new to closed
  • resolution set to worksforme

Closing because we can't reproduce the problem with the info provided. Please reopen if additional information (database being used, a create table script, ... etc) can be provided.

follow-up: ↓ 5   Changed 2 years ago by djokeefe

  • status changed from closed to reopened
  • resolution deleted

I am able to reproduce this and it is driving me up the wall. I am using MG and I have objects defined in reactor.xml and scaffolding in model glue. I am adding to both docs one object and scaffold at a time, and when I get to a table called "text", I get the "Empty Expression" error. I did find that my case sensitivity was incorrect in the DB. Made the changes in the DB, deleted all files from dictionary and metadata, and still get the error. Below is the create table script for the table in MSSQL 2005 as well as the corresponding dictionary file. Let me know if you need anything else.

Over the last couple of days, I have had issues where I test in between each object addition, and when one breaks it, I take it back out and rerun the app and it is still broke. Really hard to put a finger on this one, does not make sense.

in reply to: ↑ 4   Changed 2 years ago by djokeefe

Replying to djokeefe:

To give a little more information on this issue, here is what I found the issue to be with the following code, and that is I named the object the same name as the alias for the text object.

<object name="contentPackage" alias = "ContentPackages">

<hasOne name="text">

<relate from="text_UID" to="text_UID" />

</hasOne>

</object>

<object name="text" alias = "Text">

<hasOne name="contentPackage">

<relate from="text_UID" to="text_UID" />

</hasOne>

</object>

Once I changed the alias to TextBody, the scaffolding completed successfully.

However - Why does the following code not work:

<object name="content" alias = "Content">

<hasOne name="stateExcl">

<relate from="stateExcl_UID" to="stateExcl_UID" />

</hasOne>

</object>

<object name="stateExcl" alias = "StateExclusionList">

<hasOne name="content">

<relate from="stateExcl_UID" to="stateExcl_UID" />

</hasOne>

</object>

I have ensured that my case is correct in the code to match. I also tried switching the hasMany to the alias which is "StateExclusionList". I am at a loss on this one.

Dan

  Changed 3 months ago by anonymous

  • milestone deleted

Milestone Beta deleted

  Changed 3 months ago by mark.drew@…

  • milestone set to 1.0 Release

  Changed 3 months ago by TomChiverton

  • keywords spam added
Note: See TracTickets for help on using tickets.