File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,13 @@ internal val formatter = DataFrameFormatter(
77
77
internal fun getResources (vararg resource : String ) = resource.joinToString(separator = " \n " ) { getResourceText(it) }
78
78
79
79
internal fun getResourceText (resource : String , vararg replacement : Pair <String , Any >): String {
80
- val res = DataFrame ::class .java.getResourceAsStream(resource) ? : error(" Resource '$resource ' not found" )
80
+ /* *
81
+ * The choice of loader is crucial here: it should always be a class loaded by the same class loader as the resource we load.
82
+ * I.e. [DataFrame] isn't a good fit because it might be loaded by Kotlin IDEA plugin (because Kotlin plugin
83
+ * loads DataFrame compiler plugin), and plugin's classloader knows nothing about the resources.
84
+ */
85
+ val loader = HtmlContent ::class .java
86
+ val res = loader.getResourceAsStream(resource) ? : error(" Resource '$resource ' not found" )
81
87
var template = InputStreamReader (res).readText()
82
88
replacement.forEach {
83
89
template = template.replace(it.first, it.second.toString())
You can’t perform that action at this time.
0 commit comments