You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Thomas Diesler (JIRA)" <ji...@apache.org> on 2009/07/13 09:13:15 UTC
[jira] Commented: (FELIX-1124) ResourceNotFoundException too
verbose
[ https://issues.apache.org/jira/browse/FELIX-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12730236#action_12730236 ]
Thomas Diesler commented on FELIX-1124:
---------------------------------------
Yes, I confirmed (with the debugger) the stack trace is indeed thrown at the location that I mentioned above.
Here the full stack trace for the example that you show.
2009-07-13 08:55:16,446 DEBUG [org.jboss.osgi.felix.framework.FelixLogger] does/not/exist.txt
org.apache.felix.moduleloader.ResourceNotFoundException: does/not/exist.txt
at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:631)
at org.apache.felix.framework.searchpolicy.ModuleImpl.getResourceByDelegation(ModuleImpl.java:497)
at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.getResource(ModuleImpl.java:1654)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1168)
at org.jboss.test.osgi.example.simple.bundle.SimpleActivator.start(SimpleActivator.java:46)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1461)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:779)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:760)
Perhaps you do not have a LogService installed, which would show you the stack trace of the ResourceNotFoundException.
My suggested fix would be
ModuleImpl:503
catch (ResourceNotFoundException ex)
{
// [FELIX-1124] ResourceNotFoundException too verbose
m_logger.log(Logger.LOG_DEBUG, ex.getMessage());
}
> ResourceNotFoundException too verbose
> -------------------------------------
>
> Key: FELIX-1124
> URL: https://issues.apache.org/jira/browse/FELIX-1124
> Project: Felix
> Issue Type: Bug
> Components: Framework
> Affects Versions: felix-1.6.1, felix-1.8.0, felix-1.8.1
> Reporter: Thomas Diesler
>
> ModuleImpl logs stack traces for every resource that cannot be found. Often resources are optional or may be located at different locations.
> public URL getResourceByDelegation(String name)
> {
> try
> {
> return (URL) findClassOrResourceByDelegation(name, false);
> }
> catch (ClassNotFoundException ex)
> {
> // This should never be thrown because we are loading resources.
> }
> catch (ResourceNotFoundException ex)
> {
> m_logger.log(
> Logger.LOG_DEBUG,
> ex.getMessage(),
> ex);
> }
> return null;
> }
> Please consider a log message without stack trace and leave it to the client to be more verbose when appropriate.
> To log no message at all and simply return null would also be consistent with
> http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.