matthiasblaesing commented on code in PR #5866:
URL: https://github.com/apache/netbeans/pull/5866#discussion_r1176902776


##########
enterprise/web.jsf/src/org/netbeans/modules/web/jsf/wizards/PersistenceClientIterator.java:
##########
@@ -632,8 +632,18 @@ private static boolean showImportStatement(String 
packageName, String fqn) {
     }
 
     private static boolean isCdiEnabled(Project project) {
-        CdiUtil cdiUtil = project.getLookup().lookup(CdiUtil.class);
-        return (cdiUtil == null) ? false : cdiUtil.isCdiEnabled();
+        WebModule wm = WebModule.getWebModule(project.getProjectDirectory());

Review Comment:
   I don't see an issue, this should work:
   
   ```java
       private static boolean isCdiEnabled(Project project) {
           org.netbeans.modules.jakarta.web.beans.CdiUtil jakartaCdiUtil = 
project.getLookup().lookup(org.netbeans.modules.jakarta.web.beans.CdiUtil.class);
           if(jakartaCdiUtil != null && jakartaCdiUtil.isCdiEnabled()) {
               return true;
           }
           org.netbeans.modules.web.beans.CdiUtil javaxCdiUtil = 
project.getLookup().lookup(org.netbeans.modules.web.beans.CdiUtil.class);
           if(javaxCdiUtil != null && javaxCdiUtil.isCdiEnabled()) {
               return true;
           }
           return false;
       }
   ```
   
   If the classes could not be loaded, it would blow up anyway as 
`PersistenceClientIterator` could not be loaded then. For exceptions from the 
`lookup` method:
   
   
https://bits.netbeans.org/17/javadoc/org-openide-util-lookup/org/openide/util/Lookup.html#lookup-java.lang.Class-
   
   > **Returns:**
   > an object implementing the given class or null if no such implementation 
is found
   
   So if the corresponding CdiUtil is present, then it is used else it is null 
and not checked.



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