Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4038066

Core dump (segmentation fault) using NewStringUTF

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P2 P2
    • None
    • 1.1
    • hotspot
    • sparc
    • solaris_2.5.1



      Name: mc57594 Date: 03/11/97

      (files attached)

      I have four peices of code -- ServerManager.java, AppServer.java,
      PrintString.java/PrintStringImp.c, and client.java which do the
      following:

      ServerManager waits on a port to start an AppServer at client request.

      AppServer extends Thread--connects to client and instanciates a
      PrintString object.

      PrintStringImp implements the native methods to print a jstring
      that is passed to it (no problem) or to put the string into a local
      char array and then return the same string using NewStringUTF
      (this is where the problem lies.)

      client takes input from stdio and sends it to the AppServer which
      passes it to the native code and returns the results.

      If I compile this under NT 3.51 using Java 1.1 and JNI, there is
      no problem. If I compile and run under Solaris (gcc 2.5.8) the
      program core dumps when returning the string. To compile, I noticed
      a difference in the NewStringUTF --

         Under NT: NewStringUTF(env, str, len)
        
         Under Solaris: NewStringUTF(env, str)

      as defined in the jni.h file.

      I can supply the code if you need it (send me email,
      ###@###.###)




      company - NRL , email - ###@###.###
      ======================================================================

            sliangsunw Sheng Liang (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: