Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions jnipp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,10 @@ namespace jni
{
jfieldID id = env()->GetFieldID(getHandle(), name, signature);

if (id == nullptr)
if (id == nullptr) {
env()->ExceptionClear();
throw NameResolutionException(name);
}

return id;
}
Expand All @@ -684,8 +686,10 @@ namespace jni
{
jfieldID id = env()->GetStaticFieldID(getHandle(), name, signature);

if (id == nullptr)
if (id == nullptr) {
env()->ExceptionClear();
throw NameResolutionException(name);
}

return id;
}
Expand All @@ -694,8 +698,10 @@ namespace jni
{
jmethodID id = env()->GetMethodID(getHandle(), name, signature);

if (id == nullptr)
if (id == nullptr) {
env()->ExceptionClear();
throw NameResolutionException(name);
}

return id;
}
Expand All @@ -709,8 +715,10 @@ namespace jni
if (sig != nullptr)
return getMethod(std::string(nameAndSignature, sig - nameAndSignature).c_str(), sig);

if (id == nullptr)
if (id == nullptr) {
env()->ExceptionClear();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - is it possible to get in without setting env?

throw NameResolutionException(nameAndSignature);
}

return id;
}
Expand All @@ -719,8 +727,10 @@ namespace jni
{
jmethodID id = env()->GetStaticMethodID(getHandle(), name, signature);

if (id == nullptr)
if (id == nullptr) {
env()->ExceptionClear();
throw NameResolutionException(name);
}

return id;
}
Expand All @@ -733,8 +743,10 @@ namespace jni
if (sig != nullptr)
return getStaticMethod(std::string(nameAndSignature, sig - nameAndSignature).c_str(), sig);

if (id == nullptr)
if (id == nullptr) {
env()->ExceptionClear();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ever possible to get in here when there is no env set yet?

throw NameResolutionException(nameAndSignature);
}

return id;
}
Expand Down