From 7b2963d9a5c4d6b90ce7bbf58eefb86ca089b229 Mon Sep 17 00:00:00 2001 From: Ilya Matiach Date: Thu, 26 Sep 2019 01:01:26 -0400 Subject: [PATCH] [Java] add missing JNI exception checks to fix warnings (#2405) * add missing JNI exception checks to fix warnings * updated based on comments * removed rethrow logic * replace tabs with spaces --- swig/lightgbmlib.i | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/swig/lightgbmlib.i b/swig/lightgbmlib.i index ed8beb5f149b..fcceda030e6a 100644 --- a/swig/lightgbmlib.i +++ b/swig/lightgbmlib.i @@ -156,7 +156,13 @@ // get the size, indices and values auto indices = (jintArray)jenv->CallObjectMethod(objSparseVec, sparseVectorIndices); + if (jenv->ExceptionCheck()) { + return -1; + } auto values = (jdoubleArray)jenv->CallObjectMethod(objSparseVec, sparseVectorValues); + if (jenv->ExceptionCheck()) { + return -1; + } int size = jenv->GetArrayLength(indices); // Note: when testing on larger data (e.g. 288k rows per partition and 36mio rows total)