Skip to content
Browse files

Fixed issue found while try to troubleshoot ruby-saml with jruby

when XSD has DOCTYPE to DTD, not able to load the file.

and the ruby script is run without path, NullPointerException got thrown.
  • Loading branch information...
1 parent f75a283 commit cd9824bce99806886957d1d6b9c035b6237482e9 Patrick Cheng committed Nov 16, 2012
Showing with 2 additions and 1 deletion.
  1. +1 −1 ext/java/nokogiri/XmlSchema.java
  2. +1 −0 ext/java/nokogiri/internals/NokogiriHelpers.java
View
2 ext/java/nokogiri/XmlSchema.java
@@ -224,7 +224,7 @@ protected void validate(Document document) throws SAXException, IOException {
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
String adjusted = adjustSystemIdIfNecessary(currentDir, scriptFileName, baseURI, systemId);
lsInput.setPublicId(publicId);
- lsInput.setSystemId(adjusted);
+ lsInput.setSystemId(adjusted != null? adjusted : systemId);
lsInput.setBaseURI(baseURI);
return lsInput;
}
View
1 ext/java/nokogiri/internals/NokogiriHelpers.java
@@ -712,6 +712,7 @@ private static String resolveSystemId(String baseName, String systemId) {
File base = new File(baseName);
if (base.isDirectory()) parentName = baseName;
else parentName = base.getParent();
+ if (parentName == null) return null;
if (parentName.toLowerCase().startsWith("file:")) parentName = parentName.substring("file:".length());
File dtdFile = new File(parentName + "/" + systemId);
if (dtdFile.exists()) return dtdFile.getPath();

0 comments on commit cd9824b

Please sign in to comment.
Something went wrong with that request. Please try again.