New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8231179: Investigate why tools/javac/options/BCPOrSystemNotSpecified.java fails on Window #2004
Conversation
…java fails on Window
|
Webrevs
|
@@ -206,7 +209,9 @@ private void prepareBCP(Path target) throws IOException { | |||
Files.createDirectories(targetDir); | |||
try (InputStream in = file.openInputStream()) { | |||
String sourcePath = file.getName(); | |||
int sepPos = sourcePath.lastIndexOf(fileSep); | |||
// Here, we should use file system separator instead of the operating system separator. | |||
String fileSystemSep = ((PathFileObject) file).getPath().getFileSystem().getSeparator(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about using: System.getProperty("file.separator")?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vicente-romero-oracle That would be incorrect.
That system property is for the default file system, and may not be the correct separator for a user-defined file system, as is possible with java.nio.file.FileSystem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vicente-romero-oracle Explaining a bit more ... on Windows, the default file system separator is \
but we're dealing here with Path
objects from the "internal" JRT file system, which uses /
as a separator. That's why we have to be careful to use the right separator. On Unix/Linux/macOS, the separators are the same, which is how the test has passed on those platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see thanks for the clarification
@@ -206,7 +209,9 @@ private void prepareBCP(Path target) throws IOException { | |||
Files.createDirectories(targetDir); | |||
try (InputStream in = file.openInputStream()) { | |||
String sourcePath = file.getName(); | |||
int sepPos = sourcePath.lastIndexOf(fileSep); | |||
// Here, we should use file system separator instead of the operating system separator. | |||
String fileSystemSep = ((PathFileObject) file).getPath().getFileSystem().getSeparator(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be possible to get the Path
without having to cast to the internal PathFileObject
type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonathan-gibbons Thanks for your suggestion. I have updated the code.
I find the windows-x64-build of the pre-submit-tests failed. I merge the code of the master branch to try to fix it. |
@lgxbslgx This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
I merged the code of the master branch just now to see whether the |
# Conflicts: # test/langtools/ProblemList.txt
I merged the master branch to solve the conflict. Thank you for reviewing. |
@lgxbslgx This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 108 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jonathan-gibbons, @vicente-romero-oracle) but any other Committer may sponsor as well.
|
@vicente-romero-oracle Thank you for your review. Could I get your help to sponsor this patch? /integrate |
/sponsor |
@vicente-romero-oracle @lgxbslgx Since your change was applied there have been 113 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 4b7f027. |
Hi all,
The statement
String sourcePath = file.getName();
in methodprepareBCP(Path target)
would useDirectoryFileObject::getName
which is shown below.And the
DirectoryFileObject::getName
would useRelativePath::resolveAgainst
which is shown belowWe can see that
RelativePath::resolveAgainst
use file system separator instead of operating system separator. In methodprepareBCP
, the file system should be JRT file system, but we don't need to know actually which file system to be used. We only need to use the same file system separator so that the test can run as expected.This patch fixes the test by using the file system separator instead of operating system separator.
Thank you for taking the time to review.
Best Regards.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/2004/head:pull/2004
$ git checkout pull/2004
Update a local copy of the PR:
$ git checkout pull/2004
$ git pull https://git.openjdk.java.net/jdk pull/2004/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2004
View PR using the GUI difftool:
$ git pr show -t 2004
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/2004.diff