getInpustream on a URL representing the whole jar file leads to java.io.IOException: no entry name specified

Daniel Fuchs daniel.fuchs at oracle.com
Tue Sep 8 15:05:41 UTC 2020


Hi Jaikiran,

On 08/09/2020 14:54, Jaikiran Pai wrote:
> Hello Daniel,
> 
> On 08/09/20 6:46 pm, Daniel Fuchs wrote:
>> Hi Jaikiran,
>>
>> I expect it's an incorrect use of the API. AFAICS JarURLConnection
>> has always behaved like this.
> 
> Thank you for that input.
> 
>>
>>
>> That said, maybe the API should be clarified to make it
>> explicit that an exception will be thrown if getInputStream()
>> is called on a connection that refers to a jar file (and whose
>> entry/entry name is null).
> 
> Given that the call indirectly lands in (an internal class)
> sun.net.www.protocol.jar.JarURLConnection.getInputStream() from a call
> to a very generic/high level java.net.URL.openStream() would that
> documentation be public facing (which class?) or just a javadoc on that
> internal class' method?

I was speaking of clarifying the API documentation of 
java.net.JarURLConnection.

More specifically overriding URLConnection::getInputStream in
java.net.JarURLConnection just for the purpose of documenting
this behavior. This will require a CSR I guess.

> FWIW - the context for this thread is here
> https://urldefense.com/v3/__https://github.com/quarkusio/quarkus/pull/11970__;!!GqivPVa7Brio!IMQ6U2-cMN0-52SFgYvIEh7tCGYfQQbr2yfY0CXvJqKjtpd3y5p5qih2gNFAfxQsLw> 

Ah, thanks for the context.

best regards,

-- daniel

> 
> -Jaikiran
> 
> 
> 



More information about the net-dev mailing list