title: JNI fatal error when calling GetStringChars
body: <p>I'm trying to write a native function for  </p>
  
  <pre><code>protected static native boolean _connect(String user, String password,
                                           String machine) throws Exception;
  </code></pre>
  
  <p>The implementation goes like this:  </p>
  
  <pre><code>JNIEXPORT jboolean JNICALL Java_jniprint__1connect
  (JNIEnv *env, jclass clazz, jstring _machine, jstring _user, jstring _pass)
  {
  cout &lt;&lt; "Connecting !!!!!!!!" &lt;&lt; endl;
  const jchar *machine = env-&gt;GetStringChars(_machine, JNI_FALSE);    
  cout &lt;&lt; "after machine!!!!!!!!" &lt;&lt; endl;
  return JNI_FALSE;
  }
  </code></pre>
  
  <p>It works perfectly when the _machine parameter is not null, when it is null - jvm crashes violently</p>
  
  <pre><code> A fatal error has been detected by the Java Runtime Environment:  
  
    EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d96019f, pid=16444, tid=10744  
  
   JRE version: 6.0_30-b12  
   Java VM: Java HotSpot(TM) Client VM (20.5-b03 mixed mode, sharing windows-x86 )  
   Problematic frame:  
   V  [jvm.dll+0xa019f]  
  </code></pre>
  
  <p>...</p>
  
  <p>Whats going on?</p>