On Feb 7, 7:38 pm, Mark Mandel <mark.man...@gmail.com> wrote:
> What do you actually get on screen?

It's caught by my CFERROR tag, so I get a nice error message but the
stack trace contains exactly "java.lang.NullPointerException".

> If you run cf via the console, do you see anything in there?

Nothing in the console.

> if you put a cftry/cfcatch around it, and dump out the cfcatch, does it show
> you anything?

There is a try/catch around it currently and the catch writes out the
cfcatch.message/detail to the application.log, but it never runs.  The
NPE is fatal and final.

> What the DB and CF server type?

CF developer multiserver using Postgres 8.3 on Windows (local
development) and CF enterprise multiserver using Postgres 8.3 on Linux
(production).

Now, for fun, I removed the try/catch so I could get at the error
message directly.  This is what I got:

ERROR: update or delete on table "tbllookupevent" violates foreign key
constraint "$2" on table "tbllookupattendee" Detail: Key (uidevent)=
(52BBBB2C-1D72-822B-79E3DF94951C6A79) is still referenced from table
"tbllookupattendee".

    * C:\Documents and Settings\brian\My Documents\web\msr-api\transfer
\com\sql\QueryExecution.cfc (82, CFQUERY)
    * C:\Documents and Settings\brian\My Documents\web\msr-api\transfer
\com\sql\QueryExecution.cfc (59, CF_UDFMETHOD)
    * C:\Documents and Settings\brian\My Documents\web\msr-api\transfer
\com\sql\TransferDeleter.cfc (74, CF_TEMPLATEPROXY)
    * C:\Documents and Settings\brian\My Documents\web\msr-api\transfer
\com\sql\TransferDeleter.cfc (62, CF_UDFMETHOD)
    * C:\Documents and Settings\brian\My Documents\web\msr-api\transfer
\com\sql\transaction\Transaction.cfc (210, CF_UDFMETHOD)
    * C:\Documents and Settings\brian\My Documents\web\msr-api\transfer
\com\sql\transaction\Transaction.cfc (89, CF_TEMPLATEPROXY)
    * C:\Documents and Settings\brian\My Documents\web\msr-api\transfer
\com\sql\TransferDeleter.cfc (45, CF_TEMPLATEPROXY)
    * C:\Documents and Settings\brian\My Documents\web\msr-api\transfer
\com\sql\SQLManager.cfc (78, CF_TEMPLATEPROXY)
    * C:\Documents and Settings\brian\My Documents\web\msr-api\transfer
\com\Transfer.cfc (296, CF_TEMPLATEPROXY)
    * C:\Documents and Settings\brian\My Documents\web\msr-api\model
\event\eventService.cfc (443, CF_TEMPLATEPROXY)

This is exactly what I expected.  And what the try/catch should grab
and return on.

[some time passes...]  Ok, I found the solution.  This is definitely
not something that should throw a NullPointerException.  I have the
following catch code:

<cfcatch type="database">
        <cfif cfcatch.ErrorCode EQ "P0001">
                <!--- ERROR: This event has received monetary payouts and 
cannot be
deleted. --->
                <cflog file="application" text="..." />
                <cfreturn false />
        </cfif>
</cfcatch>
<cfcatch type="any">
        <cflog file="application" text="Event #evt.getVchEventName()# could
not be deleted because: #cfcatch.message# / #cfcatch.detail#" />
        <cfreturn false />
</cfcatch>

Do you see where this code can go wrong?  If it's a database error but
P0001, the catch falls through without returning anything.  I did some
debugging and added some more cflogs and found that this NPE was being
caused by the CFFUNCTION not returning a boolean.   I moved the return
out like so:

<cfcatch type="database">
        <cfif cfcatch.ErrorCode EQ "P0001">
                <!--- ERROR: This event has received monetary payouts and 
cannot be
deleted. --->
                <cflog file="application" text="..." />
        </cfif>
        <cfreturn false />
</cfcatch>

And now it's working (well, failing to delete, but working in that a
message is successfully returned).  I'm pretty sure ColdFusion
normally throws a specific error when a cffunction fails to return
what it's specified as, no?



Brian

--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to