From 2661485ac4478b87b3b9481dee3f6fe5a9a328f4 Mon Sep 17 00:00:00 2001 From: Yazmin Date: Thu, 2 Jan 2025 19:28:35 -0600 Subject: [PATCH] Security Hostpots Reviewed and more --- .../ui/admin/election/census/UploadCensusFilePanel.java | 3 ++- .../main/java/net/lacnic/elections/utils/FilesUtils.java | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/elections-admin-web/src/main/java/net/lacnic/elections/adminweb/ui/admin/election/census/UploadCensusFilePanel.java b/elections-admin-web/src/main/java/net/lacnic/elections/adminweb/ui/admin/election/census/UploadCensusFilePanel.java index 2875bc8..89858b2 100644 --- a/elections-admin-web/src/main/java/net/lacnic/elections/adminweb/ui/admin/election/census/UploadCensusFilePanel.java +++ b/elections-admin-web/src/main/java/net/lacnic/elections/adminweb/ui/admin/election/census/UploadCensusFilePanel.java @@ -6,6 +6,7 @@ import org.apache.log4j.LogManager; import org.apache.log4j.Logger; +import org.apache.wicket.Page; import org.apache.wicket.markup.html.form.SubmitLink; import org.apache.wicket.markup.html.form.upload.FileUploadField; import org.apache.wicket.markup.html.link.DownloadLink; @@ -28,7 +29,7 @@ public class UploadCensusFilePanel extends Panel { private byte[] censusFile; private String fileName; - public UploadCensusFilePanel(String id, Election election, Class responsePage) { + public UploadCensusFilePanel(String id, Election election, Class responsePage) { super(id); try { setOutputMarkupId(true); diff --git a/elections-ejb/src/main/java/net/lacnic/elections/utils/FilesUtils.java b/elections-ejb/src/main/java/net/lacnic/elections/utils/FilesUtils.java index 8c8aceb..e841dd2 100644 --- a/elections-ejb/src/main/java/net/lacnic/elections/utils/FilesUtils.java +++ b/elections-ejb/src/main/java/net/lacnic/elections/utils/FilesUtils.java @@ -2,7 +2,6 @@ import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -24,7 +23,7 @@ public static Properties getEmailProperties() { try (InputStream input = new FileInputStream(System.getProperty("jboss.server.config.dir").concat("/email.properties"))) { props.load(input); } catch (Exception ex) { - ex.printStackTrace(); + appLogger.error(ex); } return props; } @@ -87,8 +86,6 @@ public static File convertBytesArrayToFile(byte[] bytes, String ruta) { fileOuputStream.write(bytes); fileOuputStream.flush(); return new File(ruta); - } catch (FileNotFoundException e) { - appLogger.error(e); } catch (IOException e) { appLogger.error(e); } finally { @@ -96,7 +93,7 @@ public static File convertBytesArrayToFile(byte[] bytes, String ruta) { try { fileOuputStream.close(); } catch (IOException e) { - e.printStackTrace(); + appLogger.error(e); } } }