Ticket #261 (closed defect: fixed)

Opened 19 years ago

Last modified 19 years ago

Error in Reactor Widget Sample Code

Reported by: jruiseco Owned by: somebody
Priority: normal Milestone: 2.0 Beta 2
Version: 2.0.304 Severity: minor
Keywords: reactor getname Cc:

Description

Model-Glue Beta 2 Code Freeze (2.0.284), Latest Coldspring from CVS, Latest Reactor from SVN

I'm a complete newbie to OO and MG, but this looks like a bug in the code and not a configuration issue.

I got the error when selecting a link in the Reactor widget example.

From this page:

/index.cfm?event=widget.list

Clicked on this link:

/index.cfm?event=Widget.view&widgetId=1

Got Error Below...

***************************************************************

Message: The selected method getname was not found.

Detail: Either there are no methods with the specified method name and argument types, or the method getname is overloaded with arguments types that ColdFusion? can't decipher reliably. If this is a Java object and you verified that the method exists, you may need to use the javacast function to reduce ambiguity.

Extended Info

Tag Context C:\Inetpub\wwwroot\ReactorSample?\views\generated\dspWidget.cfm (61) C:\Inetpub\wwwroot\ModelGlue?\unity\view\ViewRenderer?.cfm (29) C:\Inetpub\wwwroot\ModelGlue?\unity\view\ViewRenderer?.cfc (50) C:\Inetpub\wwwroot\ModelGlue?\unity\framework\ModelGlue?.cfc (447) C:\Inetpub\wwwroot\ModelGlue?\unity\framework\ModelGlue?.cfc (340) C:\Inetpub\wwwroot\ModelGlue?\unity\framework\ModelGlue?.cfc (289) C:\Inetpub\wwwroot\ModelGlue?\unity\ModelGlue?.cfm (126) C:\Inetpub\wwwroot\ReactorSample?\index.cfm (72)

Attachments

ModelGlue.unity.xsl.view.xsl.diff (1.4 kB) - added by logantracyo 19 years ago.
Patch for View.xsl -- changes references to 'xsl:value-of select="name"' to 'xsl:value-of select="alias"' within the TargetObject? assignment block. This changes the generated view to obtain the related *object*, rather than the related ID.

Change History

follow-up: ↓ 2   Changed 19 years ago by dlclark1

It appears to be a bug in the view generation. The Widget view that contains the bug is trying to reference its Widget Type property (an object with a one-to-many relationship with Widget) as "WidgetTypeId?" instead of "WidgetType?". Here is the buggy code:

  <cfif structKeyExists(WidgetRecord, "getwidgetTypeId")>
    <cfset targetObject = WidgetRecord.getwidgetTypeId() />
  <cfelseif structKeyExists(WidgetRecord, "getParentwidgetTypeId")>
   <cfset targetObject = WidgetRecord.getParentwidgetTypeId() />
 </cfif>

Changing it to the following fixes the bug in the view:

  <cfif structKeyExists(WidgetRecord, "getwidgetType")>
    <cfset targetObject = WidgetRecord.getwidgetType() />
  <cfelseif structKeyExists(WidgetRecord, "getParentwidgetType")>
    <cfset targetObject = WidgetRecord.getParentwidgetType() />
  </cfif>

If you delete the old view and rescaffold, the buggy code comes back, so it's not a problem of an obsolete view in the distribution.

in reply to: ↑ 1   Changed 19 years ago by Fed

The targetObject variable is only set to empty string in ReactorAdapter? and not set to anything else, from what I can see.

in reply to: ↑ description   Changed 19 years ago by Fed

Never mind my first reply

In view.xsl file I changed following code <xsl:value-of select="name"/> to <xsl:value-of select="alias"/>

and it seems to work now. I haven't traced where these values are coming from , but I hope it helps you guys to fix this.

Changed 19 years ago by logantracyo

Patch for View.xsl -- changes references to 'xsl:value-of select="name"' to 'xsl:value-of select="alias"' within the TargetObject? assignment block. This changes the generated view to obtain the related *object*, rather than the related ID.

  Changed 19 years ago by joe.rinehart

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

(In [296]) Fixes #261

Note: See TracTickets for help on using tickets.