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

RowSetMetadataImpl.getTableName should return empty string instead null

XMLWordPrintable

    • rc
    • sparc
    • solaris_2.6



      Name: acR10002 Date: 04/27/2004


      Filed By : SPB JCK team (###@###.###)
      JDK : build 1.5.0-beta2-b47
      JCK : 1.5
      Platform[s] : Solaris
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Related Test [s] :
      api/javax_sql/rowset/RowSetMetaDataImpl/index.html#TableName[RowSetMetaDataImpl2011]


      Specification excerpt:
      ======================
      --------- J2SE API spec v.1.5 ---------
      ...
      getTableName

      public String getTableName(int columnIndex)
                           throws SQLException

           Retrieves the name of the table from which the value in the
      designated column was derived.

           Specified by:
               getTableName in interface ResultSetMetaData

           Parameters:
               columnIndex - the first column is 1, the second is 2, and so
      on; must be between 1 and the number of columns, inclusive
           Returns:
               the table name or an empty String if no table name is available
           Throws:
               SQLException - if a database access error occurs or the given
      column number is out of bounds


      ...
      ---------- end-of-excerpt ---------------

      Problem description
      ===================
      As the specification says the getTableName method should return empty
      string in case if no table name is available. Now it returns *null*


      Minimized test:
      ===============
      ------- Test.java -------
      import javax.sql.rowset.*;
      import java.sql.*;

      public class Test {
           public static void main(String [] arg) {
               RowSetMetaDataImpl meta = new RowSetMetaDataImpl();
               try {
                   meta.setColumnCount(3);
               } catch (SQLException e) {
                   System.out.println( "Unexpected (0) "+e );
               }
               try {
                   String output = meta.getTableName(2);
                   System.out.println("output: "+output);
               } catch (SQLException e) {
                   System.out.println( "Unexpected "+e );
               }
               System.out.println( "finished" );
           }
      }
      ------- end-of-Test.java -------

      Minimized test output:
      ======================
      output: null
      finished

      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

      ======================================================================

            ahandasunw Amit Handa (Inactive)
            aycsunw Ayc Ayc (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: