日期:2014-05-19  浏览次数:21047 次

DBFReader解析DBF文件发生内部错误,求指教。
com.linuxense.javadbf.DBFException: Failed to parse Number: empty String
at com.linuxense.javadbf.DBFReader.nextRecord(DBFReader.java:311)

Java code
public static void main(String[] args) {
        String msg = "";
        FilenameFilter filter = new FilenameFilter() {
             public boolean accept(File dir, String name) {
                 //Pattern p = Pattern.compile("^L\\d+\\.dbf$",
                 Pattern p = Pattern.compile("L090203.dbf",
                 Pattern.CASE_INSENSITIVE);
                 Matcher m = p.matcher(name);
                 return m.matches();
             }
          };
          String yaSuoPath = "D:\\workspace\\linc\\WebContent\\upload\\2012718\\";
            File dir = new File(yaSuoPath);
            String[] tables = dir.list(filter);
            for (String table : tables) {
                try {
                    DBFReader dBFReader = new DBFReader(new FileInputStream(new File(yaSuoPath+table)));
                    dBFReader.setCharactersetName("GBK");
                    Object[] fieldValues = null;
                    int count = dBFReader.getRecordCount();
                    while((fieldValues=dBFReader.nextRecord())!= null&&!(count--<=0)){
                        for(int i=0;i<fieldValues.length;i++){
                            Object value = fieldValues[i];
                            if(value==null){
                                System.out.println("空");
                            }else{
                                System.out.println(fieldValues[i].toString());
                            }
                        }
                    }
                } catch (Exception e) {
                    msg = "导入发生错误。";
                    e.printStackTrace();
                } 
            }
    }

哪位大哥帮忙看看,需要 DBFReader JAR包的发邮件给我:1008687@qq.com

------解决方案--------------------
拿分来咯。。。刚发你的最新版