Skip to content

Commit

Permalink
sonar cloud recomendations
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoZambrana committed Dec 16, 2024
1 parent 68a15f0 commit b6f006d
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import net.lacnic.elections.domain.Election;
import net.lacnic.elections.ejb.ElectionsManagerEJB;


@AuthorizeInstantiation("elections-only-one")
public class ElectionDetailDashboard extends DashboardAdminBasePage {

Expand All @@ -32,18 +31,18 @@ public class ElectionDetailDashboard extends DashboardAdminBasePage {

private Election election;


public ElectionDetailDashboard(PageParameters params) {
super(params);

// Check if election is closed (user might be using a direct link to get to this page)
// Check if election is closed (user might be using a direct link to get to this
// page)
if (UtilsParameters.isId(params)) {
Election election = AppContext.getInstance().getManagerBeanRemote().getElection(UtilsParameters.getIdAsLong(params));
if(election.isClosed()) {
Election fetchedElection = AppContext.getInstance().getManagerBeanRemote().getElection(UtilsParameters.getIdAsLong(params));
if (fetchedElection.isClosed()) {
setResponsePage(ErrorElectionClosed.class);
return;
} else {
setElection(election);
setElection(fetchedElection);
getElection().initStringsStartEndDates();
}
} else {
Expand All @@ -56,7 +55,6 @@ public ElectionDetailDashboard(PageParameters params) {
add(new NewElectionForm("newElectionForm"));
}


public final class NewElectionForm extends Form<Void> {
private static final long serialVersionUID = -5221887812611102034L;

Expand Down Expand Up @@ -92,12 +90,12 @@ public void onSubmit() {
originalElection = managerBeanRemote.getElection(election.getElectionId());
originalElectionStartDate = originalElection.getStartDate();
}
};
}

election.initDatesStartEndDates();
if (election.getStartDate().after(election.getEndDate())) {
error(getString("electionManagementErrorDates"));
} else if ((!isNew) && (isJoint) && (originalElectionStartDate.compareTo(election.getStartDate())!= 0)) {
} else if ((!isNew) && (isJoint) && (originalElectionStartDate.compareTo(election.getStartDate()) != 0)) {
error(getString("electionManagementErrorJointDates"));
} else {
copyTexts();
Expand Down Expand Up @@ -135,7 +133,7 @@ public void onClick() {
}
}

public void copyTexts() throws Exception {
public void copyTexts() {
if (election.isOnlySp()) {
election.copyLanguageDescriptions("SP");
election.copyLanguageTitles("SP");
Expand Down

0 comments on commit b6f006d

Please sign in to comment.