Author: jwross
Date: Wed Feb 19 15:45:17 2014
New Revision: 1569792

URL: http://svn.apache.org/r1569792
Log:
Add debug logging for unrecognized resources in the subsystem archive.

Subsystems will now output a debug logging message when an unrecognized 
resource is encountered in the subsystem archive. The
level is debug because of the possibility of false positives if the provider 
knowingly stored resources in the archive that
are neither bundles nor subsystems. The following is an example of what the 
output might look like.

File "bundle.a.jar" in subsystem with location
"file:/C:/Users/IBM_AD~1/AppData/Local/Temp/paxexam_runner_jwrossjr/application.a.esa"
 will be ignored because it is not
recognized as a supported resource
org.apache.aries.application.modelling.ModellerException: 
org.apache.aries.application.modelling.ModellerException:
org.osgi.service.blueprint.container.ComponentDefinitionException: One of ref 
attribute, bean element, reference element or
ref element must be set
        at
org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl.getServiceElements(ModelledResourceManagerImpl.java:128)
        at
org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl.getServiceElements(ModelledResourceManagerImpl.java:95)
...

Modified:
    
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Location.java
    
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RawSubsystemResource.java

Modified: 
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Location.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Location.java?rev=1569792&r1=1569791&r2=1569792&view=diff
==============================================================================
--- 
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Location.java
 (original)
+++ 
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Location.java
 Wed Feb 19 15:45:17 2014
@@ -138,5 +138,10 @@ public class Location {
     }
     throw new IOException("cannot find IDirectory corresponding to id " + uri);
   }
+  
+  @Override
+  public String toString() {
+         return value;
+  }
 
 }

Modified: 
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RawSubsystemResource.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RawSubsystemResource.java?rev=1569792&r1=1569791&r2=1569792&view=diff
==============================================================================
--- 
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RawSubsystemResource.java
 (original)
+++ 
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RawSubsystemResource.java
 Wed Feb 19 15:45:17 2014
@@ -60,8 +60,12 @@ import org.osgi.service.repository.Repos
 import org.osgi.service.resolver.ResolutionException;
 import org.osgi.service.subsystem.Subsystem.State;
 import org.osgi.service.subsystem.SubsystemConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class RawSubsystemResource implements Resource {
+       private static final Logger logger = 
LoggerFactory.getLogger(RawSubsystemResource.class);
+       
        private static final Pattern PATTERN = 
Pattern.compile("([^@/\\\\]+)(?:@(.+))?.esa");
        private static final String APPLICATION_IMPORT_SERVICE_HEADER = 
"Application-ImportService";
        
@@ -403,6 +407,9 @@ public class RawSubsystemResource implem
                                        }
                                        catch (Exception e) {
                                                // Ignore if the resource is an 
invalid bundle or not a bundle at all.
+                                               if (logger.isDebugEnabled()) {
+                                                       logger.debug("File \"" 
+ file.getName() + "\" in subsystem with location \"" + location + "\" will be 
ignored because it is not recognized as a supported resource", e);
+                                               }
                                        }
                                }
                        }
@@ -415,6 +422,9 @@ public class RawSubsystemResource implem
                                        }
                                        catch (Exception e) {
                                                // Ignore
+                                               if (logger.isDebugEnabled()) {
+                                                       logger.debug("File \"" 
+ file.getName() + "\" in subsystem with location \"" + location + "\" will be 
ignored because it is not recognized as a supported resource", e);
+                                               }
                                        }
                                }
                        }


Reply via email to