[Java] JNI refactor for OrtSession
Description:
Following on from #12281 and #12013 this PR fixes the JNI error handling in OrtSession. OrtJniUtil is the remaining bit of unfixed JNI code, and that will probably ripple a little into the Java side bits to add some additional constructors to make things simpler.
This change is independent of #12281.
Motivation and Context
- Why is this change required? What problem does it solve? The error handling and exception throwing in the JNI code doesn't handle repeated errors very well. See #11451.
- If it fixes an open issue, please link to the issue here. Partial fix for #11451.
This pull request introduces 5 alerts when merging 633c0b9475121a1be8402e7f31c14bfccabc7c9c into 0c6037b5abe571fc43a55ef7a9d2f846820fbe5d - view on LGTM.com
new alerts:
- 5 for Uncontrolled data used in path expression
This pull request introduces 5 alerts when merging 633c0b9 into 0c6037b - view on LGTM.com
new alerts:
- 5 for Uncontrolled data used in path expression
Couple of issues remain plus LGTM warnings. They look strange, perhaps you need to merge the master.
This pull request introduces 5 alerts when merging 633c0b9 into 0c6037b - view on LGTM.com new alerts:
- 5 for Uncontrolled data used in path expression
Couple of issues remain plus LGTM warnings. They look strange, perhaps you need to merge the master.
The LGTM warnings seem to be from unrelated bits of code in flatbuffers? When I view this link - https://lgtm.com/projects/g/microsoft/onnxruntime/rev/pr-f6192b6c34d254dc8eb2561c99185bdf5290189a there's nothing related to any of my code. Am I looking in the wrong place?
Oh, looks like the main branch was renamed from master to main so the target got a bit confused. I'll try to fix it.
I rebased on the new main and hopefully that fixed it.
/azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline
/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux Nuphar CI Pipeline,Linux OpenVINO CI Pipeline
Azure Pipelines successfully started running 6 pipeline(s).
/azp run orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed onnxruntime-binary-size-checks-ci-pipeline
Azure Pipelines successfully started running 6 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
/azp run orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline orttraining-linux-gpu-ci-pipeline orttraining-ortmodule-distributed onnxruntime-binary-size-checks-ci-pipeline
Azure Pipelines successfully started running 1 pipeline(s).
I refactored the logic a little around where MSVC was complaining. Now it checks to see if there are too many inputs/outputs, if so it throws an exception, otherwise it downcasts to int32_t and then uses that as the loop variable.
Please, rebase against the latest before I restart the CI builds.
Please, rebase against the latest before I restart the CI builds.
Done.
/azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline
/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux Nuphar CI Pipeline,Linux OpenVINO CI Pipeline
Azure Pipelines successfully started running 6 pipeline(s).
Azure Pipelines successfully started running 6 pipeline(s).
/azp run orttraining-amd-gpu-ci-pipeline orttraining-linux-ci-pipeline orttraining-linux-gpu-ci-pipeline
No pipelines are associated with this pull request.
/azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline
/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux Nuphar CI Pipeline,Linux OpenVINO CI Pipeline
Azure Pipelines successfully started running 6 pipeline(s).
Azure Pipelines successfully started running 6 pipeline(s).
azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline
/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux Nuphar CI Pipeline,Linux OpenVINO CI Pipeline
Azure Pipelines successfully started running 6 pipeline(s).
/azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline