Mantis - Resin
Viewing Issue Advanced Details
3236 trivial always 01-09-09 18:46 01-12-09 16:39
koreth  
ferg  
normal  
closed 4.0.0  
fixed  
none    
none 4.0.0  
0003236: Patch: Get rid of some unnecessary NPEs
When I run under a debugger and break on NPEs, it's annoying to get lots of false hits from OsgiManager. So here's a patch to get rid of its NPEs. (Whether the fact that I'm getting them is a symptom of something else, I can't say, but from the structure of the code it looks like exceptions are totally expected here.)

--- a/modules/kernel/src/com/caucho/osgi/OsgiManager.java
+++ b/modules/kernel/src/com/caucho/osgi/OsgiManager.java
@@ -349,9 +349,11 @@ public class OsgiManager
     synchronized (_exportMap) {
       loader = _publishedExportMap.get(packageName);
 
- try {
- return loader.getResource(name);
- } catch (Exception e) {
+ if (loader != null) {
+ try {
+ return loader.getResource(name);
+ } catch (Exception e) {
+ }
       }
     }

There are no notes attached to this issue.