ning-y / Palantir

An Android application visualising proteins in augmented reality!
https://play.google.com/store/apps/details?id=io.ningyuan.palantir
MIT License
4 stars 4 forks source link

Importing non-glb files via glb import button fails silently #8

Closed ning-y closed 5 years ago

ning-y commented 5 years ago

Importing a wrong file through the glb ImportButton (that is, not a glb file) fails silently and does not cancel the loading UI elements.

No exception is raised, so the catch block resetting the loading UI elements is not run: https://github.com/ningyuansg/Palantir/blob/ef0d6713999316131b77371d9b7573568434e0c9/app/src/main/java/io/ningyuan/palantir/SceneformActivity.java#L60-L122

Neither lambdas in thenAccept nor exceptionally in setModelRenderable is called: https://github.com/ningyuansg/Palantir/blob/ef0d6713999316131b77371d9b7573568434e0c9/app/src/main/java/io/ningyuan/palantir/fragments/SceneformFragment.java#L90-L127

The stacktrace:

2019-01-10 18:31:23.758 13008-14420/io.ningyuan.palantir E/ModelRenderable: Unable to load Renderable registryId='15471162837088744114789477735252.glb'
    java.util.concurrent.CompletionException: java.lang.RuntimeException: Failed to import '/data/user/0/io.ningyuan.palantir/cache/1547116283727-0/model_source.glb'
        at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.inputStreamToByteBuffer(LoadRenderableFromSfbTask.java:185)
        at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0(LoadRenderableFromSfbTask.java:117)
        at com.google.ar.sceneform.rendering.-$$Lambda$LoadRenderableFromSfbTask$0DkaOpfpmr8DYlbaxWogZtUpKTw.get(Unknown Source:4)
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1625)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.RuntimeException: Failed to import '/data/user/0/io.ningyuan.palantir/cache/1547116283727-0/model_source.glb'
        at com.google.ar.sceneform.assets.Converter.convertModel(Native Method)
        at com.google.ar.sceneform.assets.Converter.a(Unknown Source:125)
        at com.google.ar.sceneform.assets.RenderableSource.call(Unknown Source:224)
        at com.google.ar.sceneform.assets.RenderableSource.call(Unknown Source:0)
        at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.inputStreamToByteBuffer(LoadRenderableFromSfbTask.java:182)
        at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0(LoadRenderableFromSfbTask.java:117) 
        at com.google.ar.sceneform.rendering.-$$Lambda$LoadRenderableFromSfbTask$0DkaOpfpmr8DYlbaxWogZtUpKTw.get(Unknown Source:4) 
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1625) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 
2019-01-10 18:31:23.759 13008-14420/io.ningyuan.palantir E/SceneformFragment: null
    java.util.concurrent.CompletionException: java.lang.RuntimeException: Failed to import '/data/user/0/io.ningyuan.palantir/cache/1547116283727-0/model_source.glb'
        at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.inputStreamToByteBuffer(LoadRenderableFromSfbTask.java:185)
        at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0(LoadRenderableFromSfbTask.java:117)
        at com.google.ar.sceneform.rendering.-$$Lambda$LoadRenderableFromSfbTask$0DkaOpfpmr8DYlbaxWogZtUpKTw.get(Unknown Source:4)
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1625)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.RuntimeException: Failed to import '/data/user/0/io.ningyuan.palantir/cache/1547116283727-0/model_source.glb'
        at com.google.ar.sceneform.assets.Converter.convertModel(Native Method)
        at com.google.ar.sceneform.assets.Converter.a(Unknown Source:125)
        at com.google.ar.sceneform.assets.RenderableSource.call(Unknown Source:224)
        at com.google.ar.sceneform.assets.RenderableSource.call(Unknown Source:0)
        at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.inputStreamToByteBuffer(LoadRenderableFromSfbTask.java:182)
        at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0(LoadRenderableFromSfbTask.java:117) 
        at com.google.ar.sceneform.rendering.-$$Lambda$LoadRenderableFromSfbTask$0DkaOpfpmr8DYlbaxWogZtUpKTw.get(Unknown Source:4) 
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1625) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 
ning-y commented 5 years ago

The glb import button no longer exists.