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

javah generates error for class that "extends Throwable" (ref: 4136344)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.7
    • hotspot
    • x86
    • windows_nt



      Name: krT82822 Date: 06/04/99


      [Note: am filing new public bug # for this -- though it's equivalent to internal bug # 4136344. All other public bug#'s for this problem appear to have
      been closed as dupes of 4136344. We need a public # for user tracking purposes. Am filing as "runtime" vs. "javah", per the recommendations
      inside bug # 4136344. -kevin.ryan@eng, 6/4/99]

      ---------------------------
      1. To reproduce:
      javah -jni com.lhs.questsdk.JQStatus

      2. Source code:
      ///////////////////////////////////////////////////////////////////////////
      // //
      // (c) Copyright 1999 Lernout & Hauspie Speech Products, N.V. //
      // Quest Software Development Kit (R) //
      // //
      // This work is protected by United States and international copyright //
      // laws and contains certain trade secret information. All use of this //
      // work is governed by the terms of agreements between Lernout & Hauspie //
      // Speech Products, N.V. and its licensees or potential licensees. //
      // Disclosure or disassembly of the contents of embodied programs or //
      // algorithms is prohibited. All rights are reserved worldwide. //
      // //
      ///////////////////////////////////////////////////////////////////////////
      package com.lhs.questsdk;


      /**
       * The JQStatus.java is the declaration file for the Quest JQStatus Java wrapper class.
       * The JQStatus class creates a Quest Status object that contains the status of any
       * function invoked for a Quest class. Each time you invoke a function, the last recorded
       * status will be overwritten. To perform error checking on Quest Class functions,
       * use the JQStatus class. This class corresponds to the QStatus class in the C++ API. Please
       * refer to the Quest SDK User's Guide for detailed functional information.
       */
      public class JQStatus extends Throwable
      {
      //pointer to corresponding C++ object
      private long m_lStatusPtr;

      //Native methods
      private native long CreateStatus();

         // Destructor.
      private native void DeleteStatus (long lStatusPtr);

         // Returns TRUE if an error or warning has been recorded in the QStatus
         // object.
      private native boolean isError(long lStatusPtr) ;

         // Sets the error code or warning in the QStatus object to the given
         // value.
      private native void SetErrorCode(long lStatusPtr, int nErr);

         // Sets the error code or warning in the QStatus object to the given
         // value, and also allows you to set a source file name and line number
         // where the error occurred. These can later be retrieved using the
         // GetSourceFileName() and GetSourceLineNumber() methods.
      private native void SetErrorCode(long lStatusPtr, int nErr,String pSourceFile, int nLineNumber);

         // Returns the error code currently recorded in the QStatus object.
      private native int GetErrorCode(long lStatusPtr) ;

         // Returns a pointer to the Quest Knowledge Map that generated the most
         // recent error in the QStatus object.
      private native long GetMapper(long lStatusPtr) ;

         // Returns the name of the source file in which the error occurred.
      private native String GetSourceFileName(long lStatusPtr) ;

         // Returns the line number in which the error occurred.
      private native int GetSourceLineNumber(long lStatusPtr) ;


      // API methods
         /**
          * Constructs JQStatus. JQStatus creates a Quest Status object that contains
          * the status of any function invoked for a Quest class. Each time you invoke a function,
          * the last recorded status will be overwritten.
          */
      public JQStatus() //throws Exception
      {
      m_lStatusPtr = CreateStatus();
         /*
      if (m_lStatusPtr == 0)
      {
      throw new Exception ("Error creating status object.");
      }
      */
      }

         /**
          * Constructor. Used internally.
          */
      public JQStatus (long lStatusPtr)
      {
      m_lStatusPtr = lStatusPtr;
      }

      /**
      * Copy constructor.
      * @param other The object to copy.
            */
      public JQStatus (JQStatus other)
      {
      m_lStatusPtr = other.GetPtr();
      }

         /**
          * Destructor.
          */
      protected void Invalidate()
      {
      DeleteStatus (m_lStatusPtr);
      }

      /**
      * Returns true if an error or warning has been recorded in the QStatus object
      * @return Returns true if there was an error, false otherwise.
      */
      public boolean isError()
      {
      return isError (m_lStatusPtr);
      }

      /**
      * Sets the error code or warning in the QStatus object to the given value.
      * @param iErr A status code, as defined in the JQErrors interface.
      */
      public void SetErrorCode(int iErr)
      {
      SetErrorCode (m_lStatusPtr, iErr);
      }

      /**
      * Sets the error code or warning in the QStatus object to the given value, and also allows you to set a source file name and line number
      * where the error occurred. These can later be retrieved using the GetSourceFileName() and GetSourceLineNumber() methods.
      * @param iErr A status code, as defined in the JQErrors interface.
      * @param sSourceFile Name of file where the error occurred.
      * @param iSourceLine Line number where the error occurred.
      */
      public void SetErrorCode(int iErr, String sSourceFile, int iSourceLine)
      {
      SetErrorCode (m_lStatusPtr, iErr, sSourceFile, iSourceLine);
      }

      /**
      * Returns the error code currently recorded in the QStatus object.
      * @return A status code, as defined in the JQErrors interface.
      */
      public int GetErrorCode()
      {
      return GetErrorCode (m_lStatusPtr);
      }

      /**
           * Returns the Quest Knowledge Map object that generated the most recent error in the QStatus object.
           * @return The knowledge map object that generated the error in this status object.
           */
          public JQKMap GetMapper() throws NullPointerException
      {
      long lMapPtr = GetMapper (m_lStatusPtr);

      if ( lMapPtr == 0)
      {
      NullPointerException foo = new NullPointerException();
      throw foo;
      }
      //NOTE: I had to allocate a JQKMBase object since
      // the JQKMap class is abstract.
      return (new JQKMBase (lMapPtr));
      }

      /**
      * Returns the name of the source file in which the error occurred.
      * @return Name of the source file where the error occurred.
      */
      public String GetSourceFileName()
      {
      return GetSourceFileName(m_lStatusPtr);
      }

         /**
          * Returns the line number where the error occurred.
          * @return Line number where the error occurred.
          */
      public int GetSourceLineNumber()
      {
      return GetSourceLineNumber(m_lStatusPtr);
      }

      /**
      * used internally.
      */
      public long GetPtr()
      {
      return m_lStatusPtr;
      }
      }

      3. Error messages:
      Signalled error "java/lang/ClassFormatError" with detail "Bad interface index"
      Signalled error "java/lang/NoClassDefFoundError" with detail "java/lang/Throwable"
      com/lhs/questsdk/JQStatus: no such class

      4. Trace info:
      N/A

      5. Version info:
      java version "1.1.7B"
      java full version "JDK1.1.7U"
      javah version "1.1.7B"

      6. Additional info:
      I've got the JDK 1.1.7B's classes.zip in my path, I peeked in classes.zip and Throwable.class is there under java\lang.

      Tried adding "import java.lang.*" to the top of JQStatus.java; compiler (MSVJ) complains that the java.lang package is implicitly imported.
      (Review ID: 83841)
      ======================================================================

            apalanissunw Anand Palaniswamy (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: