Re: [Spacewalk-devel] [PATCH] Added NULL checks in setMaxFlex() and setMaxMembers()

2011-01-27 Thread Jan Pazdziora
On Thu, Jan 27, 2011 at 10:07:57AM +0530, Paresh Mutha wrote:
 Hello,
 
 I am proposing a patch which includes NULL checks for setMaxFlex()
 and setMaxMembers() in ChannelOverview.java.
 
 Without that, in few cases where maxFlex or maxMembers were null, it
 led to NullPointerException and page 
 https://server.example.com/rhn/admin/multiorg/OrgSoftwareSubscriptions.do?oid=orgid
 failed with an ISE.
 
 We already have a bugzilla created for RHN Satellite v5.4 -
 https://bugzilla.redhat.com/show_bug.cgi?id=671450

Paresh,

did you investigate why (in which situation) does the setMaxFlex
and/or setMaxMembers get called with null? Shouldn't/couldn't we
handle this on the caller's side, rather than in the setter?

-- 
Jan Pazdziora
Principal Software Engineer, Satellite Engineering, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] [PATCH] Added NULL checks in setMaxFlex() and setMaxMembers()

2011-01-27 Thread Paresh Mutha
Yes but couldn't reach to any conclusion. In reply to your query, I just 
posted a comment in the satellite bugzilla - 
https://bugzilla.redhat.com/show_bug.cgi?id=671450#c6


- Paresh

On 01/27/2011 01:19 PM, Jan Pazdziora wrote:

On Thu, Jan 27, 2011 at 10:07:57AM +0530, Paresh Mutha wrote:

Hello,

I am proposing a patch which includes NULL checks for setMaxFlex()
and setMaxMembers() in ChannelOverview.java.

Without that, in few cases where maxFlex or maxMembers were null, it
led to NullPointerException and page 
https://server.example.com/rhn/admin/multiorg/OrgSoftwareSubscriptions.do?oid=orgid
failed with an ISE.

We already have a bugzilla created for RHN Satellite v5.4 -
https://bugzilla.redhat.com/show_bug.cgi?id=671450


Paresh,

did you investigate why (in which situation) does the setMaxFlex
and/or setMaxMembers get called with null? Shouldn't/couldn't we
handle this on the caller's side, rather than in the setter?



___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


[Spacewalk-devel] [PATCH] Added NULL checks in setMaxFlex() and setMaxMembers()

2011-01-26 Thread Paresh Mutha

Hello,

I am proposing a patch which includes NULL checks for setMaxFlex() and 
setMaxMembers() in ChannelOverview.java.


Without that, in few cases where maxFlex or maxMembers were null, it led 
to NullPointerException and page 
https://server.example.com/rhn/admin/multiorg/OrgSoftwareSubscriptions.do?oid=orgid 
failed with an ISE.


We already have a bugzilla created for RHN Satellite v5.4 - 
https://bugzilla.redhat.com/show_bug.cgi?id=671450


Regards,
Paresh
From 0bbf4b16fb3b439acc8a761535182a96df63e9e6 Mon Sep 17 00:00:00 2001
From: Paresh Mutha pmu...@redhat.com
Date: Thu, 27 Jan 2011 10:01:19 +0530
Subject: [PATCH] Added NULL checks in setMaxFlex() and setMaxMembers()
 Signed-off-by: Paresh Mutha pmu...@redhat.com

---
 .../redhat/rhn/frontend/dto/ChannelOverview.java   |   14 --
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java 
b/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java
index 0eb5ae0..ba623fb 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java
@@ -90,7 +90,12 @@ public class ChannelOverview extends BaseDto implements 
Comparable {
  * @param maxFlexIn The maxFlex to set.
  */
 public void setMaxFlex(Long maxFlexIn) {
-this.maxFlex = maxFlexIn;
+if(maxFlexIn == null){
+this.maxFlex = new Long(0L);
+}
+else{
+this.maxFlex = maxFlexIn;
+}
 }
 
 /**
@@ -224,7 +229,12 @@ public class ChannelOverview extends BaseDto implements 
Comparable {
  * @param maxMembersIn The maxMembers to set.
  */
 public void setMaxMembers(Long maxMembersIn) {
-this.maxMembers = maxMembersIn;
+if(maxMembersIn == null){
+this.maxMembers = new Long(0L);
+}
+else{
+this.maxMembers = maxMembersIn;
+}
 }
 
 /**
-- 
1.7.2.3

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel