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

REGRESSION: output has non-printable chars while reading an excel file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b67)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b67, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows2000 5.00.2195 SP4

      A DESCRIPTION OF THE PROBLEM :
      My java program reads, values in columns in the microsoft .xls files. I have2 columsn namely "FirstName" and "LastName". When using java versions 1.5.0 and 1.4.2. i'm getting the expected result. for example
      /**
      FirstName LastName
      Aravind Kumar
      Venkatesh Anbu

      FirstName and LastName is the column name, and the below are the values, that are read from an .xls file.
      **/

      Whereas if i use jdk 1.6.0-rc-b67 with no modification in source code, i'm getting a different result. That is some non-printable characters between the first name and the last name.
      for example
      /**
      FirstName LastName
      Aravind

                                                               Kumar



      Venkatesh

                                                               Anbu


      FirstName and LastName is the column name, and the below are the values that are read from the same .xls file.

      You can see some spaces between FN and LN.!!
      **/

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Step 1: Compile the source code under the build version 1.6.0-rc-b67

      javac ExcelManagement.java

      Step 2: Execute the .class files under the build version 1.6.0-rc-b67

      java ExcelManagement

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      FirstName LastName
      Aravind Kumar
      Venkatesh Anbu
      ACTUAL -
      FirstName LastName
      Aravind

                                                               Kumar



      Venkatesh

                                                               Anbu




      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.sql.*;
       
      public class ExcelManagement {
       
          public ExcelManagement () {
          }
       
          public static void main(String[] args) {
              readExcelFile("D:\\Venkatesh\\Names.xls");
          }
       
          public static void readExcelFile(String fileName) {
              Connection conn = null;
              Statement stmt = null;
              try {
                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                  conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ="+fileName);
      // conn = DriverManager.getConnection("jdbc:odbc:ExcelFiles");
                  stmt = conn.createStatement();
                  String query = "select * from [Names$]";
                  ResultSet rs = stmt.executeQuery(query);
                  ResultSetMetaData r! smd = rs.getMetaData();
                  int numberOfColumns = rsmd.getColumnCount();
                  for (int i = 1; i <= numberOfColumns; i++) {
                      System.out.print(rsmd.getColumnName(i)+ " ");
                  }
                  System.out.println("");
                  while (rs.next()) {
                      System.out.println(rs.getString(1)+" "+rs.getString(2));
                  }
                  rs.close();
                  stmt.close();
              } catch (ClassNotFoundException e) {
                  System.err.println(e.getMessage());
              } catch (SQLException e) {
                  System.err.println(e.getMessage());
              }
          }
      }

      ---------- END SOURCE ----------

      Release Regression From : 5.0
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: