Per Thorsten Schöning <tschoening@am-soft.de>
While the details can be read on SO[1][2], the bottom line is that I have a setup in which Windows sets the error code ERROR_NO_MORE_FILES during calls to FindFirstFileW sometimes. In theory that shouldn't happen, but it simply does once in a while and make my Java daemon run into exceptions, because that error code isn't expected.
The following lists all expected error codes from the function
"lastErrorReportable", which is used during canonicalizing paths:
> if ((errval == ERROR_FILE_NOT_FOUND)
> || (errval == ERROR_DIRECTORY)
> || (errval == ERROR_PATH_NOT_FOUND)
> || (errval == ERROR_BAD_NETPATH)
> || (errval == ERROR_BAD_NET_NAME)
> || (errval == ERROR_ACCESS_DENIED)
> || (errval == ERROR_NETWORK_UNREACHABLE)
> || (errval == ERROR_NETWORK_ACCESS_DENIED)) {
> return 0;
> }
https://github.com/openjdk/jdk/blob/master/src/java.base/windows/native/libjava/canonicalize_md.c#L131
Obviously ERROR_NO_MORE_FILES is missing, but its pretty interesting as well that Java supports other error codes already. Regarding the docs, FindFirstFileW should only return ERROR_FILE_NOT_FOUND, but most likely people ran into other error codes already Windows used in various circumstances. All of those totally make sense.
So, how about adding ERROR_NO_MORE_FILES there as well?
As can be read in my SO-questions, I didn't recognized any other real technical problem like permissions issues, timeouts in the network or stuff. Its only that Windows sometimes decides to use that error code for some unknown reason. Adding it would only be one line of text and increase compatibility with setups like mine. I guess problems like these were the reason to add other error codes in the past as well.
Thanks!
[1]: https://stackoverflow.com/questions/58825588/does-java-need-to-support-error-no-more-files-when-canonicalizing-paths-on-windo
[2]: https://stackoverflow.com/questions/58825963/when-does-findfirstfilew-set-last-error-to-be-error-no-more-files-instead-of-err?noredirect=1&lq=1
While the details can be read on SO[1][2], the bottom line is that I have a setup in which Windows sets the error code ERROR_NO_MORE_FILES during calls to FindFirstFileW sometimes. In theory that shouldn't happen, but it simply does once in a while and make my Java daemon run into exceptions, because that error code isn't expected.
The following lists all expected error codes from the function
"lastErrorReportable", which is used during canonicalizing paths:
> if ((errval == ERROR_FILE_NOT_FOUND)
> || (errval == ERROR_DIRECTORY)
> || (errval == ERROR_PATH_NOT_FOUND)
> || (errval == ERROR_BAD_NETPATH)
> || (errval == ERROR_BAD_NET_NAME)
> || (errval == ERROR_ACCESS_DENIED)
> || (errval == ERROR_NETWORK_UNREACHABLE)
> || (errval == ERROR_NETWORK_ACCESS_DENIED)) {
> return 0;
> }
https://github.com/openjdk/jdk/blob/master/src/java.base/windows/native/libjava/canonicalize_md.c#L131
Obviously ERROR_NO_MORE_FILES is missing, but its pretty interesting as well that Java supports other error codes already. Regarding the docs, FindFirstFileW should only return ERROR_FILE_NOT_FOUND, but most likely people ran into other error codes already Windows used in various circumstances. All of those totally make sense.
So, how about adding ERROR_NO_MORE_FILES there as well?
As can be read in my SO-questions, I didn't recognized any other real technical problem like permissions issues, timeouts in the network or stuff. Its only that Windows sometimes decides to use that error code for some unknown reason. Adding it would only be one line of text and increase compatibility with setups like mine. I guess problems like these were the reason to add other error codes in the past as well.
Thanks!
[1]: https://stackoverflow.com/questions/58825588/does-java-need-to-support-error-no-more-files-when-canonicalizing-paths-on-windo
[2]: https://stackoverflow.com/questions/58825963/when-does-findfirstfilew-set-last-error-to-be-error-no-more-files-instead-of-err?noredirect=1&lq=1
- duplicates
-
JDK-8234475 IOException at java.io.WinNTFileSystem.canonicalize0 b/c ERROR_NO_MORE_FILES
- Closed
- relates to
-
JDK-8315034 File.mkdirs() occasionally fails to create folders on Windows shared folder
- Resolved