DBFReader解析DBF文件发生内部错误,求指教。
com.linuxense.javadbf.DBFException: Failed to parse Number: empty String
at com.linuxense.javadbf.DBFReader.nextRecord(DBFReader.java:311)
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(); } } }