Is there any reason why you couldn't wrap it in a try/catch and then
interrogate the error thrown?

 

Kola

-----Original Message-----
From: Chad McCue [mailto:[EMAIL PROTECTED] 
Sent: 29 October 2004 12:14
To: CF-Talk
Subject: Java Question

 

I am using the following java code to get a image from a external server.

 

where Arguments.FileLoc would be something like
http://www.sitename.com/imagedir/imagename.jpg

 

<cfset jFileIn =
createObject("java","java.net.URL").init(ARGUMENTS.FileLoc)>   

<cfset inP =
createObject("java","java.io.BufferedInputStream").init(jFileIn.openStream()
)>

 

The problem is, if the image does not exist, it throws this exception:
java.io.FileNotFoundException. How can I test that the file exists using the
openStream() function. I need to use a default image if file isn't found.

 

 

 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=36

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182918
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to