fix: register Xerces XML resource bundles for native image (#293) (#296)

In GraalVM native image the Xerces XML parser throws MissingResourceException
(an unchecked exception) when it tries to format an error message for malformed
input but cannot locate its message bundles. This exception was not caught by
the existing `catch (XMLStreamException ignored)` blocks in XmlParser, causing
it to propagate and crash S3 requests that arrive with non-XML bodies (e.g.
CDK PutObject calls during asset publishing).

Two-layer fix:
- Widen all five catch blocks in XmlParser from XMLStreamException to Exception
  so any parse failure — regardless of cause — results in an empty/default
  return value, matching the documented contract of each method.
- Add resource-config.json registering the three Xerces XML message bundles
  (XMLMessages, XMLSerializerMessages, xpath regex message) so the bundles are
  available at native image runtime and the MissingResourceException is not
  thrown in the first place.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-04-08 16:23:10 -05:00
1 parent c475e52984
commit 0bad9338f9
2 files changed
+12 -5

No files matched your search

@@ -91,7 +91,7 @@ public final class XmlParser {
}
}
r.close();
} catch (XMLStreamException ignored) {}
} catch (Exception ignored) {}
return result;
}
@@ -160,7 +160,7 @@ public final class XmlParser {
}
}
r.close();
} catch (XMLStreamException ignored) {}
} catch (Exception ignored) {}
return result;
}
@@ -206,7 +206,7 @@ public final class XmlParser {
}
}
r.close();
} catch (XMLStreamException ignored) {}
} catch (Exception ignored) {}
return result;
}
@@ -256,7 +256,7 @@ public final class XmlParser {
}
}
r.close();
} catch (XMLStreamException ignored) {}
} catch (Exception ignored) {}
return result;
}
@@ -312,7 +312,7 @@ public final class XmlParser {
}
}
r.close();
} catch (XMLStreamException ignored) {}
} catch (Exception ignored) {}
return result;
}
}