Hi,

I apologize in advance if I am breaking convention or emailing the wrong list 
or such, This is one of the first open source projects I have worked on. 

My name is Jason Lawer, I'm a Technical Support Engineer for Red Hat and I just 
finished assisting a client with an issue with Red Hat Satellite 5.3 (based on 
spacewalk). I found an edge case where spacewalk will give a 
NullPointerException in if the /etc/rhn/default directory is present but has 
either incorrect permissions or is empty. I whipped up a 4 line patch to check 
for the condition and log it, and thought I should submit it. As I am a Red Hat 
Employee I am unsure if I need to fill out a Contributor License Agreement, but 
If I need to I can have one done pretty quickly. 

Let me know if I need to change anything to get this included or if I have 
handled the error in the wrong way.


-- 
Kind Regards,
Jason Lawer

-- 
Jason Lawer
Technical Support Engineer
Red Hat Asia-Pacific - Brisbane
>From 8ee05128d16ee74bc0e214b369b6e852db075d39 Mon Sep 17 00:00:00 2001
From: Jason Lawer <[email protected]>
Date: Thu, 4 Mar 2010 10:10:43 +1000
Subject: [PATCH] Added catch for NullPointerException when listing default directory

---
 .../src/com/redhat/rhn/common/conf/Config.java     |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/java/code/src/com/redhat/rhn/common/conf/Config.java b/java/code/src/com/redhat/rhn/common/conf/Config.java
index eb5ee9a..89b3b65 100644
--- a/java/code/src/com/redhat/rhn/common/conf/Config.java
+++ b/java/code/src/com/redhat/rhn/common/conf/Config.java
@@ -400,6 +400,10 @@ public class Config {
         if (f.isDirectory()) {
             // bugzilla: 154517; only add items that end in .conf
             File[] files = f.listFiles();
+            if (files == null) {
+                logger.error("Unable to list files in path : " + path);
+                return;
+            }
             for (int i = 0; i < files.length; i++) {
                 if (files[i].getName().endsWith((".conf"))) {
                     fileList.add(files[i]);
-- 
1.7.0.1

_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to