Index: trunk/src/com/kitfox/svg/SVGUniverse.java
===================================================================
--- trunk/src/com/kitfox/svg/SVGUniverse.java	(revision 4256)
+++ trunk/src/com/kitfox/svg/SVGUniverse.java	(revision 6002)
@@ -1,29 +1,37 @@
 /*
- * SVGUniverse.java
+ * SVG Salamander
+ * Copyright (c) 2004, Mark McKay
+ * All rights reserved.
  *
+ * Redistribution and use in source and binary forms, with or 
+ * without modification, are permitted provided that the following
+ * conditions are met:
  *
- *  The Salamander Project - 2D and 3D graphics libraries in Java
- *  Copyright (C) 2004 Mark McKay
+ *   - Redistributions of source code must retain the above 
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer.
+ *   - Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials 
+ *     provided with the distribution.
  *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *  Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
- *  projects can be found at http://www.kitfox.com
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * 
+ * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
+ * projects can be found at http://www.kitfox.com
  *
  * Created on February 18, 2004, 11:43 PM
  */
-
 package com.kitfox.svg;
 
@@ -36,5 +44,4 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -46,4 +53,5 @@
 import java.net.MalformedURLException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLConnection;
@@ -51,4 +59,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.zip.GZIPInputStream;
 import javax.imageio.ImageIO;
@@ -61,7 +71,7 @@
 
 /**
- * Many SVG files can be loaded at one time.  These files will quite likely
- * need to reference one another.  The SVG universe provides a container for
- * all these files and the means for them to relate to each other.
+ * Many SVG files can be loaded at one time. These files will quite likely need
+ * to reference one another. The SVG universe provides a container for all these
+ * files and the means for them to relate to each other.
  *
  * @author Mark McKay
@@ -70,48 +80,43 @@
 public class SVGUniverse implements Serializable
 {
+
     public static final long serialVersionUID = 0;
-    
     transient private PropertyChangeSupport changes = new PropertyChangeSupport(this);
-    
-    /**
-     * Maps document URIs to their loaded SVG diagrams.  Note that URIs for
+    /**
+     * Maps document URIs to their loaded SVG diagrams. Note that URIs for
      * documents loaded from URLs will reflect their URLs and URIs for documents
      * initiated from streams will have the scheme <i>svgSalamander</i>.
      */
     final HashMap loadedDocs = new HashMap();
-    
     final HashMap loadedFonts = new HashMap();
-    
     final HashMap loadedImages = new HashMap();
-    
     public static final String INPUTSTREAM_SCHEME = "svgSalamander";
-    
-    /**
-     * Current time in this universe.  Used for resolving attributes that
-     * are influenced by track information.  Time is in milliseconds.  Time
-     * 0 coresponds to the time of 0 in each member diagram.
+    /**
+     * Current time in this universe. Used for resolving attributes that are
+     * influenced by track information. Time is in milliseconds. Time 0
+     * coresponds to the time of 0 in each member diagram.
      */
     protected double curTime = 0.0;
-    
     private boolean verbose = false;
-
     //Cache reader for efficiency
     XMLReader cachedReader;
-    
-    /** Creates a new instance of SVGUniverse */
+
+    /**
+     * Creates a new instance of SVGUniverse
+     */
     public SVGUniverse()
     {
     }
-    
+
     public void addPropertyChangeListener(PropertyChangeListener l)
     {
         changes.addPropertyChangeListener(l);
     }
-    
+
     public void removePropertyChangeListener(PropertyChangeListener l)
     {
         changes.removePropertyChangeListener(l);
     }
-    
+
     /**
      * Release all loaded SVG document from memory
@@ -123,20 +128,20 @@
         loadedImages.clear();
     }
-    
+
     /**
      * Returns the current animation time in milliseconds.
      */
     public double getCurTime()
-    { 
-        return curTime; 
-    }
-    
+    {
+        return curTime;
+    }
+
     public void setCurTime(double curTime)
     {
         double oldTime = this.curTime;
-        this.curTime = curTime; 
+        this.curTime = curTime;
         changes.firePropertyChange("curTime", new Double(oldTime), new Double(curTime));
     }
