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

Error while executing a JNI program. ["...D4"/win32]

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.4.0
    • hotspot
    • generic
    • generic

      utes(GetFileAttributes.java:6)
              at FileAttributes.<init>(FileAttributes.java:31)
              at GetAttributes.main(GetAttributes.java:6)

      Dynamic libraries:
      0x00400000 - 0x00405000 c:\jdk1.4\bin\java.exe
      0x77F80000 - 0x77FFA000 C:\WINNT\System32\ntdll.dll
      0x77DB0000 - 0x77E0A000 C:\WINNT\system32\ADVAPI32.dll
      0x77E80000 - 0x77F35000 C:\WINNT\system32\KERNEL32.DLL
      0x77D40000 - 0x77DB0000 C:\WINNT\system32\RPCRT4.DLL
      0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
      0x6D400000 - 0x6D503000 c:\jdk1.4\jre\bin\hotspot\jvm.dll
      0x77E10000 - 0x77E74000 C:\WINNT\system32\USER32.dll
      0x77F40000 - 0x77F7C000 C:\WINNT\system32\GDI32.DLL
      0x77570000 - 0x775A0000 C:\WINNT\System32\WINMM.dll
      0x75E60000 - 0x75E7A000 C:\WINNT\System32\IMM32.DLL
      0x6D200000 - 0x6D207000 c:\jdk1.4\jre\bin\hpi.dll
      0x6D3D0000 - 0x6D3DD000 c:\jdk1.4\jre\bin\verify.dll
      0x6D240000 - 0x6D255000 c:\jdk1.4\jre\bin\java.dll
      0x6D3F0000 - 0x6D3FD000 c:\jdk1.4\jre\bin\zip.dll
      0x10000000 - 0x10149000 C:\JNI\120762\FillAttribImpl.dll
      0x77B50000 - 0x77BD9000 C:\WINNT\system32\COMCTL32.dll
      0x77800000 - 0x7781D000 C:\WINNT\System32\WINSPOOL.DRV
      0x76B30000 - 0x76B6E000 C:\WINNT\system32\comdlg32.dll
      0x77C70000 - 0x77CBA000 C:\WINNT\system32\SHLWAPI.DLL
      0x69800000 - 0x69A42000 C:\WINNT\system32\SHELL32.DLL
      0x77920000 - 0x77942000 C:\WINNT\system32\imagehlp.dll
      0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
      0x690A0000 - 0x690AB000 C:\WINNT\System32\PSAPI.DLL

      Local Time = Thu Jul 26 13:49:41 2001
      Elapsed Time = 0
      #
      # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
      # Error ID : 4F530E43505002D7
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Java VM: Java HotSpot(TM) Client VM (1.4.0-beta-b65 mixed mode)
      #
      # An error report file has been saved as hs_err_pid288.log.
      # Please refer to the file for further information.
      #
      (Review ID: 120762)
      ======================================================================


      Name: ddT132432 Date: 07/26/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      I was trying to execute the following Program that uses jni.

      public class GetAttributes
      {
      public static void main ( String [] args )
      {
      String strfpath = "D:\\Doc1.doc";
      FileAttributes objFileAttributes = new FileAttributes(strfpath );
      String strcdate = objFileAttributes.getCreateDate();
      System.out.println("The Create Date is " + strcdate);

      }
      }

      class GetFileAttributes
      {
      void fillAttributes( String strFpath, FileAttributes objFileAttributes )
      {
      GetFileAttributes objGetFileAttributes = new GetFileAttributes();
      objGetFileAttributes.fillAllAttributes( objFileAttributes,strFpath);

      }
      private native void fillAllAttributes( FileAttributes objFileAttributes,String strFlPath );
      static
      {
      System.loadLibrary( "FillAttribImpl" );
      }
      }

      class FileAttributes
      {
      // private String strAbsFilePath; //The Absolute Path of the File
      private int nCreateDate; //File Creation Day
      private int nCreateMonth;//File Creation Month
      private int nCreateYear;//File Creation Year
      private int nCreateHour;//File Creation Hour
      private int nCreateMinutes;//File Creation Minutes
      private int nCreateSeconds;//File Creation Seconds
      private int nModifiedDate;//File ModiFication Day
      private int nModifiedMonth;//File ModiFication Month
      private int nModifiedYear;//File ModiFication Year
      private int nModifiedHour;//File ModiFication Hours
      private int nModifiedMinutes;//File ModiFication Minutes
      private int nModifiedSeconds;//File ModiFication Seconds
      private int nIsReadOnly;//Whether File is Readonly (true= File is readonly false= File is not readonly)
      private int nIsHidden;//Whether File is Hidden (1= File is Hidden 2 = File is not Hidden 3 = Error )
      private int nIsArchive;//Whether File Archivebit is set (true= File Archivebit is set false= File Archivebit is not set)
      private int nIsSystem;//Whether File is System File (true= File is System File false= File is not System File)
      private int nIsCompressed;//Whether File is Compressed or not (true = file is compressed false= file is not compressed)
      private int nAccessedDate;// File last Accessed Day
      private int nAccessedMonth;// File last Accessed Month
      private int nAccessedYear;// File last Accessed Year
      private int nAccessedHour;// File last Accessed Hours
      private int nAccessedMinutes;// File last Accessed Minutes
      private int nAccessedSeconds;// File last Accessed Seconds

      FileAttributes ( String strflPath )
      {
      GetFileAttributes obj1GetFileAttributes = new GetFileAttributes();
      obj1GetFileAttributes.fillAttributes( strflPath, this );

      }
      long FillCreateDate( int nCreateDate, int nCreateMonth,int nCreateYear ,int nCreateHour, int nCreateMinutes, int nCreateSeconds)
      {
      try
      {
      this.nCreateDate = nCreateDate;
      this.nCreateMonth = nCreateMonth;
      this.nCreateYear = nCreateYear;
      this.nCreateHour = nCreateHour;
      this.nCreateMinutes = nCreateMinutes;
      this.nCreateSeconds = nCreateSeconds;
      return 0;
      }
      catch(Exception e)
      {
      return 1;
      }
      }

      long FillModifiedDate( int nModifiedDate, int nModifiedMonth, int nModifiedYear ,int nModifiedHour, int nModifiedMinutes, int nModifiedSeconds)
      {
      try
      {
      this.nModifiedDate = nModifiedDate;
      this.nModifiedMonth = nModifiedMonth;
      this.nModifiedYear = nModifiedYear;
      this.nModifiedHour = nModifiedHour;
      this.nModifiedMinutes = nModifiedMinutes;
      this.nModifiedSeconds = nModifiedSeconds;
      return 0;
      }
      catch(Exception e)
      {
      return 1;
      }
      }

      long FillAccessedDate( int nAccessedDate, int nAccessedMonth, int nAccessedYear ,int nAccessedHour, int nAccessedMinutes, int nAccessedSeconds)
      {
      try
      {
      this.nAccessedDate = nAccessedDate;
      this.nAccessedMonth = nAccessedMonth;
      this.nAccessedYear = nAccessedYear;
      this.nAccessedHour = nAccessedHour;
      this.nAccessedMinutes = nAccessedMinutes;
      this.nAccessedSeconds = nAccessedSeconds;
      return 0;
      }
      catch(Exception e)
      {
      return 1;
      }
      }

      long FillFileProperties(int nIsReadOnly,int nIsHidden,int nIsArchive ,int nIsSystem, int nIsCompressed)

      {
      try
      {
      this.nIsReadOnly = nIsReadOnly;
      this.nIsHidden = nIsHidden;
      this.nIsArchive = nIsArchive;
      this.nIsSystem = nIsSystem;
      this.nIsCompressed = nIsCompressed;
      return 0;
      }
      catch(Exception e )
      {
      return 1;
      }
      }
      String getCreateDate()
      {
      String strCreateDate;
      try
      {
      strCreateDate = String.valueOf( nCreateYear ) +"/" + String.valueOf( nCreateMonth ) +"/"+ String.valueOf( nCreateDate ) +" "+ String.valueOf( nCreateHour )+
      ":"+ String.valueOf( nCreateMinutes )+":"+ String.valueOf( nCreateSeconds );
      return strCreateDate;
      }
      catch(Exception e)
      {
      return null;
      }
      }
      String getModifiedDate()
      {
      String strModifiedDate;
      try
      {
      strModifiedDate = String.valueOf( nModifiedYear ) +"/"+ String.valueOf( nModifiedMonth ) +"/"+ String.valueOf( nModifiedDate )+
      " "+ String.valueOf( nModifiedHour ) +":"+ String.valueOf(nModifiedMinutes ) +":"+ String.valueOf( nModifiedSeconds );
      return strModifiedDate;
      }
      catch(Exception e)
      {
      return null;
      }
      }
      String getAccessedDate()
      {
      String strAccessedDate;
      try
      {
      strAccessedDate = String.valueOf( nAccessedYear ) +"/"+ String.valueOf( nAccessedMonth ) +"/"+
      String.valueOf( nAccessedDate )+" "+ String.valueOf( nAccessedHour ) +":"+ String.valueOf(nAccessedMinutes ) +":"+ String.valueOf( nAccessedSeconds );
      return strAccessedDate;
      }
      catch(Exception e)
      {
      return null;
      }
      }

      boolean getIsReadOnly( )
      {
      if( nIsReadOnly == 1 )
      {
      return true;
      }
      else
      return false;
      }

      boolean getIsHidden()
      {
      if( nIsHidden == 1 )
      {
      return true;
      }
      else
      return false;
      }

      boolean getIsArchive()
      {
      if( nIsArchive == 1 )
      {
      return true;
      }
      else
      return false;
      }

      boolean getIsSystem()
      {
      if( nIsSystem == 1 )
      {
      return true;
      }
      else
      return false;
      }

      boolean getIsCompressed()
      {
      if( nIsCompressed == 1 )
      {
      return true;
      }
      else
      return false;
      }

      }

      I compiled it created the header file Using javah utility which gave me
      GetFileAttributes.h file which has the following contents.

      /* DO NOT EDIT THIS FILE - it is machine generated */
      #include <jni.h>
      /* Header for class GetFileAttributes */

      #ifndef _Included_GetFileAttributes
      #define _Included_GetFileAttributes
      #ifdef __cplusplus
      extern "C" {
      #endif
      /*
       * Class: GetFileAttributes
       * Method: fillAllAttributes
       * Signature: (LFileAttributes;Ljava/lang/String;)V
       */
      JNIEXPORT void JNICALL Java_GetFileAttributes_fillAllAttributes
        (JNIEnv *, jobject, jobject, jstring);

      #ifdef __cplusplus
      }
      #endif
      #endif


      then using this file i created a dll FillAttribImpl.dll
      the following the source file dll.

      //#include< windows.h >
      #include "D:\Dinesh\java\GetFileAttributes\GetFileAttributes.h"
      # include <sys/types.h>
      # include <sys/stat.h>
      # include <time.h>
      # include <afx.h>

      BOOL APIENTRY DLLMAIN ( HANDLE hModule , DWORD dwReason , void** lpReserved )
      {
      return true ;
      }

      JNIEXPORT void JNICALL
      Java_GetFileAttributes_fillAllAttributes( JNIEnv *jEnv , jobject this1 ,
      jobject jobjFlAttributes , jstring jstrFlPath )
      {

      const char *FlPath;
      int intCreateDate;
      int intCreateMonth;
      int intCreateYear;
      int intCreateHour;
      int intCreateMinutes;
      int intCreateSeconds;
      int intModifiedDate;
      int intModifiedMonth;
      int intModifiedYear;
      int intModifiedHour;
      int intModifiedMinutes;
      int intModifiedSeconds;
      int intIsReadOnly;
      int intIsHidden;
      int intIsArchive;
      int intIsSystem;
      // int intIsDirectory;
      int intIsCompressed;
      int intAccessedDate;
      int intAccessedMonth;
      int intAccessedYear;
      int intAccessedHour;
      int intAccessedMinutes;
      int intAccessedSeconds;
      CTime date;
      CFileFind finder;
      BOOL blnGetFile;
      jclass cls;
      // jfieldID fid;
      jmethodID mid;
      FlPath = jEnv->GetStringUTFChars ( jstrFlPath ,0 );
      cls = jEnv->GetObjectClass(jobjFlAttributes);




      blnGetFile = finder.FindFile( FlPath );

      while (blnGetFile)
         {
            blnGetFile = finder.FindNextFile();
      if ( finder.IsSystem())
      intIsSystem = 1;
      else
      intIsSystem = 2;

      if ( finder.IsHidden())
      intIsHidden = 1;
      else
      intIsHidden = 2;

      if ( finder.IsReadOnly())
      intIsReadOnly = 1;
      else
      intIsReadOnly = 2;

      if ( finder.IsArchived())
      intIsArchive = 1;
      else
      intIsArchive = 2;

      if ( finder.IsCompressed())
      intIsCompressed = 1;
      else
      intIsCompressed = 2;


            
            
            if (finder.GetCreationTime(date))
            {
               intCreateDate = date.GetDay();
      // cout<<" the creation day value is : "<<intCreateDate<<endl;
      intCreateMonth = date.GetMonth();
      // cout<<" the creation Month value is : "<<intCreateMonth<<endl;
      intCreateYear = date.GetYear();
      // cout<<" the creation Year value is : "<<intCreateYear<<endl;
      intCreateHour = date.GetHour();
      // cout<<" the creation Hour value is : "<<intCreateHour<<endl;
      intCreateMinutes = date.GetMinute();
      // cout<<" the creation Minutes value
      is : "<<intCreateMinutes<<endl;
      intCreateSeconds = date.GetSecond();
      // cout<<" the creation seconds value
      is : "<<intCreateSeconds<<endl;
      }


      if (finder.GetLastAccessTime(date))
            {

               intAccessedDate = date.GetDay();
      // cout<<" the last access day value
      is : "<<intAccessedDate<<endl;
      intAccessedMonth = date.GetMonth();
      // cout<<" the last access Month value
      is : "<<intAccessedMonth<<endl;
      intAccessedYear = date.GetYear();
      // cout<<" the last access Year value
      is : "<<intAccessedYear<<endl;
      intAccessedHour = date.GetHour();
      // cout<<" the last access Hour value
      is : "<<intAccessedHour<<endl;
      intAccessedMinutes = date.GetMinute();
      // cout<<" the last access Minutes value
      is : "<<intAccessedMinutes<<endl;
      intAccessedSeconds = date.GetSecond();
      // cout<<" the last access seconds value
      is : "<<intAccessedSeconds<<endl;
      }


      if (finder.GetLastWriteTime(date))
            {

               intModifiedDate = date.GetDay();
      // cout<<" the modi day value is : "<<intModifiedDate<<endl;
      intModifiedMonth = date.GetMonth();
      // cout<<" the modi Month value is : "<<intModifiedMonth<<endl;
      intModifiedYear = date.GetYear();
      // cout<<" the modi Year value is : "<<intModifiedYear<<endl;
      intModifiedHour = date.GetHour();
      // cout<<" the modi Hour value is : "<<intModifiedHour<<endl;
      intModifiedMinutes = date.GetMinute();
      // cout<<" the modi Minutes value
      is : "<<intModifiedMinutes<<endl;
      intModifiedSeconds = date.GetSecond();
      // cout<<" the modi seconds value
      is : "<<intModifiedSeconds<<endl;
      }
      mid = jEnv->GetMethodID(cls,"FillCreateDate", "()V");
      jEnv->CallVoidMethod(jobjFlAttributes, mid, intCreateDate,
      intCreateMonth, intCreateYear
      , intCreateHour, intCreateMinutes,
      intCreateSeconds);

      mid = jEnv->GetMethodID(cls,"FillModifiedDate", "()V");
      jEnv->CallVoidMethod(jobjFlAttributes, mid, intModifiedDate,
      intModifiedMonth, intModifiedYear
      , intModifiedHour, intModifiedMinutes,
      intModifiedSeconds);

      mid = jEnv->GetMethodID(cls,"FillAccessedDate", "()V");
      jEnv->CallVoidMethod(jobjFlAttributes, mid, intAccessedDate,
      intAccessedMonth, intAccessedYear
      , intAccessedHour, intAccessedMinutes,
      intAccessedSeconds);

      mid = jEnv->GetMethodID(cls,"FillFileProperties", "()V");
      jEnv->CallVoidMethod(jobjFlAttributes, mid, intIsReadOnly,
      intIsHidden, intIsArchive
      , intIsSystem,
      intIsCompressed);
      }
      }


      after that when i executed the program it gave me the following error.

      #
      # HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Error ID: 4F533F57494E13120E43505002D4
      #

      please help me solve this error . is there any problem int the program.

      Dinesh.
      ===============================


      JDK1.3.0_02
      ----------------
      #
      # HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Error ID: 4F533F57494E13120E43505002D4
      #

      abnormal program termination


      JDK1.3.1
      -----------------

      Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6d4386fc
      Function name=(N/A)
      Library=c:\jdk1.3.1\jre\bin\hotspot\jvm.dll

      NOTE: We are unable to locate the function name symbol for the error
            just occurred. Please refer to release documentation for possible
            reason and solutions.



      Current Java thread:
              at GetFileAttributes.fillAllAttributes(Native Method)
              at GetFileAttributes.fillAttributes(GetFileAttributes.java:6)
              at FileAttributes.<init>(FileAttributes.java:31)
              at GetAttributes.main(GetAttributes.java:6)

      Dynamic libraries:
      0x00400000 - 0x00405000 c:\jdk1.3.1\bin\java.exe
      0x77F80000 - 0x77FFA000 C:\WINNT\System32\ntdll.dll
      0x77DB0000 - 0x77E0A000 C:\WINNT\system32\ADVAPI32.dll
      0x77E80000 - 0x77F35000 C:\WINNT\system32\KERNEL32.DLL
      0x77D40000 - 0x77DB0000 C:\WINNT\system32\RPCRT4.DLL
      0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
      0x6D420000 - 0x6D4EF000 c:\jdk1.3.1\jre\bin\hotspot\jvm.dll
      0x77E10000 - 0x77E74000 C:\WINNT\system32\USER32.dll
      0x77F40000 - 0x77F7C000 C:\WINNT\system32\GDI32.DLL
      0x77570000 - 0x775A0000 C:\WINNT\System32\WINMM.dll
      0x75E60000 - 0x75E7A000 C:\WINNT\System32\IMM32.DLL
      0x6D220000 - 0x6D227000 c:\jdk1.3.1\jre\bin\hpi.dll
      0x6D3B0000 - 0x6D3BD000 c:\jdk1.3.1\jre\bin\verify.dll
      0x6D250000 - 0x6D266000 c:\jdk1.3.1\jre\bin\java.dll
      0x6D3C0000 - 0x6D3CD000 c:\jdk1.3.1\jre\bin\zip.dll
      0x10000000 - 0x10149000 C:\JNI\120762\FillAttribImpl.dll
      0x77B50000 - 0x77BD9000 C:\WINNT\system32\COMCTL32.dll
      0x77800000 - 0x7781D000 C:\WINNT\System32\WINSPOOL.DRV
      0x76B30000 - 0x76B6E000 C:\WINNT\system32\comdlg32.dll
      0x77C70000 - 0x77CBA000 C:\WINNT\system32\SHLWAPI.DLL
      0x69800000 - 0x69A42000 C:\WINNT\system32\SHELL32.DLL
      0x77920000 - 0x77942000 C:\WINNT\system32\imagehlp.dll
      0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
      0x690A0000 - 0x690AB000 C:\WINNT\System32\PSAPI.DLL

      Local Time = Thu Jul 26 13:49:33 2001
      Elapsed Time = 0
      #
      # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
      # Error ID : 4F530E43505002CC
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Java VM: Java HotSpot(TM) Client VM (1.3.1-rc1-b21 mixed mode)
      #
      # An error report file has been saved as hs_err_pid424.log.
      # Please refer to the file for further information.
      #


      JDK1.4-beta
      --------------

      Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D41F84C
      Function=JVM_CompilerCommand+0x4B38
      Library=c:\jdk1.4\jre\bin\hotspot\jvm.dll

      Current Java thread:
              at GetFileAttributes.fillAllAttributes(Native Method)
              at GetFileAttributes.fillAttrib

            collins Gary Collins (Inactive)
            ddressersunw Daniel Dresser (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: