Re: [Spacewalk-devel] [PATCH] Fix NPE when uploading kickstart profile

2013-12-18 Thread Stephen Herr
Ah, yeah thanks for catching that. The patch makes perfect sense. 
Committing as:

4003937da4077c674d6b60b52a506da5728a37ef

-Stephen

On 12/18/2013 05:39 AM, Johannes Renner wrote:

Hey,

we found that one of your recent bugfixes (see 009fab0) causes a NPE when trying
to upload a kickstart profile with Virtualization Type set to "None".

Consider to apply the attached patch after review to fix the problem.

Thank you,
Johannes



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


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


[Spacewalk-devel] [PATCH] Fix NPE when uploading kickstart profile

2013-12-18 Thread Johannes Renner
Hey,

we found that one of your recent bugfixes (see 009fab0) causes a NPE when trying
to upload a kickstart profile with Virtualization Type set to "None".

Consider to apply the attached patch after review to fix the problem.

Thank you,
Johannes

-- 
SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg)
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
>From dbe021e76741e7f8a503ad37021e78deeeb13c3f Mon Sep 17 00:00:00 2001
From: Johannes Renner 
Date: Wed, 18 Dec 2013 11:32:26 +0100
Subject: [PATCH] Fix NPE when uploading kickstart profile with virt type none

---
 .../frontend/action/kickstart/KickstartDetailsEditAction.java  | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartDetailsEditAction.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartDetailsEditAction.java
index 850dba5..0dfda3d 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartDetailsEditAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartDetailsEditAction.java
@@ -290,9 +290,11 @@ public class KickstartDetailsEditAction extends BaseKickstartEditAction {
  */
 public static void processCobblerFormValues(KickstartData ksdata, DynaActionForm form,
 User user) throws ValidatorException {
-int virtMemory = (Integer) form.get(VIRT_MEMORY);
-if (ksdata.isRhel7OrGreater() && virtMemory < 768) {
-ValidatorException.raiseException("kickstart.cobbler.profile.notenoughmemory");
+if (KickstartDetailsEditAction.canSaveVirtOptions(ksdata, form)) {
+int virtMemory = (Integer) form.get(VIRT_MEMORY);
+if (ksdata.isRhel7OrGreater() && virtMemory < 768) {
+ValidatorException.raiseException("kickstart.cobbler.profile.notenoughmemory");
+}
 }
 
 CobblerProfileEditCommand cmd = new CobblerProfileEditCommand(ksdata, user);
@@ -309,7 +311,7 @@ public class KickstartDetailsEditAction extends BaseKickstartEditAction {
 }
 
 if (KickstartDetailsEditAction.canSaveVirtOptions(ksdata, form)) {
-prof.setVirtRam(virtMemory);
+prof.setVirtRam((Integer) form.get(VIRT_MEMORY));
 prof.setVirtCpus((Integer) form.get(VIRT_CPU));
 prof.setVirtFileSize((Integer) form.get(VIRT_DISK_SIZE));
 prof.setVirtBridge(form.getString(VIRT_BRIDGE));
-- 
1.8.1.4

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