Strange Exception at read

向雅 fyaoxy at gmail.com
Fri Nov 13 03:49:39 PST 2009


:) seems not
http://msdn.microsoft.com/en-us/library/ms681382%28VS.85%29.aspx
ERROR_ACCESS_DENIED Access is denied.
5 (0x5)



致敬
向雅



2009/11/13 Vikram A <vikram.account at gmail.com>:
>
>>> in windows, WSA use some error code scopes. 5 is a windows common
>>>error. I not think it in aio scope.
>
> i think, windows error 0x05 is not windows specific.
> it is a general x86 line read write error, can even happen during
> windows/solaris x86 installation, if it encounters a problem.
>
> rgds,
> Vikram.
>
>
>
> On Thu, Nov 12, 2009 at 8:03 PM, 向雅 <fyaoxy at gmail.com> wrote:
>>
>> I not family with other part howto wrap the os error.
>> Just in this case, Indeed I cannot take any action to cover it.
>> I checked out sun.nio.fs.WindowsException which do some exception
>> wrap. I think sun.nio.ch maybe need some same like thing.
>> My question is :
>> If both do wrap, so whether can unify these wrap?
>>
>> WindowsException:
>>  private IOException translateToIOException(String file, String other) {
>>        // not created with last error
>>        if (lastError() == 0)
>>            return new IOException(errorString());
>>
>>        // handle specific cases
>>        if (lastError() == ERROR_FILE_NOT_FOUND || lastError() ==
>> ERROR_PATH_NOT_FOUND)
>>            return new NoSuchFileException(file, other, null);
>>        if (lastError() == ERROR_FILE_EXISTS || lastError() ==
>> ERROR_ALREADY_EXISTS)
>>            return new FileAlreadyExistsException(file, other, null);
>>        if (lastError() == ERROR_ACCESS_DENIED)
>>            return new AccessDeniedException(file, other, null);
>>
>>        // fallback to the more general exception
>>        return new FileSystemException(file, other, errorString());
>>    }
>>
>> BTW, I think, for those os error not in given domain, whether wrap to
>> RuntimeException subclass.
>> in windows, WSA use some error code scopes. 5 is a windows common
>> error. I not think it in aio scope.
>> And in the callback mode, failed method already hide the exception
>> type. Pass a RuntimeException no any difference.
>> So we can tell user in API doc, failed method's exc parameter maybe
>> unchecked, maybe checked.
>> unchecked exception in the failed method indicate that some true
>> exception occurs.
>>
>> 致敬
>> 向雅
>>
>>
>>
>> 2009/11/12 Alan Bateman <Alan.Bateman at sun.com>:
>> > 向雅 wrote:
>> >>
>> >> :
>> >> Yes,
>> >> for example the IOException in this message, I got a "IOException:
>> >> Access Denied".
>> >> I debug to Iocp get the os errno: 5, windows system error number.
>> >> I tested aio File channel, I get the errno 5 again, but it wrapped
>> >> with AccessDeniedException.
>> >> So I browsed the new file channel implementation, besides
>> >> AccessDeniedException,
>> >> there have more specific exception.
>> >>
>> >
>> > The "Access denied" issue that you ran into with the Windows 7 firewall
>> > is,
>> > in my mind anyway, obscure and probably impossible to differentiate from
>> > a
>> > serious implementation bug. It's also not clear to me what recovery
>> > action
>> > you could take that would be different to other I/O errors. The only
>> > case
>> > that I think we should add a specific exception for is the "reset by
>> > peer"
>> > case (that applies to SocketChannel and legacy Socket aswell).
>> >
>> > -Alan.
>> >
>
>


More information about the nio-dev mailing list