I think I read about a work around for this on CF-Talk. It was something along the lines of passing in an empty structure. Sorry I can't remember more about it. There's an archive at http://www.houseoffusion.com/cf_lists/
Ade -----Original Message----- From: Tim Blair [mailto:[EMAIL PROTECTED]] Sent: 20 November 2002 16:26 To: [EMAIL PROTECTED] Subject: RE: [ cf-dev ] Passing a null value to a java method > You might want to try using chr(0) to see if it accepts the > null ascii character, but it probably won't work. That would have been a great solution, but unfortunately it doesn't work. *sigh* > Chould you just create a string object that is null, and pass > it into your class? Nope, I tried creating a dummy class that simply had a static method in it to return a null, but when I try to pass that value CF says that the var doesn't exist: <cfscript> nullobj = createObject("java", "NullTest"); nullstr = nullobj.getNull(); out = nullobj.testNull(nullstr); </cfscript> The above throws an error saying that nullstr doesn't exist: verified by isdefined("nullstr") returning FALSE. BTW, that's contrary to the CF docs that say a NULL value returned from a Java method is converted to an empty string ("") when it's used... > In that case, create a class (or modify the current class) > that uses the class with a further method (whatever the > method returns could be String or > whatever): > > public void bar(String a, String b) { > return bar(a, b, null); > } First I tried extending the original class and overriding the method name with a new signature which only took the correct params in and used a super.* call to the extended class's real function, but there were all sorts of problems in casting the original instance into an instance of my class, so I gave up on that one. In the end I went with the idea of creating a separate "interface" class (not actually a Java interface) which I can call from CF with the correct params and have that deal with the main chuck of the work. Surely someone could have found a nice simple way of using a null value!? Or did that one pass by the bobs at Macromedia...? ;o) Tim. ------------------------------------------------------- Tim Blair Web Application Engineer, Rawnet Limited Direct Phone : +44 (0) 1344 393 441 Switchboard : +44 (0) 1344 393 040 ------------------------------------------------------- rawnet ltd Atrium Court Bracknell [EMAIL PROTECTED] Berkshire Tel : +44 (0) 1344 393 040 RG12 1BW, UK http://www.rawnet.com ------------------------------------------------------- This message may contain information which is legally privileged and/or confidential. If you are not the intended recipient, you are hereby notified that any unauthorised disclosure, copying, distribution or use of this information is strictly prohibited. Such notification notwithstanding, any comments, opinions, information or conclusions expressed in this message are those of the originator, not of rawnet limited, unless otherwise explicitly and independently indicated by an authorised representative of rawnet limited. ------------------------------------------------------- -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
