-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clarify the situation when generated extension property causes ClassC…
…ast or NPE exceptions
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...lin/org/jetbrains/kotlinx/dataframe/exceptions/ColumnValuesMismatchColumnTypeException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.jetbrains.kotlinx.dataframe.exceptions | ||
|
||
import org.jetbrains.kotlinx.dataframe.AnyCol | ||
import org.jetbrains.kotlinx.dataframe.DataColumn | ||
import org.jetbrains.kotlinx.dataframe.columns.values | ||
import org.jetbrains.kotlinx.dataframe.type | ||
|
||
/** | ||
* Extension properties are generated according to [DataColumn.type] property | ||
* [DataColumn.type] must match types of [DataColumn.values], but it can fail to do so. | ||
* This causes [ClassCastException] or [NullPointerException] when you use extension property and actual value is of different type or is null. | ||
* If generated extension property causes this exception, this is a bug in the library | ||
* You can work around this problem by referring to [column] using String API | ||
*/ | ||
public class ColumnValuesMismatchColumnTypeException(public val column: AnyCol, cause: Throwable) : | ||
RuntimeException("Failed to convert column '${column.name()}'", cause) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters