You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by GitBox <gi...@apache.org> on 2022/07/20 10:01:02 UTC

[GitHub] [felix-dev] HannesWell commented on a diff in pull request #169: FELIX-6548 prevent NPE in "manifest" goal with parent outside reactor

HannesWell commented on code in PR #169:
URL: https://github.com/apache/felix-dev/pull/169#discussion_r925412592


##########
tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java:
##########
@@ -428,15 +428,27 @@ private boolean isMetadataUpToDate(File outputFile, MavenProject project)
             // generated last?
             Path cacheData = getIncrementalDataPath(project);
             if(!Files.isRegularFile(cacheData)) {
+                getLog().debug("No cache data file found at '" + cacheData + "', generating manifest.");
                 return false;
             }
             long manifestLastModified = lastModified(cacheData);
             while (project != null)
             {
-                Path pom = project.getFile().toPath();
-                if (manifestLastModified < lastModified(pom))
-                {
-                    return false;
+                if (project.getFile() != null) {
+                    Path pom = project.getFile().toPath();
+                    if (manifestLastModified < lastModified(pom))
+                    {
+                        getLog().debug("File at  '" + pom + "' newer than cache data file, generating manifest.");

Review Comment:
   What about "POM-file at..."? I think the meaning is even then correct if it is not a pom.xml but e.g. a polyglot POM file.



##########
tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java:
##########
@@ -428,15 +428,27 @@ private boolean isMetadataUpToDate(File outputFile, MavenProject project)
             // generated last?
             Path cacheData = getIncrementalDataPath(project);
             if(!Files.isRegularFile(cacheData)) {
+                getLog().debug("No cache data file found at '" + cacheData + "', generating manifest.");
                 return false;
             }
             long manifestLastModified = lastModified(cacheData);
             while (project != null)
             {
-                Path pom = project.getFile().toPath();
-                if (manifestLastModified < lastModified(pom))
-                {
-                    return false;
+                if (project.getFile() != null) {
+                    Path pom = project.getFile().toPath();
+                    if (manifestLastModified < lastModified(pom))
+                    {
+                        getLog().debug("File at  '" + pom + "' newer than cache data file, generating manifest.");
+                        return false;
+                    }
+                } else {
+                    if (project.getVersion().endsWith("-SNAPSHOT")) { // is it mutable?
+                        getLog().debug("pom.xml file not found for SNAPSHOT project'" + project + "', assume modification.");
+                        return false;
+                    } else {
+                        getLog().debug("pom.xml file not found for non-SNAPSHOT project'" + project + "', assume no modification.");
+                        break;

Review Comment:
   Why not continue to search the parent-hierarchy in this case?
   



-- 
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: dev-unsubscribe@felix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org