Hello Brian, thanks for your reply.

I have renamed the image to image123456XYZ.png, I'm sure that I haven't an
image with this name in the classpath.
I have added this to my code:

URL resource2 =
this.getClass().getClassLoader().getResource("image123456XYZ.png");
if(resource2 == null) {
    System.out.println("It's null!");
} else {
    System.out.println("It´s OK");
}

The result is: "It´s OK".
I have seen (debugging) that the rawData attribute of Image instance has
data (it isn't empty).

Any other idea?

Regards,
Antonio.

2009/3/4 Brian Busch <bdbus...@gmail.com>

>
>>> Just for testing - change the name so it doesn't start with a '-'
>>> (hypen). It might be a bad URL even tho it doesn't throw an exception.
>>> Weird, but easy to test.
>>>
>>
>> If this still fails - remember, you're scanning the classpath for a file
>> of that name - java will stop at the first one it finds - it might be that
>> you have a file with that same name that is blank or bad image data
>> somewhere else on your class path that is causing it. i.e., you may have a
>> copy of this image elsewhere on your classpath.
>>
>> by renaming the file you should be able to check to see if you have a
>> duplicate.
>>
>> if on a unix box, do something like
>>
>
> disregard - i forgot that getResource() will scan jar files, too. Plus, it
> should have been -f for testing the existence of the file; -s checks for a
> non-empty file.
>
> Also, getResource() returns null if not found OR you don't have
> permissions. Are you testing for this?
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>



-- 
* Antonio Manuel Muñiz
* amunizmartin.wordpress.com
* amunizmar...@gmail.com
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to