mbien commented on code in PR #7158:
URL: https://github.com/apache/netbeans/pull/7158#discussion_r1525798672


##########
java/maven.hints/src/org/netbeans/modules/maven/hints/pom/ParentVersionError.java:
##########
@@ -107,7 +108,17 @@ public List<ErrorDescription> 
getErrorsForDocument(POMModel model, Project prj)
                     if (parentPrj != null) {
                         NbMavenProject nbprj = 
parentPrj.getLookup().lookup(NbMavenProject.class);
                         if (nbprj != null) { //do we have some non-maven 
project maybe?
-                            MavenProject mav = nbprj.getMavenProject();
+                            MavenProject mav = nbprj.getMavenProject();  
+                            
if(PomModelUtils.isPropertyExpression(declaredVersion)){
+                                String key = 
PomModelUtils.getPropertyName(declaredVersion);
+                                String propVal = 
PomModelUtils.getProperty(model, declaredVersion);
+                                if(propVal != null){
+                                    declaredVersion = propVal;
+                                }
+                                else {
+                                    declaredVersion = 
mav.getProperties().getProperty(key, declaredVersion);
+                                }
+                            }

Review Comment:
   i think what you want to do is this:
   ```java
                               MavenProject mav = nbprj.getMavenProject();
                               if 
(PomModelUtils.isPropertyExpression(declaredVersion)) {
                                   String propVal = 
PomModelUtils.getProperty(model, declaredVersion);
                                   if (propVal != null) {
                                       declaredVersion = propVal;
                                   }
                               }
   ```
   since `PomModelUtils.getProperty` is already doing what you put into the 
else branch.
   
   I did also format it using NB default formatting. e.g space after `if` etc - 
feel free to paste it if its what you intended.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to