Element 1 is undefined in a Java object of type class coldfusion.runtime

Hello All,

let me introduce my self:
I am a .net developer and I’m zero in ColdFusion. working in he company that has a website in coldFusion.
They ask me to change the hosting.

The most difficault part of that is the new hosting is in NetWork Solution and it is cold Fuson 7.
But the current hosing is running under 8.

So
I encountered lots of errors regarding the version. I’ve done most of them but there is one that I don’t have any clue.
Here it is:
Element 1 is undefined in a Java object of type class coldfusion.runtime.Array referenced

It happens in most of the program when user click on Add button. for example here in CFLOOP :
<code>
<cftry>
<cfparam name=“url.startrow” default=“1”/>
<cfparam name=“url.maxrows” default=“10”/>

<cfset startRowParamUrl = ‘’>
<cfif StructKeyExists(url, “q”)>
<cfset startRowParamUrl =startRowParamUrl & ‘&q=#url.q#’>
</cfif>
<cfif StructKeyExists(url, “startrow”)>
<cfset startRowParamUrl =startRowParamUrl & ‘&startrow=#url.startrow#’>
</cfif>

<cfif StructKeyExists(url, “todeleteapproval”)>
<cfquery datasource=“ds”>
DELETE FROM CouponTempTbl Where Id in (url.todeleteapproval#)
</cfquery>
<cflocation url=“index.cfm?event=sitemanager&tabmenu=coupons” addtoken=“false”>
</cfif>

<cfif StructKeyExists(url, “todelete”)>
<cfquery datasource=“ds”>
UPDATE Coupon SET Deleted=1, BusinessId=0, CategoryId=0 Where Id in (url.todelete#)
</cfquery>
<cflocation url=“index.cfm?event=sitemanager&tabmenu=coupons” addtoken=“false”>
</cfif>

<cfif StructKeyExists(form, “SubmitUpdateCouponInfo”)>
<cfset tag_array = #SplitStr(form.BusinessByCategory,“_”)#>
<cfparam name=“businessId” default=“0”>
<cfparam name=“categoryId” default=“0”>

<cfloop from=“1” to=“#arrayLen(tagArray)#” index=“i”>
<cfif i EQ 1>
<cfset businessId= #tagArray[i]# />
<cfelseif i EQ 2>
<cfset categoryId= #tagArray[i]# />
</cfif>
</cfloop>

<cfquery datasource=“ds”>
UPDATE Coupon SET
CouponCode=‘#sqlSafe(form.CouponCode)#’
,Headline=‘#sqlSafe(form.Headline)#’
,Description=‘#sqlSafe(form.Description)#’
,CategoryId=#categoryId#
,BusinessId=#businessId#
,OwnerId=#form.OwnerId#
,Approved=#form.Approved#
,StartDate=‘#form.StartDate#’
,EndDate=‘#form.EndDate#’
Where Id=#form.CouponId#
</cfquery>

</code>
this code is countinued…
I don’t know how to get ride of it.
I think that it happens only in version 7.

if you need the whole code please let me know
if some one can help me I appreciate.
Thanks
bahar

<cfset tag_array = #SplitStr(form.BusinessByCategory,“_”)#>
<cfparam name=“businessId” default=“0”>
<cfparam name=“categoryId” default=“0”>

<cfloop from=“1” to=“#arrayLen(tagArray)#” index=“i”>

The areas I BOLDED should use the same variable name, I would assume. But one says tag_array and the other says tagArray.

Thanks arron,

I changed them but it creates another error:
The element at position 0 of array variable “TAGARRAY” cannot be found.

I think that it shouldn’t be a problem because It’s working fine in the current server.

I think some thing happen wrong on this function:

<cffunction name=“SplitStr” access=“public” output=“false”>
<cfargument name=“sText” required=“true”>
<cfargument name=“sDelimiter” required=“true”>

&lt;cfset tag_source =  #sText#&gt;
&lt;cfset comma_pos = -1&gt;
&lt;cfset index = 1&gt;
&lt;cfset tag_array = ArrayNew(1)&gt;
&lt;cfloop condition= "comma_pos NEQ 0 AND len(tag_source) GT 0"&gt;
    &lt;cfset comma_pos = #find("#sDelimiter#", tag_source)#&gt;
    &lt;cfif comma_pos NEQ 0&gt;
        &lt;cfif comma_pos EQ 1&gt;
            &lt;cfset tag_source_n = #left(tag_source, comma_pos)#&gt;
        &lt;cfelse&gt;
            &lt;cfset tag_source_n = #left(tag_source, comma_pos-1)#&gt;
        &lt;/cfif&gt;
        &lt;cfset tag_source = #removechars(tag_source, 1, comma_pos)#&gt; 
        &lt;cfset tagArray[index] = trim(tag_source_n)&gt;
    &lt;cfelseif comma_pos EQ 0 AND len(tag_source) GT 0&gt;
        &lt;cfset tagArray[index] = trim(tag_source)&gt;
    &lt;/cfif&gt;
    &lt;cfset index = index+1&gt;
&lt;/cfloop&gt;

<cfreturn tag_array>
</cffunction>

Thanks u so much