From a3c4d792ac71d31a3fc37d76b167cef9ba1f7641 Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Fri, 13 Oct 2023 20:59:57 -0400 Subject: [PATCH] Moving the finally block. --- .../ai/onnxruntime/reactnative/OnnxruntimeModuleTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/react_native/android/src/androidTest/java/ai/onnxruntime/reactnative/OnnxruntimeModuleTest.java b/js/react_native/android/src/androidTest/java/ai/onnxruntime/reactnative/OnnxruntimeModuleTest.java index 824b814da3e6c..92f6b19301a59 100644 --- a/js/react_native/android/src/androidTest/java/ai/onnxruntime/reactnative/OnnxruntimeModuleTest.java +++ b/js/react_native/android/src/androidTest/java/ai/onnxruntime/reactnative/OnnxruntimeModuleTest.java @@ -254,9 +254,10 @@ public void throwWrongSizeInput() { Assert.fail("Should have thrown exception"); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("Got invalid dimensions for input")); + } finally { + ortModule.dispose(sessionKey); } } finally { - ortModule.dispose(sessionKey); mockSession.finishMocking(); } } @@ -313,9 +314,10 @@ public void throwWrongRankInput() { Assert.fail("Should have thrown exception"); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("Invalid rank for input")); + } finally { + ortModule.dispose(sessionKey); } } finally { - ortModule.dispose(sessionKey); mockSession.finishMocking(); } }