Skip to content

Commit

Permalink
Add SAX messages bundle for XML parser to fix missing resource exception
Browse files Browse the repository at this point in the history
  • Loading branch information
sshark authored and AlexITC committed Oct 4, 2020
1 parent 8311c82 commit ba6b0e1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
File renamed without changes.
4 changes: 4 additions & 0 deletions META-INF/native-image/resource-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"resources":[],
"bundles":[{"name":"com.sun.org.apache.xerces.internal.impl.msg.SAXMessages"}]
}
15 changes: 8 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import java.nio.file.{Files, StandardCopyOption}

import sbt.TupleSyntax.t2ToTable2

val copyNativeImageEtc = taskKey[Unit]("Copy native-image configurations to target")
val copyNativeImageConfigs = taskKey[Unit]("Copy native-image configurations to target")

copyNativeImageEtc := ((baseDirectory, target) map { (base, trg) =>
copyNativeImageConfigs := ((baseDirectory, target) map { (base, trg) =>
{
Some(new File(trg, "native-image/etc").toPath)
Some(new File(trg, "native-image/META-INF/native-image").toPath)
.filterNot(p => Files.isDirectory(p))
.foreach(p => Files.createDirectories(p))
new File(base, "etc")
new File(base, "META-INF/native-image")
.listFiles()
.foreach(
file =>
Files.copy(
file.toPath,
new File(trg, s"native-image/etc/${file.getName}").toPath,
new File(trg, s"native-image/META-INF/native-image/${file.getName}").toPath,
StandardCopyOption.REPLACE_EXISTING
)
)
Expand Down Expand Up @@ -51,7 +51,8 @@ lazy val root = (project in file("."))
//
// TODO: Generate such config automatically before building the native image
nativeImageOptions ++= List(
"-H:ReflectionConfigurationFiles=etc/metadata-extractor-reflect-config.json"
"-H:ReflectionConfigurationFiles=META-INF/native-image/metadata-extractor-reflect-config.json",
"-H:ResourceConfigurationFiles=META-INF/native-image/resource-config.json"
),
nativeImage := (nativeImage dependsOn copyNativeImageEtc).value
nativeImage := (nativeImage dependsOn copyNativeImageConfigs).value
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
BadMessageKey = The error message corresponding to the message key can not be found.
FormatFailed = An internal error occurred while formatting the following message\:\n
dom-node-read-not-supported = Cannot read DOM node property. No DOM tree exists.
errorHandlerDebugMsg=Error\: URI \= "{0}", Line \= "{1}", \: {2}
errorHandlerNotSet=Warning\: validation was turned on but an org.xml.sax.ErrorHandler was not set, which is probably not what is desired. Parser will use a default ErrorHandler to print the first {0} errors. Please call the 'setErrorHandler' method to fix this.
false-not-supported = False state for feature ''{0}'' is not supported.
feature-not-recognized = Feature ''{0}'' is not recognized.
feature-not-supported = Feature ''{0}'' is not supported.
feature-read-only = Feature ''{0}'' is read only.
incompatible-class = The value specified for property ''{0}'' cannot be casted to {1}.
jaxp-order-not-supported = Property ''{0}'' must be set before setting property ''{1}''.
jaxp-secureprocessing-feature = FEATURE_SECURE_PROCESSING\: Cannot set the feature to false when security manager is present.
nullparameter=the name parameter for "{0}" is null
property-not-parsing-supported = Property ''{0}'' is not supported while parsing.
property-not-recognized = Property ''{0}'' is not recognized.
property-not-supported = Property ''{0}'' is not supported.
property-read-only = Property ''{0}'' is read only.
schema-already-specified = Property ''{0}'' cannot be set when a non-null Schema object has already been specified.
schema-not-supported = The specified schema language is not supported.
start-document-not-called=Property "{0}" should be called after startDocument event is thrown
true-not-supported = True state for feature ''{0}'' is not supported.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object GenerateNativeReflectionConfig {

def generateConfigFile(): Unit = {
val string = metadataExtractorReflectConfig
new java.io.PrintWriter("etc/metadata-extractor-reflect-config.json") { write(string); close() }
new java.io.PrintWriter("META-INF/native-image/metadata-extractor-reflect-config.json") { write(string); close() }
}

def metadataExtractorReflectConfig: String = {
Expand Down

0 comments on commit ba6b0e1

Please sign in to comment.