JDK-6375212 : REGRESSION: output has non-printable chars while reading an excel file
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.sql:bridge
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2006-01-20
  • Updated: 2011-02-16
  • Resolved: 2006-03-24
Related Reports
Duplicate :  
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.