Should Java support ERROR_NO_MORE_FILES when canonicalizing paths on Windows?
Thorsten Schöning
tschoening at am-soft.de
Thu Nov 14 19:46:42 UTC 2019
Hi all,
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
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail: Thorsten.Schoening at AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
More information about the core-libs-dev
mailing list