-    
+
     /**
      * Updates all time influenced style and presentation attributes in all SVG
@@ -147,9 +152,9 @@
         for (Iterator it = loadedDocs.values().iterator(); it.hasNext();)
         {
-            SVGDiagram dia = (SVGDiagram)it.next();
+            SVGDiagram dia = (SVGDiagram) it.next();
             dia.updateTime(curTime);
         }
     }
-    
+
     /**
      * Called by the Font element to let the universe know that a font has been
@@ -160,17 +165,17 @@
         loadedFonts.put(font.getFontFace().getFontFamily(), font);
     }
-    
+
     public Font getDefaultFont()
     {
         for (Iterator it = loadedFonts.values().iterator(); it.hasNext();)
         {
-            return (Font)it.next();
+            return (Font) it.next();
         }
         return null;
     }
-    
+
     public Font getFont(String fontName)
     {
-        return (Font)loadedFonts.get(fontName);
+        return (Font) loadedFonts.get(fontName);
     }
 
@@ -188,5 +193,6 @@
             {
                 content = content.substring(6);
-                try {
+                try
+                {
                     byte[] buf = new sun.misc.BASE64Decoder().decodeBuffer(content);
                     ByteArrayInputStream bais = new ByteArrayInputStream(buf);
@@ -209,18 +215,22 @@
 
                     return url;
-                } catch (IOException ex) {
-                    ex.printStackTrace();
+                } catch (IOException ex)
+                {
+                    Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                        "Could not decode inline image", ex);
                 }
             }
             return null;
-        }
-        else
-        {
-            try {
+        } else
+        {
+            try
+            {
                 URL url = imageURI.toURL();
                 registerImage(url);
                 return url;
-            } catch (MalformedURLException ex) {
-                ex.printStackTrace();
+            } catch (MalformedURLException ex)
+            {
+                Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                    "Bad url", ex);
             }
             return null;
@@ -230,6 +240,9 @@
     void registerImage(URL imageURL)
     {
-        if (loadedImages.containsKey(imageURL)) return;
-        
+        if (loadedImages.containsKey(imageURL))
+        {
+            return;
+        }
+
         SoftReference ref;
         try
@@ -240,5 +253,5 @@
                 SVGIcon icon = new SVGIcon();
                 icon.setSvgURI(imageURL.toURI());
-                
+
                 BufferedImage img = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
                 Graphics2D g = img.createGraphics();
@@ -246,6 +259,5 @@
                 g.dispose();
                 ref = new SoftReference(img);
-            }
-            else
+            } else
             {
                 BufferedImage img = ImageIO.read(imageURL);
@@ -253,18 +265,20 @@
             }
             loadedImages.put(imageURL, ref);
-        }
-        catch (Exception e)
-        {
-            System.err.println("Could not load image: " + imageURL);
-            e.printStackTrace();
-        }
-    }
-    
+        } catch (Exception e)
+        {
+            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                "Could not load image: " + imageURL, e);
+        }
+    }
+
     BufferedImage getImage(URL imageURL)
     {
-        SoftReference ref = (SoftReference)loadedImages.get(imageURL);
-        if (ref == null) return null;
-        
-        BufferedImage img = (BufferedImage)ref.get();
+        SoftReference ref = (SoftReference) loadedImages.get(imageURL);
+        if (ref == null)
+        {
+            return null;
+        }
+
+        BufferedImage img = (BufferedImage) ref.get();
         //If image was cleared from memory, reload it
         if (img == null)
@@ -273,17 +287,19 @@
             {
                 img = ImageIO.read(imageURL);
-            }
-            catch (Exception e)
-            { e.printStackTrace(); }
+            } catch (Exception e)
+            {
+                Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                    "Could not load image", e);
+            }
             ref = new SoftReference(img);
             loadedImages.put(imageURL, ref);
         }
-        
+
         return img;
     }
-    
-    /**
-     * Returns the element of the document at the given URI.  If the document
-     * is not already loaded, it will be.
+
+    /**
+     * Returns the element of the document at the given URI. If the document is
+     * not already loaded, it will be.
      */
     public SVGElement getElement(URI path)
@@ -291,5 +307,5 @@
         return getElement(path, true);
     }
-    
+
     public SVGElement getElement(URL path)
     {
@@ -298,17 +314,17 @@
             URI uri = new URI(path.toString());
             return getElement(uri, true);
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
+        } catch (Exception e)
+        {
+            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                "Could not parse url " + path, e);
         }
         return null;
     }
-    
-    /**
-     * Looks up a href within our universe.  If the href refers to a document that
-     * is not loaded, it will be loaded.  The URL #target will then be checked
-     * against the SVG diagram's index and the coresponding element returned.
-     * If there is no coresponding index, null is returned.
+
+    /**
+     * Looks up a href within our universe. If the href refers to a document
+     * that is not loaded, it will be loaded. The URL #target will then be
+     * checked against the SVG diagram's index and the coresponding element
+     * returned. If there is no coresponding index, null is returned.
      */
     public SVGElement getElement(URI path, boolean loadIfAbsent)
