Repository: ignite Updated Branches: refs/heads/ignite-2.0 9ce099c05 -> 1410900f2
http://git-wip-us.apache.org/repos/asf/ignite/blob/1410900f/modules/platforms/cpp/jni/include/ignite/jni/utils.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/jni/include/ignite/jni/utils.h b/modules/platforms/cpp/jni/include/ignite/jni/utils.h index 2b22cf9..bbd461d 100644 --- a/modules/platforms/cpp/jni/include/ignite/jni/utils.h +++ b/modules/platforms/cpp/jni/include/ignite/jni/utils.h @@ -44,14 +44,14 @@ namespace ignite }; /** - * Represents global reference to Java object. - */ + * Represents global reference to Java object. + */ class IGNITE_IMPORT_EXPORT JavaGlobalRef { public: /** - * Default constructor - */ + * Default constructor + */ JavaGlobalRef() : ctx(0), obj(0) @@ -60,11 +60,11 @@ namespace ignite } /** - * Constructor - * - * @param ctx JNI context. - * @param obj Java object. - */ + * Constructor + * + * @param ctx JNI context. + * @param obj Java object. + */ JavaGlobalRef(java::JniContext& ctx, jobject obj) : ctx(&ctx), obj(ctx.Acquire(obj)) @@ -73,10 +73,10 @@ namespace ignite } /** - * Copy constructor - * - * @param other Other instance. - */ + * Copy constructor + * + * @param other Other instance. + */ JavaGlobalRef(const JavaGlobalRef& other) : ctx(other.ctx), obj(ctx->Acquire(other.obj)) @@ -85,11 +85,11 @@ namespace ignite } /** - * Assignment operator. - * - * @param other Other instance. - * @return *this. - */ + * Assignment operator. + * + * @param other Other instance. + * @return *this. + */ JavaGlobalRef& operator=(const JavaGlobalRef& other) { if (this != &other) @@ -105,8 +105,8 @@ namespace ignite } /** - * Destructor. - */ + * Destructor. + */ ~JavaGlobalRef() { if (ctx) @@ -114,10 +114,10 @@ namespace ignite } /** - * Get object. - * - * @return Object. - */ + * Get object. + * + * @return Object. + */ jobject Get() { return obj; @@ -136,11 +136,10 @@ namespace ignite * First search is performed using the passed path argument (is not NULL). * Then JRE_HOME is evaluated. Last, JAVA_HOME is evaluated. * - * @param Explicitly defined path (optional). - * @param found Whether library was found. - * @return Path to the file. + * @param path Explicitly defined path (optional). + * @return Path to the file. Empty string if the library was not found. */ - IGNITE_IMPORT_EXPORT std::string FindJvmLibrary(const std::string* path, bool* found); + IGNITE_IMPORT_EXPORT std::string FindJvmLibrary(const std::string& path); /** * Load JVM library into the process. @@ -151,23 +150,21 @@ namespace ignite IGNITE_IMPORT_EXPORT bool LoadJvmLibrary(const std::string& path); /** - * Create Ignite classpath based on user input and home directory. + * Create Ignite classpath based on user input directory. * * @param usrCp User's classpath. - * @param home Ignite home directory. * @return Classpath. */ - IGNITE_IMPORT_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home); + IGNITE_IMPORT_EXPORT std::string CreateIgniteClasspath(const std::string& usrCp); /** * Create Ignite classpath based on user input and home directory. * * @param usrCp User's classpath. * @param home Ignite home directory. - * @param test Whether test classpath must be used. * @return Classpath. */ - IGNITE_IMPORT_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool test); + IGNITE_IMPORT_EXPORT std::string CreateIgniteClasspath(const std::string& usrCp, const std::string& home); /** * Resolve IGNITE_HOME directory. Resolution is performed in several @@ -180,10 +177,10 @@ namespace ignite * IGNITE_HOME is considered resolved. * * @param path Optional path to evaluate. - * @param found Whether IGNITE_HOME home was found. - * @return Resolved GG home. + * @param home Resolved GG home. + * @return True if IGNITE_HOME home was found. */ - IGNITE_IMPORT_EXPORT std::string ResolveIgniteHome(const std::string* path, bool* found); + IGNITE_IMPORT_EXPORT bool ResolveIgniteHome(const std::string& path, std::string& home); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/1410900f/modules/platforms/cpp/jni/os/linux/src/utils.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/jni/os/linux/src/utils.cpp b/modules/platforms/cpp/jni/os/linux/src/utils.cpp index a0f74ef..924779c 100644 --- a/modules/platforms/cpp/jni/os/linux/src/utils.cpp +++ b/modules/platforms/cpp/jni/os/linux/src/utils.cpp @@ -21,8 +21,10 @@ #include <sys/stat.h> #include <dirent.h> #include <dlfcn.h> +#include <unistd.h> #include "ignite/common/utils.h" +#include "ignite/common/fixed_size_array.h" #include "ignite/jni/utils.h" #include "ignite/jni/java.h" @@ -73,81 +75,57 @@ namespace ignite if (!val) pthread_setspecific(attachKey, new AttachHelper()); } - - /** - * Helper method to set boolean result to reference with proper NULL-check. - * - * @param res Result. - * @param outRes Where to set the result. - */ - inline void SetBoolResult(bool res, bool* outRes) - { - if (outRes) - *outRes = res; - } - + /** * Helper function for GG home resolution. Checks whether certain folders * exist in the path. Optionally goes upwards in directory hierarchy. * * @param path Path to evaluate. * @param up Whether to go upwards. - * @res Resolution result. - * @return Resolved directory. + * @param res Resolved directory. + * @return Resolution result. */ - std::string ResolveIgniteHome0(const std::string& path, bool up, bool* res) + bool ResolveIgniteHome0(const std::string& path, bool up, std::string& res) { struct stat pathStat; - - if (stat(path.c_str(), &pathStat) != -1 && S_ISDIR(pathStat.st_mode)) - { - // Remove trailing slashes, otherwise we will have an infinite loop. - std::string path0 = path; - while (true) { - char lastChar = *path0.rbegin(); + if (stat(path.c_str(), &pathStat) == -1 || !S_ISDIR(pathStat.st_mode)) + return false; + + // Remove trailing slashes, otherwise we will have an infinite loop. + std::string path0; - if (lastChar == '/' || lastChar == ' ') { - size_t off = path0.find_last_of(lastChar); + size_t last = path.find_last_not_of("/\\ "); - path0.erase(off, 1); - } - else - break; - } + if (last != std::string::npos) + path0.assign(path, 0, last + 1); - std::string binStr = path0 + PROBE_BIN; - struct stat binStat; + std::string binStr = path0 + PROBE_BIN; + struct stat binStat; - std::string examplesStr = path0 + PROBE_EXAMPLES; - struct stat examplesStat; + std::string examplesStr = path0 + PROBE_EXAMPLES; + struct stat examplesStat; - if (stat(binStr.c_str(), &binStat) != -1 && S_ISDIR(binStat.st_mode) && - stat(examplesStr.c_str(), &examplesStat) != -1 && S_ISDIR(examplesStat.st_mode)) - { - SetBoolResult(true, res); - - return std::string(path0); - } + if (stat(binStr.c_str(), &binStat) != -1 && S_ISDIR(binStat.st_mode) && + stat(examplesStr.c_str(), &examplesStat) != -1 && S_ISDIR(examplesStat.st_mode)) + { + res = path0; - if (up) - { - // Evaluate parent directory. - size_t slashPos = path0.find_last_of("/"); + return true; + } - if (slashPos != std::string::npos) - { - std::string parent = path0.substr(0, slashPos); + if (!up) + return false; - return ResolveIgniteHome0(parent, true, res); - } - } + // Evaluate parent directory. + size_t slashPos = path0.find_last_of("/"); - } + if (slashPos == std::string::npos) + return false; - SetBoolResult(false, res); + std::string parent(path0, 0, slashPos); - return std::string(); + return ResolveIgniteHome0(parent, true, res); } /** @@ -158,7 +136,7 @@ namespace ignite */ std::string ClasspathJars(const std::string& path) { - std::string res = std::string(); + std::string res; DIR* dir = opendir(path.c_str()); @@ -168,7 +146,8 @@ namespace ignite while ((entry = readdir(dir)) != NULL) { - if (strstr(entry->d_name, ".jar")) + char *dot = strrchr(entry->d_name, '.'); + if (dot && !strcmp(dot, ".jar")) { res.append(path); res.append("/"); @@ -319,31 +298,22 @@ namespace ignite return res; } - std::string FindJvmLibrary(const std::string* path, bool* found) + std::string FindJvmLibrary(const std::string& path) { - SetBoolResult(true, found); // Optimistically assume that we will find it. + // If path is provided explicitly, then check only it. + if (!path.empty() && FileExists(path)) + return path; - if (path) { - // If path is provided explicitly, then check only it. - if (FileExists(*path)) - return std::string(path->data()); - } - else - { - bool javaEnvFound; - std::string javaEnv = GetEnv(JAVA_HOME, javaEnvFound); + std::string javaEnv; - if (javaEnvFound) - { - std::string javaDll = javaEnv + JAVA_DLL; + if (GetEnv(JAVA_HOME, javaEnv)) + { + std::string javaDll = javaEnv + JAVA_DLL; - if (FileExists(javaDll)) - return std::string(javaDll); - } + if (FileExists(javaDll)) + return javaDll; } - SetBoolResult(false, found); - return std::string(); } @@ -352,66 +322,91 @@ namespace ignite void* hnd = dlopen(path.c_str(), RTLD_LAZY); return hnd != NULL; - } + } - std::string ResolveIgniteHome(const std::string* path, bool* found) + /** + * Create Ignite classpath based on user input and home directory. + * + * @param usrCp User's classpath. + * @param home Ignite home directory. + * @param forceTest Whether test classpath must be used. + * @return Classpath. + */ + std::string CreateIgniteClasspath(const std::string& usrCp, const std::string* home, bool forceTest) { - if (path) - // 1. Check passed argument. - return ResolveIgniteHome0(*path, false, found); - else + // 1. Append user classpath if it exists. + std::string cp; + + if (!usrCp.empty()) { - // 2. Check environment variable. - bool envFound; - std::string env = GetEnv(IGNITE_HOME, envFound); + cp.append(usrCp); - if (envFound) - return ResolveIgniteHome0(env, false, found); + if (*cp.rbegin() != ';') + cp.push_back(';'); } - SetBoolResult(false, found); - - return std::string(); - } - - std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home) - { - bool forceTest = false; - + // 2. Append home classpath if home is defined. if (home) { - bool envFound; - std::string env = GetEnv(IGNITE_NATIVE_TEST_CLASSPATH, envFound); + std::string homeCp = CreateIgniteHomeClasspath(*home, forceTest); - forceTest = envFound && env.compare("true") == 0; + cp.append(homeCp); } - return CreateIgniteClasspath(usrCp, home, forceTest); + // 3. Return. + return cp; } - std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool forceTest) + std::string CreateIgniteClasspath(const std::string& usrCp) + { + if (usrCp.empty() || *usrCp.rbegin() == ';') + return usrCp; + + return usrCp + ';'; + } + + std::string CreateIgniteClasspath(const std::string& usrCp, const std::string& home) { // 1. Append user classpath if it exists. - std::string cp = std::string(); + std::string cp = CreateIgniteClasspath(usrCp); - if (usrCp) - { - cp.append(*usrCp); + // 2. Append home classpath + std::string env; + bool envFound = GetEnv(IGNITE_NATIVE_TEST_CLASSPATH, env); - if (*cp.rbegin() != ':') - cp.append(":"); - } + bool forceTest = envFound && env.compare("true") == 0; - // 2. Append home classpath if home is defined. - if (home) - { - std::string homeCp = CreateIgniteHomeClasspath(*home, forceTest); + std::string homeCp = CreateIgniteHomeClasspath(home, forceTest); - cp.append(homeCp); - } + cp.append(homeCp); // 3. Return. return cp; } + + bool ResolveIgniteHome(const std::string& path, std::string& home) + { + if (!path.empty()) + // 1. Check passed argument. + return ResolveIgniteHome0(path, false, home); + + // 2. Check environment variable. + std::string env; + + if (GetEnv(IGNITE_HOME, env)) + return ResolveIgniteHome0(env, false, home); + + // 3. Check current work dir. + FixedSizeArray<char> curDir(1024 * 16); + + char* res = getcwd(curDir.GetData(), curDir.GetSize()); + + if (!res) + return false; + + std::string curDirStr(curDir.GetData()); + + return ResolveIgniteHome0(curDirStr, true, home); + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/1410900f/modules/platforms/cpp/jni/os/win/src/utils.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/jni/os/win/src/utils.cpp b/modules/platforms/cpp/jni/os/win/src/utils.cpp index 0647aa3..3b2033b 100644 --- a/modules/platforms/cpp/jni/os/win/src/utils.cpp +++ b/modules/platforms/cpp/jni/os/win/src/utils.cpp @@ -19,6 +19,7 @@ #include "ignite/common/concurrent.h" #include "ignite/common/utils.h" +#include "ignite/common/fixed_size_array.h" #include "ignite/jni/utils.h" #include "ignite/jni/java.h" @@ -53,77 +54,55 @@ namespace ignite const char* IGNITE_NATIVE_TEST_CLASSPATH = "IGNITE_NATIVE_TEST_CLASSPATH"; /** - * Helper method to set boolean result to pointer with proper NULL-check. - * - * @param res Result. - * @param outRes Where to set the result. - */ - inline void SetBoolResult(bool res, bool* outRes) - { - if (outRes) - *outRes = res; - } - - /** * Helper function for GG home resolution. Checks whether certain folders * exist in the path. Optionally goes upwards in directory hierarchy. * * @param path Path to evaluate. * @param up Whether to go upwards. - * @res Resolution result. - * @return Resolved directory. + * @param res Resolved directory. + * @return Resolution result. */ - std::string ResolveIgniteHome0(const std::string& path, bool up, bool* res) + bool ResolveIgniteHome0(const std::string& path, bool up, std::string& res) { DWORD attrs = GetFileAttributesA(path.c_str()); - if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY)) - { - // Remove trailing slashes, otherwise we will have an infinite loop. - std::string path0 = path; + if (attrs == INVALID_FILE_ATTRIBUTES || !(attrs & FILE_ATTRIBUTE_DIRECTORY)) + return false; - while (true) { - char lastChar = *path0.rbegin(); + // Remove trailing slashes, otherwise we will have an infinite loop. + std::string path0; - if (lastChar == '/' || lastChar == '\\' || lastChar == ' ') { - size_t off = path0.find_last_of(lastChar); + size_t last = path.find_last_not_of("/\\ "); - path0.erase(off, 1); - } - else - break; - } + if (last != std::string::npos) + path0.assign(path, 0, last + 1); - std::string binStr = path0 + PROBE_BIN; - DWORD binAttrs = GetFileAttributesA(binStr.c_str()); + std::string binStr = path0 + PROBE_BIN; + DWORD binAttrs = GetFileAttributesA(binStr.c_str()); - std::string examplesStr = path0 + PROBE_EXAMPLES; - DWORD examplesAttrs = GetFileAttributesA(examplesStr.c_str()); + std::string examplesStr = path0 + PROBE_EXAMPLES; + DWORD examplesAttrs = GetFileAttributesA(examplesStr.c_str()); - if (binAttrs != INVALID_FILE_ATTRIBUTES && (binAttrs & FILE_ATTRIBUTE_DIRECTORY) && - examplesAttrs != INVALID_FILE_ATTRIBUTES && (examplesAttrs & FILE_ATTRIBUTE_DIRECTORY)) - { - SetBoolResult(true, res); - return std::string(path0); - } + if (binAttrs != INVALID_FILE_ATTRIBUTES && (binAttrs & FILE_ATTRIBUTE_DIRECTORY) && + examplesAttrs != INVALID_FILE_ATTRIBUTES && (examplesAttrs & FILE_ATTRIBUTE_DIRECTORY)) + { + res = path0; - if (up) - { - // Evaluate parent directory. - size_t slashPos = path0.find_last_of("/\\"); + return true; + } - if (slashPos != std::string::npos) - { - std::string parent = path0.substr(0, slashPos); + if (!up) + return false; - return ResolveIgniteHome0(parent, true, res); - } - } - } + // Evaluate parent directory. + size_t slashPos = path0.find_last_of("/\\"); - SetBoolResult(false, res); + if (slashPos == std::string::npos) + return false; - return std::string(); + std::string parent(path0, 0, slashPos); + + return ResolveIgniteHome0(parent, true, res); } /** @@ -136,24 +115,24 @@ namespace ignite { std::string searchPath = path + "\\*.jar"; - std::string res = std::string(); - WIN32_FIND_DATAA findData; HANDLE hnd = FindFirstFileA(searchPath.c_str(), &findData); - if (hnd != INVALID_HANDLE_VALUE) + if (hnd == INVALID_HANDLE_VALUE) + return std::string(); + + std::string res; + + do { - do - { - res.append(path); - res.append("\\"); - res.append(findData.cFileName); - res.append(";"); - } while (FindNextFileA(hnd, &findData) != 0); + res.append(path); + res.append("\\"); + res.append(findData.cFileName); + res.append(";"); + } while (FindNextFileA(hnd, &findData) != 0); - FindClose(hnd); - } + FindClose(hnd); return res; } @@ -238,7 +217,7 @@ namespace ignite */ std::string CreateIgniteHomeClasspath(const std::string& home, bool forceTest) { - std::string res = std::string(); + std::string res; // 1. Add exploded test directories. if (forceTest) @@ -292,31 +271,22 @@ namespace ignite return res; } - std::string FindJvmLibrary(const std::string* path, bool* found) + std::string FindJvmLibrary(const std::string& path) { - SetBoolResult(true, found); // Optimistically assume that we will find it. + // If path is provided explicitly, then check only it. + if (!path.empty() && FileExists(path)) + return path; - if (path) { - // If path is provided explicitly, then check only it. - if (FileExists(*path)) - return std::string(path->data()); - } - else - { - bool javaEnvFound; - std::string javaEnv = GetEnv(JAVA_HOME, javaEnvFound); + std::string javaEnv; - if (javaEnvFound) - { - std::string javaDll = javaEnv + JAVA_DLL; + if (GetEnv(JAVA_HOME, javaEnv)) + { + std::string javaDll = javaEnv + JAVA_DLL; - if (FileExists(javaDll)) - return std::string(javaDll); - } + if (FileExists(javaDll)) + return javaDll; } - *found = false; - return std::string(); } @@ -327,32 +297,25 @@ namespace ignite return mod != NULL; } - std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home) - { - bool forceTest = false; - - if (home) - { - bool envFound; - std::string env = GetEnv(IGNITE_NATIVE_TEST_CLASSPATH, envFound); - - forceTest = envFound && env.compare("true") == 0; - } - - return CreateIgniteClasspath(usrCp, home, forceTest); - } - - std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool forceTest) + /** + * Create Ignite classpath based on user input and home directory. + * + * @param usrCp User's classpath. + * @param home Ignite home directory. + * @param forceTest Whether test classpath must be used. + * @return Classpath. + */ + std::string CreateIgniteClasspath(const std::string& usrCp, const std::string* home, bool forceTest) { // 1. Append user classpath if it exists. - std::string cp = std::string(); + std::string cp; - if (usrCp) + if (!usrCp.empty()) { - cp.append(*usrCp); + cp.append(usrCp); if (*cp.rbegin() != ';') - cp.append(";"); + cp.push_back(';'); } // 2. Append home classpath if home is defined. @@ -367,33 +330,55 @@ namespace ignite return cp; } - std::string ResolveIgniteHome(const std::string* path, bool* found) + std::string CreateIgniteClasspath(const std::string& usrCp) { - if (path) + if (usrCp.empty() || *usrCp.rbegin() == ';') + return usrCp; + + return usrCp + ';'; + } + + std::string CreateIgniteClasspath(const std::string& usrCp, const std::string& home) + { + // 1. Append user classpath if it exists. + std::string cp = CreateIgniteClasspath(usrCp); + + // 2. Append home classpath + std::string env; + bool envFound = GetEnv(IGNITE_NATIVE_TEST_CLASSPATH, env); + + bool forceTest = envFound && env.compare("true") == 0; + + std::string homeCp = CreateIgniteHomeClasspath(home, forceTest); + + cp.append(homeCp); + + // 3. Return. + return cp; + } + + bool ResolveIgniteHome(const std::string& path, std::string& home) + { + if (!path.empty()) // 1. Check passed argument. - return ResolveIgniteHome0(*path, false, found); - else - { - // 2. Check environment variable. - bool envFound; - std::string env = GetEnv(IGNITE_HOME, envFound); + return ResolveIgniteHome0(path, false, home); - if (envFound) - return ResolveIgniteHome0(env, false, found); + // 2. Check environment variable. + std::string env; - // 3. Check current work dir. - const DWORD curDirLen = GetCurrentDirectory(0, NULL); + if (GetEnv(IGNITE_HOME, env)) + return ResolveIgniteHome0(env, false, home); - char* curDir = new char[curDirLen]; + // 3. Check current work dir. + const DWORD curDirLen = GetCurrentDirectory(0, NULL); - GetCurrentDirectoryA(curDirLen, curDir); + FixedSizeArray<char> curDir(curDirLen); - std::string curDirStr = curDir; + GetCurrentDirectoryA(curDir.GetSize(), curDir.GetData()); - delete[] curDir; + std::string curDirStr(curDir.GetData()); - return ResolveIgniteHome0(curDirStr, true, found); - } + return ResolveIgniteHome0(curDirStr, true, home); } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/1410900f/modules/platforms/cpp/jni/src/java.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp index 0c2e460..1988a86 100644 --- a/modules/platforms/cpp/jni/src/java.cpp +++ b/modules/platforms/cpp/jni/src/java.cpp @@ -32,7 +32,16 @@ JniHandlers* hnds = reinterpret_cast<JniHandlers*>(envPtr); \ type hnd = hnds->field; \ if (hnd) \ - hnd(hnds->target); \ + { \ + try \ + { \ + hnd(hnds->target); \ + } \ + catch (std::exception& err) \ + { \ + ThrowToJava(jniEnv, err.what()); \ + } \ + } \ else \ ThrowOnMissingHandler(jniEnv); \ } @@ -41,7 +50,16 @@ JniHandlers* hnds = reinterpret_cast<JniHandlers*>(envPtr); \ type hnd = hnds->field; \ if (hnd) \ - hnd(hnds->target, __VA_ARGS__); \ + { \ + try \ + { \ + hnd(hnds->target, __VA_ARGS__); \ + } \ + catch (std::exception& err) \ + { \ + ThrowToJava(jniEnv, err.what()); \ + } \ + } \ else \ ThrowOnMissingHandler(jniEnv); \ } @@ -50,7 +68,17 @@ JniHandlers* hnds = reinterpret_cast<JniHandlers*>(envPtr); \ type hnd = hnds->field; \ if (hnd) \ - return hnd(hnds->target, __VA_ARGS__); \ + { \ + try \ + { \ + return hnd(hnds->target, __VA_ARGS__); \ + } \ + catch (std::exception& err) \ + { \ + ThrowToJava(jniEnv, err.what()); \ + return 0; \ + } \ + } \ else \ { \ ThrowOnMissingHandler(jniEnv); \ @@ -358,6 +386,21 @@ namespace ignite return 0; } + /** + * Throw generic exception to Java in case of native exception. As JniContext is not available at + * this point, we have to obtain exception details from scratch. This is not critical from performance + * perspective because such exception is usually denotes fatal condition. + * + * @param env JNI environment. + * @param msg Message. + */ + void ThrowToJava(JNIEnv* env, const char* msg) + { + jclass cls = env->FindClass(C_IGNITE_EXCEPTION); + + env->ThrowNew(cls, msg); + } + char* StringToChars(JNIEnv* env, jstring str, int* len) { if (!str) { *len = 0; @@ -937,12 +980,12 @@ namespace ignite ExceptionCheck(env); } - jobject JniContext::ProcessorProjection(jobject obj) { + jobject JniContext::ProcessorProjection(jobject obj, JniErrorInfo* errInfo) { JNIEnv* env = Attach(); jobject prj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_projection); - ExceptionCheck(env); + ExceptionCheck(env, errInfo); return LocalToGlobal(env, prj); } http://git-wip-us.apache.org/repos/asf/ignite/blob/1410900f/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs index 53dd47a..1d88f76 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs @@ -443,14 +443,15 @@ namespace Apache.Ignite.Core.Impl.Unmanaged { var marsh = grid.Marshaller; - var key = marsh.Unmarshal<object>(inOutStream); - var val = marsh.Unmarshal<object>(inOutStream); var isLocal = inOutStream.ReadBool(); var holder = isLocal ? _handleRegistry.Get<CacheEntryProcessorHolder>(inOutStream.ReadLong(), true) : marsh.Unmarshal<CacheEntryProcessorHolder>(inOutStream); + var key = marsh.Unmarshal<object>(inOutStream); + var val = marsh.Unmarshal<object>(inOutStream); + return holder.Process(key, val, val != null, grid); }
