[
https://issues.apache.org/jira/browse/SOLR-9444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15448293#comment-15448293
]
ASF GitHub Bot commented on SOLR-9444:
--------------------------------------
Github user uschindler commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/74#discussion_r76740913
--- Diff:
solr/core/src/java/org/apache/solr/core/backup/repository/LocalFileSystemRepository.java
---
@@ -58,21 +59,28 @@ public void init(NamedList args) {
}
@Override
- public URI createURI(String... pathComponents) {
- Preconditions.checkArgument(pathComponents.length > 0);
-
- String basePath = Preconditions.checkNotNull(pathComponents[0]);
- // Note the URI.getPath() invocation on Windows platform generates an
invalid URI.
- // Refer to
http://stackoverflow.com/questions/9834776/java-nio-file-path-issue
- // Since the caller may have used this method to generate the string
representation
- // for the pathComponents, we implement a work-around specifically for
Windows platform
- // to remove the leading '/' character.
- if (Constants.WINDOWS) {
- basePath = basePath.replaceFirst("^/(.:/)", "$1");
+ public URI createURI(String location) {
+ Preconditions.checkNotNull(location);
+
+ URI result = null;
+ try {
--- End diff --
Nice. This is exactly as I proposed. So people can use both URIs with a
file: or just a plain path. URI.isAbsolute() returns false, if scheme ("file:")
is missing:
<https://docs.oracle.com/javase/7/docs/api/java/net/URI.html#isAbsolute()> "A
URI is absolute if, and only if, it has a scheme component."
> Fix path usage for cloud backup/restore
> ---------------------------------------
>
> Key: SOLR-9444
> URL: https://issues.apache.org/jira/browse/SOLR-9444
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Varun Thacker
> Attachments: SOLR-9444.patch
>
>
> As noted by Uwe on
> https://issues.apache.org/jira/browse/SOLR-9242?focusedCommentId=15438925&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15438925
> the usage of URI#getPath is wrong.
> Creating a Jira to track this better. More details to follow
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]