Solved

Element is undefined in a Java object of type class coldfusion.filter.UrlScope.

Posted on 2009-05-13
2
951 Views
Last Modified: 2012-05-06
The body of code below thows the following error:

Element 10 is undefined in a Java object of type class coldfusion.filter.UrlScope.  
 
 
The error occurred in C:\nwmdev\apache\Apache2\htdocs\workspace\pdm\fusebox\login.cfm: line 51
 
49 : <cfloop collection="#url#" item="i">
50 :             <cfif NOT ListFindNoCase(ListIgnore, i, ",") and isAlphaNumeric(i)>
51 :                   <cfset uRow = listAppend(uRow,"#LCase(i)#/#LCase(URL[i])#","/")>
52 :             </cfif>
53 : </cfloop>
 
Note that the URL struct when dumped looks something like this::

struct
/WWW.SAFWE.COM WIDTH=900 HEIGHT=1100>:: [empty string]  
ERROR:: [empty string]  
FUSE:: login  
REDIRECT:: [empty string]  
REINIT:: false  
SUBMITTED:: &amp;gt;&amp;#x22;&amp;gt;&amp;lt;/title&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/form&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;br&amp;gt;&amp;lt;iFraMe src=http:/  

Can anyone help me find the reason for this error.

// Returns true if the string only contains alpha numeric characters (empty string = true)

function isAlphaNumeric(txt) {

	return ValidString(txt,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');

}
 

// Returns true if the CheckString only contains characters passed in ValidString (empty string = true)

function ValidString(ChkString,ValidString) {

	for (i=1; i LTE Len(ChkString); i=i+1) {

		if (FindNoCase(Mid(ChkString,i,1), ValidString) eq 0) return false;

	}

	return true;

}

</cfscript>
 
 

<cfloop collection="#url#" item="i">

		<cfif NOT ListFindNoCase(ListIgnore, i, ",") and isAlphaNumeric(i)>

			<cfset uRow = listAppend(uRow,"#LCase(i)#/#LCase(URL[i])#","/")>

		</cfif>

</cfloop>

Open in new window

0
Comment
Question by:onaled777
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 24378816
It is probably a scoping clash.  In your function you are using a variable named "i" and also using that same variable name as your <cfloop> index. Since your function variables are not properly scoped, ValidString ends up overwriting or clashing with your cfloop index.

_Always_ var scope _all_ function local variables.  In other words, if a variable is only used in the function, place it in the VAR scope.  Also, you might consider using the newer cffunction syntax instead. It has some benefits over the old udf syntax.

// Returns true if the CheckString only contains characters passed in ValidString (empty string = true)

function ValidString(ChkString,ValidString) {

      var i = 0;

        for (i=1; i LTE Len(ChkString); i=i+1) {

                if (FindNoCase(Mid(ChkString,i,1), ValidString) eq 0) return false;

        }

        return true;

}

</cfscript>

Open in new window

0
 

Author Comment

by:onaled777
ID: 24379140
THANK YOU SO MUCH!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now