@@ -318,6 +334,6 @@
             //Strip fragment from URI
             URI xmlBase = new URI(path.getScheme(), path.getSchemeSpecificPart(), null);
-            
-            SVGDiagram dia = (SVGDiagram)loadedDocs.get(xmlBase);
+
+            SVGDiagram dia = (SVGDiagram) loadedDocs.get(xmlBase);
             if (dia == null && loadIfAbsent)
             {
@@ -325,36 +341,45 @@
 //javax.swing.JOptionPane.showMessageDialog(null, xmlBase.toString());
                 URL url = xmlBase.toURL();
-                
+
                 loadSVG(url, false);
-                dia = (SVGDiagram)loadedDocs.get(xmlBase);
-                if (dia == null) return null;
-            }
-            
+                dia = (SVGDiagram) loadedDocs.get(xmlBase);
+                if (dia == null)
+                {
+                    return null;
+                }
+            }
+
             String fragment = path.getFragment();
             return fragment == null ? dia.getRoot() : dia.getElement(fragment);
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-            return null;
-        }
-    }
-    
+        } catch (Exception e)
+        {
+            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                "Could not parse path " + path, e);
+            return null;
+        }
+    }
+
     public SVGDiagram getDiagram(URI xmlBase)
     {
         return getDiagram(xmlBase, true);
     }
-    
-    /**
-     * Returns the diagram that has been loaded from this root.  If diagram is
+
+    /**
+     * Returns the diagram that has been loaded from this root. If diagram is
      * not already loaded, returns null.
      */
     public SVGDiagram getDiagram(URI xmlBase, boolean loadIfAbsent)
     {
-        if (xmlBase == null) return null;
-
-        SVGDiagram dia = (SVGDiagram)loadedDocs.get(xmlBase);
-        if (dia != null || !loadIfAbsent) return dia;
-        
+        if (xmlBase == null)
+        {
+            return null;
+        }
+
+        SVGDiagram dia = (SVGDiagram) loadedDocs.get(xmlBase);
+        if (dia != null || !loadIfAbsent)
+        {
+            return dia;
+        }
+
         //Load missing diagram
         try
@@ -372,21 +397,21 @@
             }
 
-            
+
             loadSVG(url, false);
-            dia = (SVGDiagram)loadedDocs.get(xmlBase);
+            dia = (SVGDiagram) loadedDocs.get(xmlBase);
             return dia;
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-        }
-        
+        } catch (Exception e)
+        {
+            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                "Could not parse", e);
+        }
+
         return null;
     }
-    
-    /**
-     * Wraps input stream in a BufferedInputStream.  If it is detected that this
+
+    /**
+     * Wraps input stream in a BufferedInputStream. If it is detected that this
      * input stream is GZIPped, also wraps in a GZIPInputStream for inflation.
-     * 
+     *
      * @param is Raw input stream
      * @return Uncompressed stream of SVG data
@@ -406,6 +431,5 @@
             GZIPInputStream iis = new GZIPInputStream(bin);
             return iis;
-        }
-        else
+        } else
         {
             //Plain text
@@ -413,14 +437,15 @@
         }
     }
-    
+
     public URI loadSVG(URL docRoot)
     {
         return loadSVG(docRoot, false);
     }
-    
+
     /**
      * Loads an SVG file and all the files it references from the URL provided.
      * If a referenced file already exists in the SVG universe, it is not
      * reloaded.
+     *
      * @param docRoot - URL to the location where this SVG file can be found.
      * @param forceLoad - if true, ignore cached diagram and reload
@@ -432,61 +457,71 @@
         {
             URI uri = new URI(docRoot.toString());
-            if (loadedDocs.containsKey(uri) && !forceLoad) return uri;
-            
+            if (loadedDocs.containsKey(uri) && !forceLoad)
+            {
+                return uri;
+            }
+
             InputStream is = docRoot.openStream();
             return loadSVG(uri, new InputSource(createDocumentInputStream(is)));
-        }
-        catch (Throwable t)
-        {
-            t.printStackTrace();
-        }
-        
+        } catch (URISyntaxException ex)
+        {
+            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                "Could not parse", ex);
+        } catch (IOException e)
+        {
+            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                "Could not parse", e);
+        }
+
         return null;
     }
-    
-    
+
     public URI loadSVG(InputStream is, String name) throws IOException
     {
         return loadSVG(is, name, false);
     }
-    
+
     public URI loadSVG(InputStream is, String name, boolean forceLoad) throws IOException
     {
         URI uri = getStreamBuiltURI(name);
-        if (uri == null) return null;
-        if (loadedDocs.containsKey(uri) && !forceLoad) return uri;
-        
+        if (uri == null)
+        {
+            return null;
+        }
+        if (loadedDocs.containsKey(uri) && !forceLoad)
+        {
+            return uri;
+        }
+
         return loadSVG(uri, new InputSource(createDocumentInputStream(is)));
     }
-    
+
     public URI loadSVG(Reader reader, String name)
     {
         return loadSVG(reader, name, false);
     }
-    
+
     /**
      * This routine allows you to create SVG documents from data streams that
-     * may not necessarily have a URL to load from.  Since every SVG document
-     * must be identified by a unique URL, Salamander provides a method to
-     * fake this for streams by defining it's own protocol - svgSalamander -
-     * for SVG documents without a formal URL.
+     * may not necessarily have a URL to load from. Since every SVG document
+     * must be identified by a unique URL, Salamander provides a method to fake
+     * this for streams by defining it's own protocol - svgSalamander - for SVG
+     * documents without a formal URL.
      *
      * @param reader - A stream containing a valid SVG document
-     * @param name - <p>A unique name for this document.  It will be used to
+     * @param name - <p>A unique name for this document. It will be used to
      * construct a unique URI to refer to this document and perform resolution
-     * with relative URIs within this document.</p>
-     * <p>For example, a name of "/myScene" will produce the URI
-     * svgSalamander:/myScene.  "/maps/canada/toronto" will produce
-     * svgSalamander:/maps/canada/toronto.  If this second document then
-     * contained the href "../uk/london", it would resolve by default to
-     * svgSalamander:/maps/uk/london.  That is, SVG Salamander defines the
-     * URI scheme svgSalamander for it's own internal use and uses it
-     * for uniquely identfying documents loaded by stream.</p>
-     * <p>If you need to link to documents outside of this scheme, you can
-     * either supply full hrefs (eg, href="url(http://www.kitfox.com/index.html)")
-     * or put the xml:base attribute in a tag to change the defaultbase
-     * URIs are resolved against</p>
-     * <p>If a name does not start with the character '/', it will be automatically
-     * prefixed to it.</p>
+     * with relative URIs within this document.</p> <p>For example, a name of
+     * "/myScene" will produce the URI svgSalamander:/myScene.
+     * "/maps/canada/toronto" will produce svgSalamander:/maps/canada/toronto.
+     * If this second document then contained the href "../uk/london", it would
+     * resolve by default to svgSalamander:/maps/uk/london. That is, SVG
+     * Salamander defines the URI scheme svgSalamander for it's own internal use
+     * and uses it for uniquely identfying documents loaded by stream.</p> <p>If
+     * you need to link to documents outside of this scheme, you can either
+     * supply full hrefs (eg, href="url(http://www.kitfox.com/index.html)") or
+     * put the xml:base attribute in a tag to change the defaultbase URIs are
+     * resolved against</p> <p>If a name does not start with the character '/',
+     * it will be automatically prefixed to it.</p>
      * @param forceLoad - if true, ignore cached diagram and reload
      *
@@ -498,32 +533,45 @@
         //Synthesize URI for this stream
         URI uri = getStreamBuiltURI(name);
-        if (uri == null) return null;
-        if (loadedDocs.containsKey(uri) && !forceLoad) return uri;
-        
+        if (uri == null)
+        {
+            return null;
+        }
+        if (loadedDocs.containsKey(uri) && !forceLoad)
+        {
+            return uri;
+        }
+
         return loadSVG(uri, new InputSource(reader));
     }
-    
+
     /**
      * Synthesize a URI for an SVGDiagram constructed from a stream.
+     *
      * @param name - Name given the document constructed from a stream.
      */
     public URI getStreamBuiltURI(String name)
     {
-        if (name == null || name.length() == 0) return null;
-        
-        if (name.charAt(0) != '/') name = '/' + name;
-        
+        if (name == null || name.length() == 0)
+        {
+            return null;
+        }
+
+        if (name.charAt(0) != '/')
+        {
+            name = '/' + name;
+        }
+
         try
         {
             //Dummy URL for SVG documents built from image streams
             return new URI(INPUTSTREAM_SCHEME, name, null);
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-            return null;
-        }
-    }
-    
+        } catch (Exception e)
+        {
+            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                "Could not parse", e);
+            return null;
+        }
+    }
+
     private XMLReader getXMLReaderCached() throws SAXException
     {
@@ -534,22 +582,15 @@
         return cachedReader;
     }
-    
-//    protected URI loadSVG(URI xmlBase, InputStream is)
+
     protected URI loadSVG(URI xmlBase, InputSource is)
     {
         // Use an instance of ourselves as the SAX event handler
         SVGLoader handler = new SVGLoader(xmlBase, this, verbose);
-        
+
         //Place this docment in the universe before it is completely loaded
         // so that the load process can refer to references within it's current
         // document
-//System.err.println("SVGUniverse: loading dia " + xmlBase);
         loadedDocs.put(xmlBase, handler.getLoadedDiagram());
-        
-        // Use the default (non-validating) parser
-//        SAXParserFactory factory = SAXParserFactory.newInstance();
-//        factory.setValidating(false);
-//        factory.setNamespaceAware(true);
-        
+
         try
         {
@@ -564,68 +605,65 @@
                         return new InputSource(new ByteArrayInputStream(new byte[0]));
                     }
-                }
-            );
+                });
             reader.setContentHandler(handler);
             reader.parse(is);
-            
-//            SAXParser saxParser = factory.newSAXParser();
-//            saxParser.parse(new InputSource(new BufferedReader(is)), handler);
+
+            handler.getLoadedDiagram().updateTime(curTime);
             return xmlBase;
-        }
-        catch (SAXParseException sex)
+        } catch (SAXParseException sex)
         {
             System.err.println("Error processing " + xmlBase);
             System.err.println(sex.getMessage());
-            
+
             loadedDocs.remove(xmlBase);
             return null;
-        }
-        catch (Throwable t)
-        {
-            t.printStackTrace();
-        }
-        
+        } catch (Throwable e)
+        {
+            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+                "Could not load SVG " + xmlBase, e);
+        }
+
         return null;
     }
-    
-    public static void main(String argv[])
-    {
-        try
-        {
-            URL url = new URL("svgSalamander", "localhost", -1, "abc.svg",
-                    new URLStreamHandler()
-            {
-                protected URLConnection openConnection(URL u)
-                {
-                    return null;
-                }
-            }
-            );
-//            URL url2 = new URL("svgSalamander", "localhost", -1, "abc.svg");
-            
-            //Investigate URI resolution
-            URI uriA, uriB, uriC, uriD, uriE;
-            
-            uriA = new URI("svgSalamander", "/names/mySpecialName", null);
-//            uriA = new URI("http://www.kitfox.com/salamander");
-//            uriA = new URI("svgSalamander://mySpecialName/grape");
-            System.err.println(uriA.toString());
-            System.err.println(uriA.getScheme());
-            
-            uriB = uriA.resolve("#begin");
-            System.err.println(uriB.toString());
-            
-            uriC = uriA.resolve("tree#boing");
-            System.err.println(uriC.toString());
-            
-            uriC = uriA.resolve("../tree#boing");
-            System.err.println(uriC.toString());
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-        }
-    }
-
+
+//    public static void main(String argv[])
+//    {
+//        try
+//        {
+//            URL url = new URL("svgSalamander", "localhost", -1, "abc.svg",
+//                    new URLStreamHandler()
+//            {
+//                protected URLConnection openConnection(URL u)
+//                {
+//                    return null;
+//                }
+//            }
+//            );
+////            URL url2 = new URL("svgSalamander", "localhost", -1, "abc.svg");
+//            
+//            //Investigate URI resolution
+//            URI uriA, uriB, uriC, uriD, uriE;
+//            
+//            uriA = new URI("svgSalamander", "/names/mySpecialName", null);
+////            uriA = new URI("http://www.kitfox.com/salamander");
+////            uriA = new URI("svgSalamander://mySpecialName/grape");
+//            System.err.println(uriA.toString());
+//            System.err.println(uriA.getScheme());
+//            
+//            uriB = uriA.resolve("#begin");
+//            System.err.println(uriB.toString());
+//            
+//            uriC = uriA.resolve("tree#boing");
+//            System.err.println(uriC.toString());
+//            
+//            uriC = uriA.resolve("../tree#boing");
+//            System.err.println(uriC.toString());
+//        }
+//        catch (Exception e)
+//        {
+//            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, 
+//                "Could not parse", e);
+//        }
+//    }
     public boolean isVerbose()
     {
@@ -637,5 +675,5 @@
         this.verbose = verbose;
     }
-    
+
     /**
      * Uses serialization to duplicate this universe.
@@ -650,5 +688,5 @@
         ByteArrayInputStream bin = new ByteArrayInputStream(bs.toByteArray());
         ObjectInputStream is = new ObjectInputStream(bin);
-        SVGUniverse universe = (SVGUniverse)is.readObject();
+        SVGUniverse universe = (SVGUniverse) is.readObject();
         is.close();
 
