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

ORB.create_value_tc() throws NullPointerException when concrete base is null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • other-libs
    • generic
    • generic



      Name: dc32491 Date: 03/28/2001


      The problem happens with both Java 1.2.2 and Java 1.3.0 on both NT and Solaris.

      JDK ORB.create_value_tc() throws a NullPointerException when the concrete base
      parameter is passed a null. The problem happens with both applets and
      applications. It is platform & JDK version independent (it happens on both NT
      and Solaris, with both JDK1.2.2 and JDK1.3.0).

      Here is a simple test case:

      ======== ResultObject.java =============

      import java.util.*;
      import java.io.*;
      import java.text.*;

      public class ResultObject implements Serializable
      {
           public ResultObject()
           {
           }
      }

      ========= Tester.java ======================

      public class Tester extends java.applet.Applet{
        public void init() {
          try {
            System.out.println("Initializing ORB in main");
            org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(this,null);
            org.omg.CORBA.TypeCode tc =
      orb.create_value_tc("RMI:ResultObject:71DA8BE7F971128","ResultObject",(short)0,n
      ull, new org.omg.CORBA.ValueMember[0]);
          } catch(Exception e) {
            e.printStackTrace();
          }
        }

        public static void main(String [] args) {
          try {
            System.out.println("Initializing ORB in main");
            org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null);
            org.omg.CORBA.TypeCode tc =
      orb.create_value_tc("RMI:ResultObject:71DA8BE7F971128","ResultObject",(short)0,n
      ull, new org.omg.CORBA.ValueMember[0]);
          } catch(Exception e) {
            e.printStackTrace();
          }
        }
      }

      =================== tester.html =======================

      Test Applet
      <br>
      open java console to see results

      <applet archive="" code="Tester.class" width="400" height="30">

      </applet>


      Steps to reproduce:
      1. compile the above two java files:
           javac ResultObject.java Tester.java
      2. run the application:
           java Tester
         and got the following exception stack trace:
         
         Initializing ORB in main
         java.lang.NullPointerException
      at com.sun.CORBA.idl.TypeCodeImpl.<init>(TypeCodeImpl.java:492)
      at com.sun.CORBA.idl.TypeCodeImpl.convertToNative(TypeCodeImpl.java:873)
      at com.sun.CORBA.idl.TypeCodeImpl.<init>(TypeCodeImpl.java:688)
      at com.sun.CORBA.idl.ORB.create_value_tc(ORB.java:1082)
      at Tester.main(Tester.java:17)

      3. run the applets with jdk1.2.2 or jdk1.3.0 appletviewer:
            appletviewer http://&lt;host&gt;:&lt;port&gt;/tester.html
         and got the following output:

         Initializing ORB in main
         java.lang.NullPointerException
      at
      com.sun.corba.se.internal.corba.TypeCodeImpl.<init>(TypeCodeImpl.java:495)
      at
      com.sun.corba.se.internal.corba.TypeCodeImpl.convertToNative(TypeCodeImpl.java:8
      85)
      at
      com.sun.corba.se.internal.corba.TypeCodeImpl.<init>(TypeCodeImpl.java:690)
      at com.sun.corba.se.internal.corba.ORB.create_value_tc(ORB.java:1303)
      at Tester.init(Tester.java:7)
              at sun.applet.AppletPanel.run(AppletPanel.java:344)
              at java.lang.Thread.run(Thread.java:484)
      (Review ID: 119133)
      ======================================================================

            sbauersunw Stefan Bauer (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: