Scott,

try the 0.90 code drop from last week, it has a fix for slashes.
If that won't work for the load from Reader API, then that is a 
separate bug, and the workaround is to use one of the other loader
interfaces such as by string or by url.


----------------                
Rick Goldberg
Sun Microsystems
>Content-return: allowed
>Date: Mon, 22 Feb 1999 09:01:43 -0800
>From: "Decker, Scott D" <[EMAIL PROTECTED]>
>Subject: [java3d] vrml url error?
>To: "'Java3D'" <[EMAIL PROTECTED]>
>MIME-version: 1.0
>
>I posted this to the vrml/java3d site as well
>anyone have a clue?
>
>I get a Malformed url exception when using this code from the vrml/java3d site
>it goes
>Malformed Url Exception 
>url "./" is not a valid url
>
>
>if loading a vrml object via a Reader
>then the setWorldURL method is called
>well, inside of this method all forward slashes are used, instead of using the
>File.separator value
>in the jdk
>
>here is the code
>with my comments in //note here
>
>public void setWorldURL(URL baseURL, URL worldURL) {
>       this.worldURL = worldURL;
>       if (baseURL == null) {
>           if (worldURL == null) { // input is from an input stream
>               worldURLBaseName = new String("."+"/"); //note here, this should
>be File.separator, not '/'
>           } else {
>               // figure out baseURL from the worldURL
>               java.util.StringTokenizer stok =
>                   new java.util.StringTokenizer(worldURL.toString(),
>                           "/");//note here, this should be File.separator, not
>'/'
>
>               int tocount = stok.countTokens()-1;
>               StringBuffer sb = new StringBuffer(80);
>               for(int ji = 0; ji < tocount ; ji++) {
>                   String a = stok.nextToken();
>                   if((ji == 0) && (!a.equals("file:"))) {
>                       sb.append(a);
>                       sb.append("/");//note here, this should be
>File.separator, not '/'
>
>                       sb.append("/");//note here, this should be
>File.separator, not '/'
>
>                   } else {
>                       sb.append(a);
>                       sb.append("/");//note here, this should be
>File.separator, not '/'
>                   }
>               }
>               worldURLBaseName = sb.toString();
>           }
>       }  else {
>           worldURLBaseName = baseURL.toString();
>       }
>       if (debug) {
>           System.out.println("World URL base is \"" + worldURLBaseName +
>"\"");//note here, this should be File.separator, not '\'
>
>       }
>       try {
>           worldURLBase = new URL(worldURLBaseName);
>           // Give Applet style security for where classes 
>           // can come from. A Script must originate relative
>           // to the parent URL.
>           scl =
>(java.net.URLClassLoader)java.security.AccessController.doPrivileged(
>               new java.security.PrivilegedAction() {
>                   public Object run() {
>                       return new URLClassLoader( new URL[] { worldURLBase } );
>                   }
>               }
>           );
>           
>       } catch (java.net.MalformedURLException murle) {
>           worldURLBase = (URL)null;
>           murle.printStackTrace();
>       }
>    }
>
>Scott Decker
>Research Scientist
>Pacific Northwest National Labs
>[EMAIL PROTECTED]
>
>
>
>Scott Decker
>Research Scientist
>Pacific Northwest National Labs
>[EMAIL PROTECTED]
>
>=====================================================================
>To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
>Java 3D Home Page: http://java.sun.com/products/java-media/3D/

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to