changeset 6209:5909ebb2b62e

RT-35558: fixing NPE on ARM with filtered resources, and skipping loading of unused previews Reviewed-by: mrkam
author ddhill
date Wed, 29 Jan 2014 22:12:21 -0500
parents ef668b8a0c89
children b9c3f0ff6b2b
files apps/samples/Ensemble8/src/app/java/ensemble/SampleInfo.java
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/apps/samples/Ensemble8/src/app/java/ensemble/SampleInfo.java	Thu Jan 30 04:50:40 2014 +0200
+++ b/apps/samples/Ensemble8/src/app/java/ensemble/SampleInfo.java	Wed Jan 29 22:12:21 2014 -0500
@@ -107,7 +107,6 @@
         this.ensemblePath = ensemblePath;
         this.baseUri = baseUri;
         this.appClass = appClass;
-        this.previewUrl = previewUrl;
         this.resourceUrls = resourceUrls;
         this.mainFileUrl = mainFileUrl;
         this.apiClasspaths = apiClasspaths;
@@ -118,8 +117,22 @@
         this.runsOnEmbedded = runsOnEmbedded;
         
         if (EnsembleApp.PRELOAD_PREVIEW_IMAGES) {
-            getImage(getClass().getResource(previewUrl).toExternalForm());
+            // Note: there may be missing classes/resources due to some filtering
+            if (PlatformFeatures.USE_EMBEDDED_FILTER && !runsOnEmbedded) {
+                // we should skip loading this image which will not ever be shown
+            } else {
+                java.net.URL url = getClass().getResource(previewUrl);
+                if (url != null) {
+                    getImage(url.toExternalForm());
+                } else {
+                    // mark this previewURL as missing
+                    System.out.println("Note: Sample preview "+ensemblePath+" not found");
+                    previewUrl = null;
+                }
+            }
         }
+
+        this.previewUrl = previewUrl;
     }
     
     @Override public String toString() {