Ticket #227 (closed defect: wontfix)
ReactorAdapter Check For Reactor Not Correct
| Reported by: | scott.arbeitman | Owned by: | somebody |
|---|---|---|---|
| Priority: | highest | Milestone: | |
| Version: | 2.0.304 | Severity: | major |
| Keywords: | ormdapater, reactor | Cc: |
Description
Trying to do an ExpandPath? of '/reactor' does no work if your CF setup points to a folder external to the web root as a custom tag location. Therefore, Model-Glue never finds the reactor.reactorFactory file.
More sensible would be to add a try catch to the init method: <cffunction name="init" returntype="ModelGlue?.unity.orm.ReactorAdapter?" output="true" access="public">
<cfargument name="framework" type="any" required="true" />
<cfset var tmp = "" />
<cfset var reactorFactoryExists = "" />
<!--- Does a reactor configuration exist? ---> <cftry>
<cfset tmp = arguments.framework.getNativeBean("reactorConfiguration") /> <cfcatch>
<cfset arguments.framework.setUseORMAdapter("false", "No reactorConfiguration bean is present.") />
</cfcatch>
</cftry>
<!--- Does the reactor.reactorFactory exist? ---> <cftry>
<cfset CreateObject?("component","reactor.reactorFactory") />
<cfset reactorFactoryExists = true />
<cfcatch>
<cfset reactorFactoryExists = false />
<cfset arguments.framework.setUseORMAdapter("false", "Could not create reactor.reactorFactory component.") />
</cfcatch>
</cftry>
<!--- If we're ok to load, and we can find reactor, try loading it ---> <cfif isObject(tmp) and reactorFactoryExsits>
<cftry>
<cfset variables._reactor = arguments.framework.getNativeBean("ormService") /> <cfset arguments.framework.setUseORMAdapter(true, "Loaded ReactorAdapter?") /> <cfset arguments.framework.setORMAdapterName("ModelGlue?.unity.orm.ReactorAdapter?") /> <cfcatch type="reactor.config.InvalidPathToConfig?">
<cfset arguments.framework.setUseORMAdapter("false", "No Reactor.xml file found.") />
</cfcatch> <cfcatch>
<cfif cfcatch.detail contains "Invalid Path To Config">
<cfset arguments.framework.setUseORMAdapter("false", "The Reactor.xml file specified in ColdSpring?.xml cannot be found.") />
<cfelse>
<cfrethrow />
</cfif>
</cfcatch>
</cftry>
</cfif>
<cfset variables._ormStatus = arguments.framework.getUseORMAdapter() /> <cfset variables._mdCache = structNew() />
<cfreturn this />
</cffunction>
![(please configure the [header_logo] section in trac.ini)](/ModelGlue.com/trac.cgi/chrome/site/your_project_logo.png)