HoustonPutman commented on a change in pull request #1972: URL: https://github.com/apache/lucene-solr/pull/1972#discussion_r528841890
########## File path: solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/MetricsConfiguration.java ########## @@ -77,22 +79,22 @@ public PrometheusExporterSettings getSettings() { return searchConfiguration; } - public static MetricsConfiguration from(String path) throws Exception { + public static MetricsConfiguration from(String resource) throws Exception { // See solr-core XmlConfigFile final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { dbf.setXIncludeAware(true); dbf.setNamespaceAware(true); } catch (UnsupportedOperationException e) { - log.warn("{} XML parser doesn't support XInclude option", path); + log.warn("{} XML parser doesn't support XInclude option", resource); } Document document; - File file = new File(path); - if (file.isFile()) { - document = dbf.newDocumentBuilder().parse(file); + Path path = Path.of(resource); + if (Files.exists(path)) { + document = dbf.newDocumentBuilder().parse(path.toAbsolutePath().toString()); Review comment: Good catch. I tested it in multiple configurations, but there's probably some edge case it doesn't work for. I'll use `path.toUri().toASCIIString()` since the `parse(file)` method just gets the URI of the file and passes that to the `parse(uri)` implementation anyways. Might as well skip the middleman-method. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org