Fixed it! and maybe even found a bug!

In com\sun\j3d\loaders\vrml97\impl\ImageTexture.java near line 127 there is a 
statement as follows:
         urlObj = loader.stringToURL(url.strings[i]);
This rolls through the alternates for a textures file path.
I added a new line after it which overrides its behavior:
         urlObj = this.getClass().getResource( "/" + url.strings[i] );

I noticed that the path construction was something like 
"jar:file://c:/omg/mediatoy/obj/orange.gif" when in fact it should have been
"jar:file:/c:/omg/mediatoy/obj/orange.gif".  Note the "//" versus "/".  So...  I guess 
that this extra "/" in the path may have been
confusing it enough that some mystery code in Java wandered off to an entirely 
different handler.  My native expression of the path
( in response to Ricks comment was simply "orange.gif", and I tried variations on the 
theme ( "/orange.gif" for example ).

Note that under JDK1.3 that the behavior is different. Ron is looking at that 
variation on the theme and I'll post mail if it is
truly a distinct bug also.

I'm still exploring this a bit and may end up migrating things elsewhere but at least 
I can now explore between success and failure
states in loading textures in vrml files from within jar files.

I'm pretty impressed by how easy it was for me to go in and change something directly 
in the VRML code - it's nicely laid out.

 - Andy

-----Original Message-----
From: Rick Goldberg <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>; 
[EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, October 29, 1999 5:27 PM
Subject: Re: [JAVA3D] jar vrml images


>Anslelm,
>
>
>Sounds like the file references texture images via ftp, check
>the url of the textures in the file.
>
>Regards,
>______________________________________
>Rick Goldberg - Member Technical Staff
>Sun Microsystems
>Graphics Systems Software
>901 San Antonio Road, MS UMPK27-302
>Palo Alto, CA 94043-4900
>650 786-0108 Direct
>650 856-2114 Fax
>[EMAIL PROTECTED]
>
>> MIME-Version: 1.0
>> Content-Transfer-Encoding: 7bit
>> X-Priority: 3
>> X-MSMail-Priority: Normal
>> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
>> Date: Fri, 29 Oct 1999 14:20:23 -0400
>> From: Anselm Hook <[EMAIL PROTECTED]>
>> Subject: [JAVA3D] jar vrml images
>> To: [EMAIL PROTECTED]
>>
>> I'm having trouble fetching an image from a jar file using the web3d vrml
>loaders.  I'm using Windows 95, Jdk1.2.2 and the non beta
>> J3D.
>>
>> I'm able to fetch a .wrl file without trouble, but if the .wrl file references
>a texture then I get an error message:
>>
>> java.lang.IllegalArgumentException: invalid port range: :21
>>    at java.net.SocketPermission.init(SocketPermission.java:341)
>>    at java.net.SocketPermission.<init>(SocketPermission.java:206)
>>    at
>sun.net.www.protocol.ftp.FtpURLConnection.getPermission(FtpURLConnection.java:17
>5)
>>    at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:80)
>>    at
>sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:1
>12)
>>    at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:116)
>>    at
>sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:242)
>>    at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:221)
>>    at sun.awt.image.ImageFetcher.run(ImageFetcher.java:189)
>>
>> Any ideas?  It seems to be wanting to ftp to my windows based laptop, which I
>don't think accepts ftp connections...  nevertheless
>> the .wrl itself does fetch so somehow images are treated differently.
>>
>>  - Andy
>>
>> ===========================================================================
>> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to