changeset 4154:780ac2ab1c8a

3DViewer: Fixed model loading from the jar file
author Alexander Kouznetsov
date Tue, 02 Jul 2013 16:07:27 -0700
parents 82163cce821d
children 877c687b9002
files apps/experiments/3DViewer/src/main/java/com/javafx/experiments/jfx3dviewer/MainController.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/jfx3dviewer/MainController.java	Tue Jul 02 10:16:41 2013 -0700
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/jfx3dviewer/MainController.java	Tue Jul 02 16:07:27 2013 -0700
@@ -204,16 +204,20 @@
         loadedPath = file;
         try {
             doLoad(file.toURI().toURL().toString());
-        } catch (MalformedURLException ex) {
+        } catch (Exception ex) {
             Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
         }
     }
 
     private void load(String fileUrl) {
         try {
-            loadedPath = new File(new URL(fileUrl).toURI()).getAbsoluteFile();
+            try {
+                loadedPath = new File(new URL(fileUrl).toURI()).getAbsoluteFile();
+            } catch (IllegalArgumentException | MalformedURLException | URISyntaxException ignored) {
+                loadedPath = null;
+            }
             doLoad(fileUrl);
-        } catch (MalformedURLException | URISyntaxException ex) {
+        } catch (Exception ex) {
             Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
         }
     }