elharo opened a new issue, #275:
URL: https://github.com/apache/maven-remote-resources-plugin/issues/275

   ## Summary
   `execute()` calls `configureLocator()` before the `try` block that contains 
the validation and resource processing, so any runtime exception it throws is 
not wrapped and escapes untyped.
   
   
`src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java:429-433`
   
   ```java
   configureLocator();
   ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
   try {
       validate();
       ...
   ```
   
   `configureLocator()` at `:482-507` dereferences 
`project.getFile().getParentFile()`:
   
   ```java
   locator.addSearchPath(FileResourceLoader.ID, 
project.getFile().getParentFile().getAbsolutePath());
   ```
   
   If the current project has no associated POM file (`project.getFile()` null 
— possible for models built without a file, super POMs, or stubs), this throws 
a raw `NullPointerException` instead of a `MojoExecutionException`. The rest of 
`execute()` deliberately wraps work in the `try`/`finally` (which also restores 
the thread context classloader) precisely to contain such failures.
   
   ## Suggested fix
   Move `configureLocator()` inside the guarded `try`, and/or null-guard 
`project.getFile()` in `configureLocator()` with a clear error message.


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