I'm trying to do some reflection in coldfusion, basically to dump the DNS cache 
InetAddress is currently holding in the JRE at the moment.  I found a site that 
offers a Java language example and I'm trying to convert it to CF tags. I'm 
having trouble with this line...

Class<InetAddress> klass = InetAddress.class;

I've tried...

<cfset klass = createObject("java", "java.net.InetAddress")>
<cfset klass = createObject("java", "java.net.InetAddress").class>
<cfset klass = createObject("java", "java.net.InetAddress").getClass()>
<cfset klass = createObject("java", "java.net.InetAddress").class.getClass()>

but they all return the same error...

"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."

What works is...

<cfset class = createObject("java", 
"java.net.InetAddress").getLocalHost.getClass()>

but the object it returns does not have a declaredField of "addressCache", it 
only has "INADDRSZ" "serialVersionUID" and "loopback" (I think because I'm not 
creating an instance of the base class for reflection, it's an instance of an 
instance.  Not sure.

<cfset class = createObject("java", "java.net.InetAddress")>

doesn't work either because it has no declaredFields at all.

Is there a way in CF7 to reproduce this line...

Class<InetAddress> klass = InetAddress.class;

using CF tags so that I can pull back the correct object for reflection 
purposes?  Yes, I realize I could compile the pure Java language example, put 
it on the CF server, and call it from CF, but for several reasons that's a 
pain, long story, so... I'm hoping to do it in CF tags if at all possible.

Thanks 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342463
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to