Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DoubleParser.canParse crashed by single comma value. #1043

Closed
is opened this issue Jan 13, 2022 · 1 comment
Closed

DoubleParser.canParse crashed by single comma value. #1043

is opened this issue Jan 13, 2022 · 1 comment

Comments

@is
Copy link
Contributor

is commented Jan 13, 2022

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
	at java.base/java.lang.String.charAt(String.java:1512)
	at tech.tablesaw.columns.numbers.DoubleParser.isPercent(DoubleParser.java:60)
	at tech.tablesaw.columns.numbers.DoubleParser.canParse(DoubleParser.java:29)
	at tech.tablesaw.io.ColumnTypeDetector.detectType(ColumnTypeDetector.java:155)
	at tech.tablesaw.io.ColumnTypeDetector.detectColumnTypes(ColumnTypeDetector.java:100)
	at tech.tablesaw.io.FileReader.getColumnTypes(FileReader.java:58)
	at tech.tablesaw.io.csv.CsvReader.detectColumnTypes(CsvReader.java:156)
	at tech.tablesaw.io.csv.CsvReader.getReaderAndColumnTypes(CsvReader.java:75)
	at tech.tablesaw.io.csv.CsvReader.read(CsvReader.java:92)
	at tech.tablesaw.io.csv.CsvReader.read(CsvReader.java:87)
	at tech.tablesaw.io.csv.CsvReader.read(CsvReader.java:34)
	at tech.tablesaw.io.DataFrameReader.usingOptions(DataFrameReader.java:139)

The csv file

token,title,event,context,advice,total
",",11427,587954,152285,360184,1111850
the,2850,450041,172617,372166,997674
.,612,406092,112307,349705,868716
be,859,315897,99111,272848,688715
and,7132,303502,90898,282893,684425

When cheked string is ",", it will be stripped to an empty string, but the followed catch statement do not catch StringIndexOutOfBoundsException exception.

is pushed a commit to is/tablesaw that referenced this issue Jan 13, 2022
lwhite1 pushed a commit that referenced this issue Mar 16, 2022
Co-authored-by: Yu Xin <yu.xin@alibaba-inc.com>
@lwhite1
Copy link
Collaborator

lwhite1 commented Mar 26, 2022

fixed in #1044

@lwhite1 lwhite1 closed this as completed Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants