dsmiley commented on a change in pull request #1972:
URL: https://github.com/apache/lucene-solr/pull/1972#discussion_r528453632



##########
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:
       This `parse(String)` is documented to take a URI.  I don't think a file 
path is a URI?  If you look at the implementation of the variant that takes a 
File, it converts it to a URI then and then an ASCII string.  This could be 
done via `path.toUri().toASCIIString()`.   FWIW I'd also be okay with just 
doing path.toFile() here.




----------------------------------------------------------------
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

Reply via email to