tags:

views:

813

answers:

3

I am a graduate student and new to ColdFusion.

I started working on this already developed project by someone couple of years ago, and the client wants some changes to be done. So I went ahead and did some small modifications to the appearance of the form (insertdata.cfm), like adding some more options to a drop down menu, changing the label names and so on.

I am very sure this changes would not have affected the application in any way. And the place where the message says the error is - I didn't even touch that part. Now after 4 days I start getting this weird error saying

Error Occurred While Processing Request
The system has attempted to use an undefined value, which usually 
indicates a programming error, either in your code or some system code.

Null Pointers are another name for undefined values.

And this happens randomly, not every time I access the website or different webpages. Here are the errors:

1st error:

The error occurred in /export/web/virtual/web3_unt_edu/cps/webaccess/sites/Amarillo/index.cfm: line 8
5 :   SELECT UserName,Password FROM user_data WHERE UserName=
6 :   <cfqueryparam value="#FORM.UserName#" maxlength="8">
7 :     AND Password=
8 :   <cfqueryparam value="#FORM.Password#" maxlength="8">
9 :   </cfquery>
10 :   <cfif MM_rsUser.RecordCount NEQ 0>

I also tried adding cfsqltype="cf_sql_clob" in cfqueryparam on my friends advice, but it doesn't work out.

2nd error:

The error occurred in /export/web/virtual/web3_unt_edu/cps/webaccess/sites/Amarillo/InsertData.cfm: line 13

11 :   <cflocation url="#MM_failureURL#" addtoken="no">
12 : </cfif>
13 : <cfquery name="rsDay" datasource="cps">
14 : SELECT days FROM days 
15 : </cfquery>

3rd error

The error occurred in /export/web/virtual/web3_unt_edu/cps/webaccess/sites/Amarillo/InsertData.cfm: line 27

25 : ORDER BY ethnicity ASC
26 : </cfquery>
27 : <cfquery name="rsHospitals" datasource="cps_amarillo">
28 : SELECT *
29 : FROM hospitals

Can anyone help me with this? I have to get the modifications done in 2 weeks.

Thank you Craj

A: 

In general, if you find that things are not consistently going wrong, look for data being stored in the session or being re-defined on every page. Then find the non-standard branches, either in your user's page clicks or the CF code, that might be missing / resetting these.

For the first issue, as Al points out, these values should be coming through for text fields. But look at the CFPARAM tag to defend against them not being there anyway. You can set a nonsense "default" value, and when you have it, log the prior page and any other information that might be useful to help you find how users are getting to that page without going to the form before it.

The second issue is probably because MM_failureURL is not defined or the definition is getting lost. It's ugly, but you can use CFDUMP to find out if it is in another namespace sometimes, or where it is getting dropped.

For the third issue, have you checked that cps_amarillo and rsHospitals are defined in the current namespace?

Another suggestion: Some of these issues might be from users bookmarking pages "in the middle" of your application, which would allow them to jump in without going through whatever setup (such as your login form) would establish your variables, query names, etc. If you are sure that users can't jump in without your initialization code, then you are off on the Edge Case Hunt.

CW
CF will pass blank text fields and text areas. It won't pass unchecked checkboxes and radio buttons, or unpressed buttons.
Al Everett
A: 

In my experience this type of error happens when you (often by way of an extension/library/component) try to dereference a null pointer, which was much more commonplace back in the C++/COM+ CFX days than it is now. The fact that it is happening in with basic CFQUERY code is a bit alarming. What database type are you using? I'm wondering if it is a driver and/or datasource issue.

Dane
+1  A: 

This also happens when you try to use a returned value from a function, but the function doesn't return a value -- this has troubled me in the past, but when I get this error now, it's the first thing I look for...