Recent Articles


Open Up & Say Growth
Matt points to an interesting article about using an open business model. Not sure if the author, Henry Chesbrough mentioned that IBM made significantly more than $100m/yr in revenue as a result of its Linux...

SOA: Assistance With JBI Application Integration
The methodology of Enterprise Integration has advanced to Service Oriented Architecture (SOA) because of its ability to weave disparate applications and services to produce a business structure where data can flow as a business process. Environments have been built...

Java And Open Source
In November, Sun Microsystems moved to "open source" status for Java, after a decade of maintaining proprietary status for the portable programming language. Specifically, Sun has placed Java into the public...

Java Not True Test Of Open Source Innovation
My thesis advisor keeps reminding me to frame the question correctly, otherwise the experimental results will be meaningless. After reading this article by Dana, I couldn't agree more. Dana suggests that "Sun's...

JBoss CEO: Show Me The Money
Sys-Con is quoting Marc Fleury, JBoss founder & CEO and now SVP & GM of JBoss Division at Red Hat, as having said: "(while Red Hat) really haven't gotten in the way"…"the R&D really hasn't benefited from a...

Sun Gets Press, Maintains Control
So, the news is official: (and yes, I agree with IBM's question as to why Sun didn't join one of the community projects focused on delivering open source implementations of Java SE, ME and EE instead...

OpenJavaEE And OpenJDK
There's a lot of confusion about what Sun actually intends to do when they use the term "open source java". We shouldn't confuse the Java SE standard with the Java SE reference implementation. Check out Sun's (new) Open Source Java page. If you look...

02.13.07


Null Java References In Coldfusion 6 Vs 7

By Pete Freitag

ColdFusion 7 appears to be much better at passing null values to a java object.

ColdFusion 6 however likes to block you from doing it, even when you want to.

I am tring to work with a java API that requires me to pass a null value to a method.

Since CFMX 6 has no way of creating a null value I though I would use the Java API to concoct one.

So I did something like this:

vector = CreateObject("java", "java.util.Vector");

vector.setSize(1);

someAPI.methodThatRequiresANull(vector.get(0));


This works on ColdFusion 7, but on ColdFusion 6 it throws an exception:

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.

This trick isn't really useful because in ColdFusion 7 you can create a null value by calling JavaCast and using "null" as the type.

Low Rate eCommerce & Retail Plans

For example:

someAPI.methodThatRequiresANull( JavaCast("null", "") );

Does anyone know of a way to pass nulls that works in CF 6?

I know I could just write some java, but I want the solution to be pure CFML in this case.

Comments

Related Entries

* What's New in BlueDragon 7? - September 28, 2006

* DNS Query with ColdFusion - October 27, 2005

* Thread Priority, and Yielding - April 6, 2005

* Checking your JDBC Driver Version - March 31, 2004

* Determining the size of objects in memory - December 10, 2003

*Originally published at Pete Freitag's Homepage


About the Author:
Pete Freitag (http://www.petefreitag.com/) is a software engineer, and web developer located in central new york. Pete specializes in the HTTP protocol, web services, xml, java, and coldfusion. In 2003 Pete published the ColdFusion MX Developers Cookbook with SAMs Publishing.

Pete owns a Firm called Foundeo (http://foundeo.com/) that specializes in Web Consulting, and Products for Web Developers.

About JavaProNews
JavaProNews is a collection of news and commentary designed to keep you in step with the ever evolving landscape of Java environments. News and Advice for Java Professionals


JavaProNews is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com



-- JavaProNews is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc. All Rights Reserved Privacy Policy Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article

JavaProNews News Archives About Us feedback