Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolved issue #20 - Hidden JSinstance info ... raised #25

Merged
merged 1 commit into from
Feb 20, 2015
Merged
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
10 changes: 6 additions & 4 deletions src/jni/MetadataNode.cpp
Original file line number Diff line number Diff line change
@@ -1344,11 +1344,13 @@ void MetadataNode::SetterCallback(Local<String> property, Local<Value> value, co
{
if(first.isFinal)
{
Isolate *isolate(Isolate::GetCurrent());
Handle<String> exceptionMessage = ConvertToV8String("You are trying to SET a final field! Final fields can only be read.");
Local<Value> IllegalAccessException(exceptionMessage);
stringstream ss;
ss << "You are trying to SET \"" << first.name << "\" which is a final field! Final fields can only be read.";
string exceptionMessage = ss.str();

isolate->ThrowException(IllegalAccessException);
Isolate *isolate(Isolate::GetCurrent());
isolate->ThrowException(v8::Exception::Error((ConvertToV8String(exceptionMessage))));
return;
}
s_setJavaField(thiz, value, node->m_name, first.name, first.sig, first.declaringType, first.isStatic);

10 changes: 10 additions & 0 deletions src/jni/NativeScriptRuntime.cpp
Original file line number Diff line number Diff line change
@@ -186,6 +186,16 @@ void NativeScriptRuntime::CallJavaMethod(const Handle<Object>& caller, const str
if (!isStatic)
{
callerJavaObject = objectManager->GetJavaObjectByJsObject(caller);
if(callerJavaObject == nullptr)
{
Isolate *isolate = Isolate::GetCurrent();
stringstream ss;
ss << "No java object found on which to call \"" << methodName << "\" method. It is possible your Javascript object is not linked with the corresponding Java class. Try passing context(this) to the constructor function.";
string exceptionMessage = ss.str();
isolate->ThrowException(v8::Exception::ReferenceError(ConvertToV8String(exceptionMessage)));
return;
}

if (isSuper)
{
clazz = env.FindClass(className);