Skip to content

Commit 6056b36

Browse files
authored
Improve exception logging (#219)
1 parent 2921547 commit 6056b36

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

pepdb/src/org/scharp/atlas/pepdb/PepDBController.java

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import org.springframework.validation.Errors;
5050
import org.springframework.web.servlet.ModelAndView;
5151

52-
import java.io.IOException;
5352
import java.sql.SQLException;
5453
import java.util.ArrayList;
5554
import java.util.LinkedList;
@@ -784,14 +783,13 @@ public class ImportPeptidePoolsAction extends FormViewAction<FileForm>
784783
ActionURL url = null;
785784

786785
@Override
787-
public ModelAndView getView(FileForm form, boolean reshow, BindException errors) throws Exception
786+
public ModelAndView getView(FileForm form, boolean reshow, BindException errors)
788787
{
789-
JspView v = new JspView<FileForm>("/org/scharp/atlas/pepdb/view/importPools.jsp", form, errors);
790-
return v;
788+
return new JspView<>("/org/scharp/atlas/pepdb/view/importPools.jsp", form, errors);
791789
}
792790

793791
@Override
794-
public boolean handlePost(FileForm form, BindException errors) throws Exception
792+
public boolean handlePost(FileForm form, BindException errors)
795793
{
796794
try
797795
{
@@ -813,7 +811,6 @@ public boolean handlePost(FileForm form, BindException errors) throws Exception
813811
}
814812
catch (Exception e)
815813
{
816-
e.printStackTrace();
817814
_log.error(e.getMessage(), e);
818815
errors.reject(null, "There was a problem uploading File: " + e.getMessage());
819816
return false;
@@ -843,9 +840,9 @@ public void addNavTrail(NavTree root)
843840

844841

845842
@RequiresPermission(ReadPermission.class)
846-
public abstract class PeptideExcelExportAction extends ExportAction
843+
public abstract class PeptideExcelExportAction extends ExportAction<Object>
847844
{
848-
public void printExcel(Object bean, HttpServletResponse response, BindException errors, PeptideQueryForm form) throws Exception
845+
public void printExcel(Object bean, HttpServletResponse response, BindException errors, PeptideQueryForm form)
849846
{
850847
try
851848
{
@@ -860,17 +857,9 @@ public void printExcel(Object bean, HttpServletResponse response, BindException
860857
ew.setFooter(form.getMessage());
861858
ew.renderWorkbook(getResponse());
862859
}
863-
catch (SQLException e)
864-
{
865-
_log.error("export: " + e);
866-
}
867-
catch (IOException e)
868-
{
869-
_log.error("export: " + e);
870-
}
871860
catch (Exception e)
872861
{
873-
_log.error("export: " + e);
862+
_log.error("PeptideExcelExportAction: ", e);
874863
}
875864
}
876865
}
@@ -907,7 +896,7 @@ public void export(Object bean, HttpServletResponse response, BindException erro
907896
public class PeptideDefaultExcelExportAction extends PeptideExcelExportAction
908897
{
909898
@Override
910-
public void export(Object bean, HttpServletResponse response, BindException errors) throws Exception
899+
public void export(Object bean, HttpServletResponse response, BindException errors)
911900
{
912901
ViewContext ctx = getViewContext();
913902
HttpSession session = ctx.getRequest().getSession();
@@ -922,7 +911,7 @@ public void export(Object bean, HttpServletResponse response, BindException erro
922911
@RequiresPermission(ReadPermission.class)
923912
public abstract class PeptideTextExportAction extends ExportAction
924913
{
925-
public void printText(Object bean, HttpServletResponse response, BindException errors, PeptideQueryForm form) throws Exception
914+
public void printText(Object bean, HttpServletResponse response, BindException errors, PeptideQueryForm form)
926915
{
927916
try
928917
{
@@ -939,7 +928,7 @@ public void printText(Object bean, HttpServletResponse response, BindException e
939928
}
940929
catch (Exception e)
941930
{
942-
_log.error("export: " + e);
931+
_log.error("PeptideTextExportAction: ", e);
943932
}
944933
}
945934
}

0 commit comments

Comments
 (0)