Skip to content

SonarCloud fix: java:S125 Sections of code should not be commented out #10394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ private Collection<Object> executeElaboratorBatch(List<Object> resultList, Mode
parametersIn != null ? new HashMap<>(parametersIn) : new HashMap<>();

if (len == 0) {
// Nothing to elaborate, just return;
// Nothing to elaborate, just return
return resultList;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,20 +481,18 @@ protected Object lockObject(Class clazz, Serializable id) {
* @param <T> the entity type
*/
public static <T> T reload(T obj) throws HibernateException {
// assertNotNull(obj);
ClassMetadata cmd = connectionManager.getMetadata(obj);
Serializable id = cmd.getIdentifier(obj, (SessionImplementor) getSession());
Session session = getSession();
session.flush();
session.evict(obj);
/*
* In hibernate 3, the following doesn't work:
* session.load(obj.getClass(), id);
* session.load(obj.getClass(), id)
* load returns the proxy class instead of the persisted class, ie,
* Filter$$EnhancerByCGLIB$$9bcc734d_2 instead of Filter.
* session.get is set to not return the proxy class, so that is what we'll use.
*/
// assertNotSame(obj, result);
return (T) session.get(obj.getClass(), id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public ActionFormatter getFormatter() {

@Override
public String getHistoryDetails(Server server, User currentUser) {
// LocalizationService ls = LocalizationService.getInstance();
StringBuilder retval = new StringBuilder();
retval.append("</br>");
for (ApplyStatesActionResult result : getDetails().getResults()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ public static ConfigChannel createNewLocalChannel(Server server,
//TODO: put the following line back. It is not here now because Server.findLocal
// does this task for us. It belongs here, but this would currently cause
// an infinite loop based on how setSandboxOverride works.
//server.setSandboxOverride(retval);
//server.setSandboxOverride(retval)
commit(retval);

return retval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ public ActionForward execute(ActionMapping mapping,

// used to schedule an asynchronous action to clone errata because it was
// so slow. Is much faster now, just do inline.
//Set<Long> errataIds = RhnSetDecl.setForChannelErrata(currentChan).get(
// user).getElementValues();
//ErrataManager.publishErrataToChannelAsync(currentChan, errataIds, user);
List<ErrataOverview> errata = ErrataManager.errataInSet(user,
RhnSetDecl.setForChannelErrata(currentChan).get(user).getLabel())
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ public class BaseSubscribeAction extends RhnLookupDispatchAction {
static final String UNMATCHED_CHILD_CHANNELS = "unmatched_child_channels";
static final String FOUND_UNMATCHED_CHANNELS = "foundUnmatchedChannels";

/*
Map<Long, List<Long>> successes = new HashMap<Long, List<Long>>();
Map<Long, List<Long>> failures = new HashMap<Long, List<Long>>();
Map<Long, List<Long>> skipped = new HashMap<Long, List<Long>>();
*/


@Override
protected Map<String, String> getKeyMethodMap() {
Map<String, String> map = new HashMap<>();
Expand Down Expand Up @@ -209,7 +202,7 @@ public ActionForward confirmUpdateBaseChannels(ActionMapping mapping,
List<Long> servers = serversInSSMWithBase(user, oldBaseChannelId);
List<Server> skippedServers = new LinkedList<>();

// Check if for all servers in the set we can guess base channel;
// Check if for all servers in the set we can guess base channel
// if not add them to the skipped list
for (Long sId : servers) {
Server server = SystemManager.lookupByIdAndUser(sId, user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public ActionForward operateOnDiff(ActionMapping mapping,
log.debug("operateOnDiff called");

User user = new RequestContext(request).getCurrentUser();
// RhnSet originalSet = getSetDecl().get(user);

RhnSet currentset = updateSet(request);
RhnSetManager.store(currentset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ private StreamInfo manualServeByteRange(HttpServletResponse response, String dis
// class instead of using parent execute() (and copy()).
// New copy() method will take into account Content-Range header in response
// and copy only these bytes. Uncomment after fixing following line:
// return getStreamForPath(diskPath, CONTENT_TYPE_OCTET_STREAM);
// return getStreamForPath(diskPath, CONTENT_TYPE_OCTET_STREAM)

// gotta make sure it is end + 1
byte[] chunk = FileUtils.readByteArrayFromFile(actualFile, start, end + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected ActionForward doCopy(ActionMapping mapping,
// for each destination
// find the dest-channel
// for each file
// cm.copyConfigFile(file.latest.revision, dest-chan, usr);
// cm.copyConfigFile(file.latest.revision, dest-chan, usr)
//
for (Object oIn : destSet) {
Long destid = ((RhnSetElement) oIn).getElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public ActionForward execute(ActionMapping mapping, ActionForm form,
msgs.add(ActionMessages.GLOBAL_MESSAGE, am);
/*
* Although I would like to just do:
* ConfigActionHelper.processParamMap(request, params);
* ConfigActionHelper.processParamMap(request, params)
* The revision from the request is the one we just deleted,
* so this would cause a LookupException.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private int importSelected(HttpServletRequest request) {

/*
* To accomplish this task, I would like to just do the following line
* importSet.getElements().addAll(selectedSet.getElements());
* importSet.getElements().addAll(selectedSet.getElements())
*
* However, this does not work, because RhnSetElement contains member
* variables for the user and set label, even though the element is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public class UnsubscribeConfirmAction extends BaseListAction {

/*
/**
* {@inheritDoc}
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public void setUp() throws Exception {
user.addPermanentRole(RoleFactory.ORG_ADMIN);
UserFactory.save(user);
ksdata = KickstartDataTest.createKickstartWithOptions(user.getOrg());
// ksdata = KickstartDataTest.createKickstartWithChannel(user.getOrg());
mockRequest = new RhnMockHttpServletRequest();
mockRequest.setupGetRemoteAddr("127.0.0.1");
request = new RhnHttpServletRequest(mockRequest);
Expand Down Expand Up @@ -178,7 +177,6 @@ public void testProxyFetch() {
",1006678487::1152567362.02:21600.0:t15lgsaTRKpX6AxkUFQ11A==:f" +
"js-0-12.rhndev.redhat.com";

// mockRequest.setupAddHeader(KickstartHelper.XRHNPROXYAUTH, proxyheader);
mockRequest.setupGetHeader(KickstartHelper.XRHNPROXYAUTH, proxyheader);
helper = new KickstartHelper(request);
assertEquals("fjs-0-08.rhndev.redhat.com", helper.getKickstartHost());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ protected DataResult<ChannelTreeNode> getDataResult(RequestContext requestContex
Long oid = requestContext.getParamAsLong(RequestContext.ORG_ID);
//grab the trusted org id passed in
Org trustOrg = OrgFactory.lookupById(oid);
//User user = requestContext.getCurrentUser();
User user = UserFactory.findRandomOrgAdmin(trustOrg);
//Org org = user.getOrg();
Org org = requestContext.getCurrentUser().getOrg();

return ChannelManager.trustChannelConsume(org, trustOrg, user, lc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public ActionForward executePackageAction(ActionMapping mapping,

Long sid = requestContext.getRequiredParam("sid");
User user = requestContext.getCurrentUser();
//updateList(newactions, user.getId());

List<Map<String, Long>> data = PackageListItem.toKeyMaps(getDataResult(request));
int numPackages = data.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ protected ActionForward doExecute(HttpServletRequest request, ActionMapping mapp
}

// TODO: Set up combined-form validator
// errs.add(RhnValidationHelper.validateDynaActionForm(this, daForm));
// errs.add(RhnValidationHelper.validateDynaActionForm(this, daForm))
addErrors(request, errs);

ListRhnSetHelper helper = new ListRhnSetHelper(this, request, RhnSetDecl.SYSTEMS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public ActionForward execute(ActionMapping mapping,

RhnSetManager.store(systemSet);

//response.sendRedirect("/rhn/systems/ssm/ListSystems.do");
return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//import java.util.HashMap;
//import java.util.Map;


/**
* KickstartCloneAction - action for cloning a KS. Can't use BaseKickstartEdit
* action because we have to forward to a different Kickstart vs the one we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public void testMessageQueueRegistration() {
assertTrue(found);
//don't call contextDestroyed here since it stops hibernate and
//screws everything up ;)
//rl.contextDestroyed(null);
MessageQueue.stopMessaging();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
*/
public class RestartSatelliteEvent extends BaseEvent implements EventMessage {

//private User user;

/**
* default constructor
* @param currentUser who is creating this event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ public void execute(EventMessage msg) {
long operationId = SsmOperationManager.createOperation(user,
getOperationName(), RhnSetDecl.SYSTEMS.getLabel());

// Explicitly call handle transactions here so the operation creation above
// is persisted before the potentially long running logic below
//handleTransactions(true);

try {
long actionStart = System.currentTimeMillis();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ public Map<Character, Integer> createIndex(DataResult dr) {
String value = (String)MethodUtil.callMethod(inputRow,
StringUtil.beanify("get " + filterColumn),
new Object[0]);
/* Filter the data if necessary
if (filterValue != null && value != null) {
if (value.indexOf(filterValue) < 0) {
di.remove();
}
}*/
// Make sure that the alpha inputs are converted
// to uppercase
if (value != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ public void testCreateIndex() {
//cs2.put('F', 2);
//cs2.put('Z', 4);

//Ensure that cs1 and cs2 are equal
//assertTrue(cs1.equals(cs2));
assertNotNull(cs1);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public Cookie createPxtCookie(Long pxtSessionId, HttpServletRequest request,
// when not using setDomain, default "Host" will be set for the cookie
// there's no need to use domain and besides that it causes trouble,
// when accessing the server within the local network (without FQDN)
// pxtCookie.setDomain(request.getServerName());
if (!userAgentContains(request, "msie")) {
pxtCookie.setMaxAge(timeout);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ protected void savePxtSession(WebSession pxtSession) {
public void invalidatePxtSession(HttpServletRequest request,
HttpServletResponse response) {

//updateWebUserId(request, response, null);
WebSession pxtSession = getPxtSession(request);
pxtSession.setWebUserId(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
*/
public abstract class BaseListAction extends RhnListAction {

// public static final String PAGE_LIST = "pageList";

/** {@inheritDoc} */
@Override
public ActionForward execute(ActionMapping mapping,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public ActionForward selectall(DataResult dr, Map<String, Object> paramsIn) {
public void selectAllData(List result, User user) {
// Get an "unelaborated" DataResult containing all of the
// user's visible systems
// DataResult dr = getDataResult(user, request);

this.setDecl.clear(user);
RhnSet rs = this.setDecl.create(user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,6 @@ public int doStartTag() throws JspException {
if (!getPageList().getIndex().isEmpty() &&
getPageList().size() < getPageList().getTotalSize()) {

//renderViewAllLink(alphaBarContent);
renderAlphabar(alphaBarContent);
}
pageContext.popBody();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public String getAcl() {
*/
public void setMixins(String mix) {
mixins = mix;
//mixins = StringUtils.split(mix, ",");
}

/**
Expand All @@ -104,7 +103,7 @@ public int doStartTag() throws JspException {
mixins)) {
// acl methods must be in the following form
// aclXxxYyy(Object context, String[] params) and invoked
// xxx_yyy(param);
// xxx_yyy(param)
return (EVAL_BODY_INCLUDE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public int failSystemAction(User loggedInUser, Integer sid, Integer actionId,
@ReadOnly
public Object[] listAllActions(User loggedInUser) {

// the second argument is "PageControl". This is not needed for the api usage;
// the second argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
return ActionManager.allActions(loggedInUser, null).toArray();
}
Expand All @@ -166,7 +166,7 @@ public Object[] listAllActions(User loggedInUser) {
*/
@ReadOnly
public Object[] listCompletedActions(User loggedInUser) {
// the second argument is "PageControl". This is not needed for the api usage;
// the second argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
DataResult<ScheduledAction> dr = ActionManager.completedActions(loggedInUser, null);
return dr.toArray();
Expand All @@ -186,7 +186,7 @@ public Object[] listCompletedActions(User loggedInUser) {
*/
@ReadOnly
public Object[] listInProgressActions(User loggedInUser) {
// the second argument is "PageControl". This is not needed for the api usage;
// the second argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
DataResult<ScheduledAction> dr = ActionManager.pendingActions(loggedInUser, null);
return dr.toArray();
Expand All @@ -206,7 +206,7 @@ public Object[] listInProgressActions(User loggedInUser) {
*/
@ReadOnly
public Object[] listFailedActions(User loggedInUser) {
// the second argument is "PageControl". This is not needed for the api usage;
// the second argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
DataResult<ScheduledAction> dr = ActionManager.failedActions(loggedInUser, null);
return dr.toArray();
Expand All @@ -226,7 +226,7 @@ public Object[] listFailedActions(User loggedInUser) {
*/
@ReadOnly
public Object[] listArchivedActions(User loggedInUser) {
// the second argument is "PageControl". This is not needed for the api usage;
// the second argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
return ActionManager.archivedActions(loggedInUser, null).toArray();
}
Expand All @@ -245,7 +245,7 @@ public Object[] listArchivedActions(User loggedInUser) {
*/
@ReadOnly
public Object[] listAllArchivedActions(User loggedInUser) {
// the second argument is "PageControl". This is not needed for the api usage;
// the second argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
return ActionManager.allArchivedActions(loggedInUser, null).toArray();
}
Expand All @@ -268,7 +268,7 @@ public Object[] listAllArchivedActions(User loggedInUser) {
public Object[] listCompletedSystems(User loggedInUser, Integer actionId) {
Long aid = actionId.longValue();
Action action = ActionManager.lookupAction(loggedInUser, aid);
// the third argument is "PageControl". This is not needed for the api usage;
// the third argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
DataResult<ActionedSystem> dr = ActionManager.completedSystems(loggedInUser, action, null);
dr.elaborate();
Expand All @@ -290,7 +290,7 @@ public Object[] listCompletedSystems(User loggedInUser, Integer actionId) {
*/
@ReadOnly
public Object[] listAllCompletedActions(User loggedInUser) {
// the second argument is "PageControl". This is not needed for the api usage;
// the second argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
return ActionManager.allCompletedActions(loggedInUser, null).toArray();
}
Expand All @@ -313,7 +313,7 @@ public Object[] listAllCompletedActions(User loggedInUser) {
public Object[] listInProgressSystems(User loggedInUser, Integer actionId) {
Long aid = actionId.longValue();
Action action = ActionManager.lookupAction(loggedInUser, aid);
// the third argument is "PageControl". This is not needed for the api usage;
// the third argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
DataResult<ActionedSystem> dr = ActionManager.inProgressSystems(loggedInUser, action, null);
dr.elaborate();
Expand All @@ -339,7 +339,7 @@ public Object[] listInProgressSystems(User loggedInUser, Integer actionId) {
public Object[] listFailedSystems(User loggedInUser, Integer actionId) {
Long aid = actionId.longValue();
Action action = ActionManager.lookupAction(loggedInUser, aid);
// the third argument is "PageControl". This is not needed for the api usage;
// the third argument is "PageControl". This is not needed for the api usage
// therefore, null will be used.
DataResult<ActionedSystem> dr = ActionManager.failedSystems(loggedInUser, action, null);
dr.elaborate();
Expand Down
Loading
Loading