jakartaee / jakartaee/jaf-api

Misplaced "break" in MimetypesFileTypeMap

Open Beginner friendly
#204 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
43
Forks
34
Avg merge
4d 3h
Merged PRs (30d)
2

Description

**Describe the bug**
Multiple `mime.types` files on classpath are not loaded.

**To Reproduce**
Steps to reproduce the behavior:
1. Add several projects/libs with different `META-INF/mime.types`
2. Run some code that iniatializes the mappings (e.g. `FileTypeMap.getDefaultFileTypeMap()`)
3. Check that all mappings are present.

**Expected behavior**
All mappings should be present

**Desktop (please complete the following information):**
- OS: Windows 11

**Additional context**
I believe that the `break` at line [251](https://github.com/jakartaee/jaf-api/blob/3262ba3e05111ff83d1af21a5015226ac4454e92/api/src/main/java/jakarta/activation/MimetypesFileTypeMap.java#L251) is misplaced. It should be contained within the `if (urls != null)` (or not present at all) but it is unconditionally executed after the first name in the loop is handled.

Contributor guide

Open the contributing guide

Research direction

Inspect api/src/main/java/jakarta/activation/MimetypesFileTypeMap.java around line 251, starting from FileTypeMap.getDefaultFileTypeMap(). Reproduce the case with multiple META-INF/mime.types resources and verify that initialization retains mappings from every resource; done means all mappings are present after initialization.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.