Copilot commented on code in PR #433:
URL: https://github.com/apache/uima-uimaj/pull/433#discussion_r2362417338


##########
uima-bnd-plugin/src/main/java/org/apache/uima/tools/bnd/UimaBndPlugin.java:
##########
@@ -132,18 +149,30 @@ private void handleImportByName(Analyzer analyzer, String 
path, Import imp)
             tsdPackage = tsdPackage.substring(0, lastSeparatorPosition);
         }
 
-        LOG.debug("Found UIMA type system import by name: {}", tsdPackage);
-
         var pack = analyzer.getPackageRef(tsdPackage);
         if (!QN.matcher(pack.getFQN()).matches()) {
-            analyzer.warning("Type system import does not seem to refer to a 
package (%s): %s",
-                    path, pack);
+            analyzer.warning("Import does not seem to refer to a package (%s): 
%s", path, pack);
         }
 
-        if (!analyzer.getReferred().containsKey(pack)) {
+        var alreadyKnownImport = analyzer.getReferred().containsKey(pack);
+        if (!alreadyKnownImport) {
             var attrs = new Attrs();
             analyzer.getReferred().put(pack, attrs);
         }
+
+        LOG.debug("{}Found UIMA import by name: {} {}", repeat("  ", level), 
tsdPackage, alreadyKnownImport ? "" : "(new)");
+        
+        var importedResourcePath = imp.getName().replace('.', '/') + ".xml";
+        var importedResource = analyzer.findResource(importedResourcePath);
+        if (importedResource == null) {
+            analyzer.warning("Imported resource not found on classpath: {}", 
importedResourcePath);
+            return;
+        }
+
+        if (configuration.transitive(false)) {
+            LOG.debug("");

Review Comment:
   Empty debug log statement serves no purpose and should be removed. If this 
was intended for spacing in log output, consider adding a meaningful message or 
removing it entirely.
   ```suggestion
   
   ```



##########
uima-bnd-plugin/src/main/java/org/apache/uima/tools/bnd/UimaBndPlugin.java:
##########
@@ -132,18 +149,30 @@ private void handleImportByName(Analyzer analyzer, String 
path, Import imp)
             tsdPackage = tsdPackage.substring(0, lastSeparatorPosition);
         }
 
-        LOG.debug("Found UIMA type system import by name: {}", tsdPackage);
-
         var pack = analyzer.getPackageRef(tsdPackage);
         if (!QN.matcher(pack.getFQN()).matches()) {
-            analyzer.warning("Type system import does not seem to refer to a 
package (%s): %s",
-                    path, pack);
+            analyzer.warning("Import does not seem to refer to a package (%s): 
%s", path, pack);
         }
 
-        if (!analyzer.getReferred().containsKey(pack)) {
+        var alreadyKnownImport = analyzer.getReferred().containsKey(pack);
+        if (!alreadyKnownImport) {
             var attrs = new Attrs();
             analyzer.getReferred().put(pack, attrs);
         }
+
+        LOG.debug("{}Found UIMA import by name: {} {}", repeat("  ", level), 
tsdPackage, alreadyKnownImport ? "" : "(new)");
+        
+        var importedResourcePath = imp.getName().replace('.', '/') + ".xml";
+        var importedResource = analyzer.findResource(importedResourcePath);
+        if (importedResource == null) {
+            analyzer.warning("Imported resource not found on classpath: {}", 
importedResourcePath);
+            return;
+        }
+
+        if (configuration.transitive(false)) {

Review Comment:
   Potential null pointer exception if configuration is null. The configuration 
field should be checked for null before calling methods on it, or initialized 
with a default value in the constructor.
   ```suggestion
           if (configuration != null ? configuration.transitive(false) : false) 
{
   ```



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