< prev index next >

modules/javafx.graphics/src/main/native-glass/mac/GlassApplication.m

Print this page

        

@@ -170,20 +170,18 @@
             if ((*env)->ExceptionCheck(env) == JNI_TRUE)
             {
                 (*env)->ExceptionDescribe(env);
                 (*env)->ExceptionClear(env);
             }
-
+            if (runnableClass) {
             jmethodID runMethod = (*env)->GetMethodID(env, runnableClass, "run", "()V");
             if ((*env)->ExceptionCheck(env) == JNI_TRUE)
             {
                 (*env)->ExceptionDescribe(env);
                 (*env)->ExceptionClear(env);
             }
-
-            if ((runnableClass != 0) && (runMethod != 0))
-            {
+                if (runMethod) {
                 (*env)->CallVoidMethod(env, self->jLaunchable, runMethod);
                 if ((*env)->ExceptionCheck(env) == JNI_TRUE)
                 {
                     (*env)->ExceptionDescribe(env);
                     (*env)->ExceptionClear(env);

@@ -213,19 +211,16 @@
                     //                                                          LOG("NSRightMouseDownMask global: %p num %d win %p appwin %p",
                     //                                                              targetWindowForEvent, [incomingEvent windowNumber], window,
                     //                                                              [[NSApplication sharedApplication] mainWindow]);
                     //                                                     }];
                 }
+                } else {
+                    NSLog(@"ERROR: Glass could not find run() method\n");
             }
-            else if (runnableClass == 0)
-            {
+            } else {
                 NSLog(@"ERROR: Glass could not find Runnable class\n");
             }
-            else //if (runMethod == 0)
-            {
-                NSLog(@"ERROR: Glass could not find run() method\n");
-            }
         }
 
         (*env)->CallVoidMethod(env, self->jApplication, [GlassHelper ApplicationNotifyWillFinishLaunchingMethod]);
 
         self->started = YES;

@@ -357,11 +352,15 @@
 
     GET_MAIN_JENV;
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     {
         NSUInteger count = [filenames count];
-        jobjectArray files = (*env)->NewObjectArray(env, (jsize)count, [GlassHelper ClassForName:"java.lang.String" withEnv:env], NULL);
+        jclass stringClass = [GlassHelper ClassForName:"java.lang.String" withEnv:env];
+        if (!stringClass) {
+            return;
+        }
+        jobjectArray files = (*env)->NewObjectArray(env, (jsize)count, stringClass, NULL);
         GLASS_CHECK_EXCEPTION(env);
         for (NSUInteger i=0; i<count; i++)
         {
             NSString *file = [filenames objectAtIndex:i];
             if (file != nil)
< prev index next >