On Fri, 27 May 2022 12:15:07 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8287237: Refactor and clean up
>
> src/java.base/share/classes/sun/net/www/MimeTable.java line 164:
> 
>> 162:     public MimeEntry findByFileName(String fname) {
>> 163:         // attempt to find the entry with the fragment component removed
>> 164:         MimeEntry entry = findByFileName(fname, true);
> 
> I think we might need a check here first to see if the `fname` contains `#` 
> and if it does, only then call the `findByFileName` with `true`. Without that 
> check, with the change in this PR, it's now possible that the 
> `findByFileName` will get called twice (once with `true` and once with 
> `false`) for the case where the filename doesn't have a `#` and whose 
> extension isn't in the MimeTable.

Methods refactored in eab33e8000ea730c57c918dbf291af23bacbd059.

> src/java.base/share/classes/sun/net/www/MimeTable.java line 183:
> 
>> 181:      * @return the MIME entry associated with the file name
>> 182:      */
>> 183:     public MimeEntry findByFileName(String fname, boolean 
>> removeFragment) {
> 
> Hello Brian,
> 
> Perhaps this new method can be made `private` (and maybe even `static`)?

Private yes, static no. Refactored in eab33e8000ea730c57c918dbf291af23bacbd059.

> test/jdk/java/nio/file/Files/probeContentType/Basic.java line 197:
> 
>> 195:         String contentType = Files.probeContentType(pathWithFragement);
>> 196:         if (contentType == null || !contentType.equals("image/png")) {
>> 197:             System.out.printf("For %s expected \"png\" but got %s%n",
> 
> Should this instead use `System.err`, since the rest of the test uses that 
> for printing these failures when incrementing the failure count.

Yes, it should have used `System.err`; fixed in 
eab33e8000ea730c57c918dbf291af23bacbd059.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8909

Reply via email to