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

redundant calls to SignalError result in misleading error messages

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2alpha2
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Description

      It looks like some of the calls
      > to function newobject() call SignalError() if newobject() returns a zero.
      > However, this is redundant because newobject() will have already called
      > SignalError() if it fails:
      >
      > Here is code from interpreter.c that has the redundant call:
      >
      > 382 /* Allocate the object and call the constructor */
      > 383 if ((obj = newobject(cb, 0, ee)) == 0) {
      > 384 SignalError(0, JAVAPKG "OutOfMemoryError", 0);
      > 385 return 0;
      >
      >
      > The redundant call can be a problem because it can result in the wrong
      > exception getting thrown. SignalError calls FindClassFromClass() to find the
      > class for the exception. However, if an exception has already occurred, then
      > FindClassFromClass() will fail and SignalError() will throw an
      > IEXC_NoClassDefinitionFound exception, instead of the requested
      > OutofMemoryError exception.
      >
      >
      > Here is the code in SignalError() that calls FindClassFromClass():
      >
      > 687 if ((cb = FindClassFromClass(ee, ename, TRUE, NULL)) == 0 &&
      > 688 (cb = FindClassFromClass(ee, JAVAPKG "UnknownError", TRUE, NULL)) == 0) {
      > 689 #ifndef TRIMMED
      > 690 if (ee->current_frame) {
      > 691 pc2string(ee->current_frame->lastpc,
      > 692 ee->current_frame->current_method,
      > 693 where, where + sizeof where);
      > 694 jio_fprintf(stderr, "Class missing for error: %s at %s\n", ename, where);
      > 695 } else {
      > 696 jio_fprintf(stderr, "Class missing for error: %s\n", ename);
      > 697 }
      > 698 #endif
      > 699 exceptionThrow(ee, exceptionInternalObject(IEXC_NoClassDefinitionFound));
      > 700 return;
      >
      >
      > Here is the code in FindClassFromClass() that causes it to return zero if an
      > exception has already occurred:
      >
      > 955 if (cb && !exceptionOccurred(ee ? ee : EE()))
      > 956 return InitializeAndResolveClass(cb, resolve);
      > 957 }
      > 958 return 0;
      >

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sliangsunw Sheng Liang (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: