elharo opened a new pull request, #531:
URL: https://github.com/apache/maven-ear-plugin/pull/531
Fixes #521
## Bug
A whitespace-only classifier string (e.g. " ") is not properly handled:
- `classifier.trim().length() > 0` evaluates to `false` for whitespace-only
strings
- Neither branch of the if/else-if applies
- The raw whitespace string is used in the filename, producing filenames
like `myApp .ear`
## Fix
- Trim the classifier string before processing
- Treat empty/whitespace-only classifiers the same as `null` (produce
`finalName.ear`)
- Simplify the condition: after trimming, just check `isEmpty()` and
`startsWith("-")`
## Tests
- **Unit test** (`EarMojoTest`): tests `getEarFile()` with null, normal,
dash-prefixed, and whitespace-only classifiers via reflection
- **Integration test** (project-103): builds an EAR with a whitespace-only
classifier and verifies the output filename has no spaces
The unit test for whitespace-only classifier fails before the fix:
```
expected: </tmp/myapp.ear> but was: </tmp/myapp .ear>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]