Last updated:

Get Your Site Submitted for Free in the World's Largest B2B Directory!

Email Address:
* URL:
*
*Indicates Mandatory Field

Terms & Conditions

Submit Your Site To ItalianWebSearch

DevWebProIT
FlashNewz
DevWebPro





NPEs, OnRequest, And Other Mysteries

By Raymond Camden
Expert Author
Article Date: 2007-09-12

A friend wrote to me this morning with an interesting problem.

He recently moved his site (hosted at CrystalTech) from ColdFusion 7 to ColdFusion 8.

Then he began to get NPEs (Null Pointer Exceptions) in regards to cfquery tags. He would get these about once per 1-2k hits.

But get this - CystalTech recommended adding a blank onRequest:

<cffunction
name = "onRequest"
access = "public"
returnType = "boolean"
output="true">

<cfargument
name = "thePage"
type = "string"
required = "true">

<cfinclude
template="#arguments.thePage#">

<cfreturn true />

</cffunction>

And it worked! He no longer got the NPE error. Now I don't know about you - but I can't imagine any reason why this change would make his error go away.

Can anyone else think of a reason why it would help?

As for the NPE in general - one thing I've asked him if is the cfquery was in a CFC and he possibly forgot to var scope.

Not that I think it would make a NPE, but the lack of var scoping is something that could lead to random errors like he observed.

Comments

About the Author:
Raymond Camden, ray@camdenfamily.com
http://ray.camdenfamily.com

Raymond Camden is Vice President of Technology for roundpeg, Inc. A long time ColdFusion user, Raymond has worked on numerous ColdFusion books and is the creator of many of the most popular ColdFusion community web sites. He is an Adobe Community Expert, user group manager, and the proud father of three little bundles of joy.


Newsletter Archive | Article Archive | Submit Article | Advertising Information | About Us | Contact

DevWebProItaly is an iEntry.com publication
© $line) { echo $line ; } ?> iEntry Inc. All Rights Reserved Privacy Policy Legal

Click Here to Return to the Home Page