Skip to content

Commit

Permalink
Resolve potential NPE in SchemaResourceResolver
Browse files Browse the repository at this point in the history
The LSResourceResolver interface specifies that the systemId parameter may be null. The SchemaResourceResolver uses this argument without checking for this which can result a NullPointerException. This patch adds an extra null check before using the parameter.
  • Loading branch information
pepijnve authored and flavorjones committed Aug 28, 2021
1 parent 9eab65e commit 601e568
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/java/nokogiri/XmlSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private class SchemaResourceResolver implements LSResourceResolver
String systemId,
String baseURI)
{
if (noNet && (systemId.startsWith("http://") || systemId.startsWith("ftp://"))) {
if (noNet && systemId != null && (systemId.startsWith("http://") || systemId.startsWith("ftp://"))) {
if (systemId.startsWith(XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
return null; // use default resolver

This comment was marked as spam.

Copy link
@npbhavaniprasad

npbhavaniprasad Nov 14, 2021

bvbv

}
Expand Down

0 comments on commit 601e568

Please sign in to comment.