Solved

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

Posted on 2009-05-13
2
964 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

756 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