itsmehotpants opened a new pull request, #119:
URL: https://github.com/apache/maven-shared-io/pull/119

   ## What
   
   Fixes three related NullPointerException bugs:
   
   - `SuffixMapping#getTargetFiles` threw NPE from 
`source.endsWith(sourceSuffix)` when either argument was `null`.
   - `SingleTargetMapping#getTargetFiles` had the same `endsWith(null)` NPE 
pattern.
   - `URLLocation#initFile` threw NPE from 
`Files.createTempFile(tempFilePrefix, tempFileSuffix)` when the prefix/suffix 
constructor args were `null` (allowed by the public constructor).
   
   ## Fix
   
   - `SuffixMapping` / `SingleTargetMapping`: guard with a null check before 
calling `endsWith`, returning an empty result set (no match) instead of 
throwing.
   - `URLLocation`: fall back to default values (`"url"` / `".tmp"`) when the 
prefix/suffix are null, consistent with how the constructor already allows them 
to be null.
   
   ## Testing
   
   Added regression tests for each case following the existing test style in 
`SuffixMappingTest` and `URLLocationTest`.
   
   Fixes #93
   Fixes #94
   Fixes #95


-- 
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]

Reply via email to