Hey, I am experiencing a bug, but I am working with Spacewalk 1.2 based code. Unfortunately I don't have a recent spacewalk installation available to see if it's happening there as well. It would be nice if somebody could try to reproduce this issue, which would show me if I am just missing a recent commit or if there is a bug. Here the instructions:
In the Web UI: - Select a system via 'Systems' (click on one of the systems) - Go to 'Software' - Choose one of the options, e.g. 'Install New Packages' - Choose one or more packages to be installed and submit - Click on the button 'Add Remote Command to Package Install' - Fill out the form (i.e. add script content) and submit Result: There is an internal server error caused by a NullPointerException at com.redhat.rhn.domain.action.script.ScriptAction.setScriptActionDetails(ScriptAction.java:38 If it can be reproduced, I will open a bug on bugzilla.redhat.com. Here is my patch, but I'm not sure if this is the right way to go: After the NPE is fixed within ScriptAction.java there appears to be a problem with the redirect. Since HTTP GET method is used for the redirect, but the 'submitted' parameter is still there, we get a 405. This can be fixed by removing the 'submitted' parameter before actually doing the redirect. Thanks, Johannes -- SUSE LINUX Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
>From d9fa52242fdae2302d4d1ba06eb2c181df0ba6ed Mon Sep 17 00:00:00 2001 From: Johannes Renner <jren...@suse.de> Date: Thu, 8 Sep 2011 14:58:43 +0200 Subject: [PATCH] Fix NPE when scheduling a package action + remote command --- .../rhn/domain/action/script/ScriptAction.java | 4 +++- .../action/rhnpackage/ScheduleRemoteCommand.java | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/java/code/src/com/redhat/rhn/domain/action/script/ScriptAction.java b/java/code/src/com/redhat/rhn/domain/action/script/ScriptAction.java index 071a5eb..a0e453f 100644 --- a/java/code/src/com/redhat/rhn/domain/action/script/ScriptAction.java +++ b/java/code/src/com/redhat/rhn/domain/action/script/ScriptAction.java @@ -35,7 +35,9 @@ public class ScriptAction extends Action { * @param scriptActionDetailsIn The scriptActionDetails to set. */ public void setScriptActionDetails(ScriptActionDetails scriptActionDetailsIn) { - scriptActionDetailsIn.setParentAction(this); + if (scriptActionDetailsIn != null) { + scriptActionDetailsIn.setParentAction(this); + } scriptActionDetails = scriptActionDetailsIn; } diff --git a/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ScheduleRemoteCommand.java b/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ScheduleRemoteCommand.java index d3a9ae8..40b2481 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ScheduleRemoteCommand.java +++ b/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ScheduleRemoteCommand.java @@ -40,6 +40,7 @@ import org.apache.struts.action.DynaActionForm; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -92,9 +93,11 @@ public class ScheduleRemoteCommand extends RhnAction { strutsDelegate.saveMessages(request, msgs); String mode = (String) f.get("mode"); + Map params = new HashMap(request.getParameterMap()); + params.remove(RhnAction.SUBMITTED); forward = strutsDelegate.forwardParams( mapping.findForward(getForward(mode)), - request.getParameterMap()); + params); } return forward; -- 1.7.3.4
_______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel