svn commit: r13348 - trunk/src_new/org/argouml/uml/ProfileJava.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-08-14 11:25:04-0700
New Revision: 13348

Modified:
   trunk/src_new/org/argouml/uml/ProfileJava.java

Log:
Use URIs to get escaping and check for null URLs.

Modified: trunk/src_new/org/argouml/uml/ProfileJava.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ProfileJava.java?view=diff&rev=13348&p1=trunk/src_new/org/argouml/uml/ProfileJava.java&p2=trunk/src_new/org/argouml/uml/ProfileJava.java&r1=13347&r2=13348
==============================================================================
--- trunk/src_new/org/argouml/uml/ProfileJava.java	(original)
+++ trunk/src_new/org/argouml/uml/ProfileJava.java	2007-08-14 11:25:04-0700
@@ -26,6 +26,7 @@
 
 import java.io.File;
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -369,9 +370,9 @@
         File modelFile = new File(modelFilename);
         if (modelFile.exists()) {
             try {
-                URL url = modelFile.toURL();
-                if (url != null) {
-                    systemId = url.toExternalForm();
+                URI uri = modelFile.toURI();
+                if (uri != null) {
+                    systemId = uri.toURL().toExternalForm();
                 } else {
                     systemId = null;
                 }
@@ -388,7 +389,10 @@
             // in the same ClassLoader as the profile XMI file.
             // If we run using Java Web Start then we have every ArgoUML
             // file in the same jar (i.e. the same ClassLoader).
-            systemId = this.getClass().getResource(modelFilename).toExternalForm();
+            URL url = this.getClass().getResource(modelFilename);
+            if (url != null) {
+                systemId = url.toExternalForm();
+            }
         }
 
         if (systemId != null) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.