我知道在将 CsvListReader 限制为一行之前会问这个问题
我面临同样的问题,你能告诉我对标记器进行了哪些更改以克服这个问题......
在我的情况下,它每次都发生在不同的行号中,并不一致。有时它发生在 csv 的第 5000 行,而其他时候它发生在 6000,如果我进入调试模式并一一执行代码而不是它永远不会发生。你能帮我解决可能是什么问题吗?
请原谅我再次问同样的问题,但我似乎无法自己找到解决方案。
引发错误的 CSV 行之一是“???” 是日文
"CI","1","2014-04-01","BMW","","","","","","3","528","",0,0, "","","C","","","1","F","1","8","8",0,0,0,0,0,0,0, 0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0 ,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"", 0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0, 0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"","","0301 ","宝马","","7","","5","","5","","8","7","5","5","8", "","","","","","","","0","0","???","BMW","???","???","? ??","???","???","???","???","???","","","","",""," “,““,““,““,““,““,““,“???“,“宝马”,”???”,”???”,”???”,”? ??","???","???","???","???","","","","","","",""," ","","","","","","","",0,0,0,"0","0","0","2014-04-02"," 09:34:35","90002","082R"
另一个是这个
"CI","1","2014-04-01","BMW","","","","","","3","633","",0,0, "","","C","","","1","F","1","8","8",0,0,0,0,0,0,0, 0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0 ,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"", 0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0, 0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"","","0301 ","宝马","","7","","4","","5","","8","7","4","5","8", "","","","","","","","0","0","???","BMW","???","???","? ??","???","???","???","???","???","","","","",""," “,““,““,““,““,““,““,“???“,“宝马”,”???”,”???”,”???”,”? ??","???","???","???","???","","","","","","",""," ","","","","","","","",0,0,0,"0","0","0","2014-04-02"," 09:34:35","15762","082R"
该行似乎格式正确,但仍引发错误
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:99)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:575)
at java.lang.StringBuilder.append(StringBuilder.java:204)
at org.supercsv.io.Tokenizer.readColumns(Tokenizer.java:106)
at org.supercsv.io.AbstractCsvReader.readRow(AbstractCsvReader.java:179)
at org.supercsv.io.CsvListReader.read(CsvListReader.java:69)