elharo opened a new issue, #137:
URL: https://github.com/apache/maven-shared-jar/issues/137

   In `JarData.java`, several delegation methods assume non-null state without 
guarding:
   
   ```java
   public boolean isDebugPresent() {
       return jarClasses.isDebugPresent();  // NPE if setJarClasses() never 
called
   }
   public int getNumRootEntries() {
       return rootEntries.size();           // NPE if setRootEntries() never 
called
   }
   public int getNumClasses() {
       return jarClasses.getClassNames().size();  // NPE if no analysis done
   }
   ```
   
   `jarClasses` and `rootEntries` are set by the analysis pipeline but can be 
`null` if analysis is skipped or fails (e.g., null manifest, IO error). This 
makes `JarData` fragile when used outside the expected analysis flow.
   
   **Fix**: Add null checks before delegation, e.g.:
   ```java
   public boolean isDebugPresent() {
       return jarClasses != null && jarClasses.isDebugPresent();
   }
   ```


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