You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/05/02 10:37:24 UTC

[GitHub] [maven-dependency-plugin] pzygielo opened a new pull request #47: Fix possible NPEx

pzygielo opened a new pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47


   Due to possibility of `recommendedVersion` being null.
   
   ---
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [X] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
   


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

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



[GitHub] [maven-dependency-plugin] pzygielo commented on pull request #47: Fix possible NPEx

Posted by GitBox <gi...@apache.org>.
pzygielo commented on pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47#issuecomment-629036073


   @michael-o may I ask for review, please?


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

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



[GitHub] [maven-dependency-plugin] pzygielo commented on pull request #47: Fix possible NPEx

Posted by GitBox <gi...@apache.org>.
pzygielo commented on pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47#issuecomment-635606985


   @michael-o thanks for checking and processing paper-work in JIRA.


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

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



[GitHub] [maven-dependency-plugin] pzygielo commented on a change in pull request #47: Fix possible NPEx

Posted by GitBox <gi...@apache.org>.
pzygielo commented on a change in pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47#discussion_r418949044



##########
File path: src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java
##########
@@ -479,9 +479,12 @@ public static boolean containsVersion( VersionRange allowedRange, ArtifactVersio
                     return true;
                 }
             }
+            return false;
+        }
+        else
+        {
+            // only singular versions ever have a recommendedVersion
+            return recommendedVersion.compareTo(theVersion) <= 0;

Review comment:
       Corrected. :cry: I don't know how it happened as it is clearly reported by `verify`.




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

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



[GitHub] [maven-dependency-plugin] pzygielo commented on a change in pull request #47: Fix possible NPEx

Posted by GitBox <gi...@apache.org>.
pzygielo commented on a change in pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47#discussion_r418956128



##########
File path: src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo_ContainsVersion.java
##########
@@ -0,0 +1,51 @@
+package org.apache.maven.plugins.dependency.tree;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.Restriction;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+import java.util.Collections;
+
+import static org.apache.maven.plugins.dependency.tree.TreeMojo.containsVersion;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests <code>TreeMojo.containsVersion</code>.
+ */
+public class TestTreeMojo_ContainsVersion extends TestCase

Review comment:
       > still have to learn why `checkstyle-check` does not complain for these violations in `src/test`.
   
   I guess due to [includeTestSourceDirectory](https://maven.apache.org/plugins/maven-checkstyle-plugin/check-mojo.html#includeTestSourceDirectory) having `Default: false`.
   
   So [maven-parent](https://github.com/apache/maven-parent/blob/e4db8ae90caac88fb206c9003a93465172b9b86a/pom.xml#L984) adds `testSourceDirectory` but does not set `includeTestSourceDirectory`.




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

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



[GitHub] [maven-dependency-plugin] michael-o commented on pull request #47: Fix possible NPEx

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47#issuecomment-635375948


   Looking into...in an hour!


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

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



[GitHub] [maven-dependency-plugin] michael-o commented on a change in pull request #47: Fix possible NPEx

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47#discussion_r418947443



##########
File path: src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java
##########
@@ -479,9 +479,12 @@ public static boolean containsVersion( VersionRange allowedRange, ArtifactVersio
                     return true;
                 }
             }
+            return false;
+        }
+        else
+        {
+            // only singular versions ever have a recommendedVersion
+            return recommendedVersion.compareTo(theVersion) <= 0;

Review comment:
       Spaces missing

##########
File path: src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo_ContainsVersion.java
##########
@@ -0,0 +1,51 @@
+package org.apache.maven.plugins.dependency.tree;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.Restriction;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+import java.util.Collections;
+
+import static org.apache.maven.plugins.dependency.tree.TreeMojo.containsVersion;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests <code>TreeMojo.containsVersion</code>.
+ */
+public class TestTreeMojo_ContainsVersion extends TestCase

Review comment:
       Same here thoughout the class.




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

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



[GitHub] [maven-dependency-plugin] pzygielo commented on a change in pull request #47: Fix possible NPEx

Posted by GitBox <gi...@apache.org>.
pzygielo commented on a change in pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47#discussion_r418951502



##########
File path: src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo_ContainsVersion.java
##########
@@ -0,0 +1,51 @@
+package org.apache.maven.plugins.dependency.tree;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.Restriction;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+import java.util.Collections;
+
+import static org.apache.maven.plugins.dependency.tree.TreeMojo.containsVersion;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests <code>TreeMojo.containsVersion</code>.
+ */
+public class TestTreeMojo_ContainsVersion extends TestCase

Review comment:
       Spaces corrected, but still have to learn why `checkstyle-check` does not complain for these violations in `src/test`.




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

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



[GitHub] [maven-dependency-plugin] michael-o commented on pull request #47: Fix possible NPEx

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47#issuecomment-629105668


   @pzygielo I will pick up your PRs this night. Currently busy. Thank you for your time and effort!


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

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



[GitHub] [maven-dependency-plugin] asfgit closed pull request #47: Fix possible NPEx

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #47:
URL: https://github.com/apache/maven-dependency-plugin/pull/47


   


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

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