If there is an error in your error handling code you will get a hard error. It
may be because you are still attempting to work with the corrupt file in
your catch.

Change this:
<cfcatch type="Any"><cfset get_imginfo.ImgWidth=0><cfset
get_imginfo.ImgHeight=0></cfcatch>

To this:
<cfcatch type="Any"></cfcatch>

...and see if it makes the error go away.

-Cameron

On Tue, Sep 9, 2014 at 1:02 PM, Robert Harrison <[email protected]>
wrote:

>
> I have a script that returns image properties to me (below).   After years
> of using it I've hit some sort of file that crashes it.  The error I'm
> getting is:
>
>         Numbers of source Raster bands and source color space components
> do not match null
>
> I'm assuming that from a corrupt image file, but the real problem is I
> wrapped this in a cftry / cfcatch (as shown below) and it's ignoring the
> CFTRY and giving me a hard error.
>
>
>                         <cftry>
>                                 <cfscript>
>                                 function get_imageinfo(imgfile){
>                                   jFileIn =
> createObject("java","java.io.File").init(imgfile);
>                                   ImageInfo = StructNew();
>                                   ImageObject =
> createObject("java","javax.imageio.ImageIO").read(jFileIn);
> <---------THIS IS THE OFFENDING LINE
>                                   imageFile = CreateObject("java",
> "java.io.File");
>                                   imageFile.init(imgfile);
>                                   sizeb = imageFile.length();
>                                   sizekb = numberformat(sizeb / 1024,
> "999999999.99");
>                                   sizemb = numberformat(sizekb / 1024,
> "99999999.99");
>                                   get_imginfo = StructNew();
>                                   get_imginfo.ImgWidth =
> ImageObject.getWidth();
>                                   get_imginfo.ImgHeight =
> ImageObject.getHeight();
>                                   get_imginfo.SizeKB = sizekb;
>                                   get_imginfo.SizeMB = sizemb;
>                                   get_imginfo.ImageFormat =
> ListLast(ListLast(imgfile, "\"), ".");
>                                 }
>                                 </cfscript>
>                                 <cfcatch type="Any"><cfset
> get_imginfo.ImgWidth=0><cfset get_imginfo.ImgHeight=0></cfcatch>
>                         </cftry>
>
>
> It runs this in a loop over a bunch of images and works until it hits the
> bad file... but it's ignoring my CFTRY and still throwing a hard error.
>
> Anyone have any ideas on why the CRFTY/CFCATCH is not working.  Is there a
> problem because I'm catching a cfscript block?
>
> Thanks
>
> Robert Harrison
> Director of Interactive Services
>
> Austin & Williams
> Advertising I Branding I Digital I Direct
> 125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
> T 631.231.6600 X 119   F 631.434.7022
> http://www.austin-williams.com
>
> Blog:      http://www.austin-williams.com/blog
> Twitter:  http://www.twitter.com/austin_williams
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:359255
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to