Skip to content
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

SAK-31796 - Clean up instances of e.printStackTrace in the rest of Sakai #5113

Merged
merged 76 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
4523959
Search - Clean up instances of e.printStackTrace
Dec 5, 2017
6a29191
Sections - Clean up instances of printStackTrace
Dec 5, 2017
a586309
Shortened - Clean up instances of e.printStackTrace
Dec 5, 2017
ece944d
SimpleRSS - Clean up instances of e.printStackTrace
Dec 5, 2017
6aaa55d
Site - Clean up instances of e.printStackTrace
Dec 5, 2017
869a189
sitedescription - Clean up instances of e.printStackTrace
Dec 5, 2017
ecaceae
Taggable - Clean up instances of e.printStackTrace
Dec 5, 2017
520f6c5
Signup - Clean up instances of e.printStackTrace
Dec 5, 2017
980ada3
Sitemanage - Clean up instances of e.printStackTrace
Dec 5, 2017
32cb89b
Access - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
7569dbb
Admin-tools - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
18bae86
Announcement - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
7290b3d
Archive - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
01d4981
Assignment - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
d10b521
Basiclti - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
0f4f4d3
Calendar - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
221b567
Chat - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
c1f21e5
Sitestats - Clean up instances of e.printStackTrace
Dec 5, 2017
bb1cd32
Citations - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
1804d43
Cloud-content - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
f0ce88e
Cmprovider - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
9e825c3
Common - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
0d98691
Commons - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
7a9fbbe
Content - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
1bcc80f
Courier - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
719a23b
Dav - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
a036a03
Delegatedaccess - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
7910656
Edu-services - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
130c0aa
Content-review - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
767c672
Citations - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
7e3266e
Emailtemplateservice - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
9397592
Endorsed - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
00c1005
Entitybroker - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
fda3674
External-calendaring-service - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
594cd9a
External-calendaring-service - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
2cab54d
Feedback - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
28f618c
Syllabus - Clean up instances of e.printStackTrace
Dec 5, 2017
4e13885
Tags - Clean up instances of e.printStackTrace
Dec 5, 2017
c774917
Gradebook - Clean up instances of printStackTrace
josecebe Dec 5, 2017
610feae
Textarea - Clean up printStackTrace
Dec 5, 2017
9ef9156
Tool - Clean up printStackTrace
Dec 5, 2017
61846a4
Gradebookng - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
00298c9
Help - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
06cc79a
Hierarchy - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
65c9225
Jobsscheduler - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
75e4f95
Jsf - Clean up instances of e.printStackTrace
josecebe Dec 5, 2017
a5200e7
User - Clean up instances of printStackTrace
Dec 5, 2017
24329cf
useraudit - Clean up instances of printStack
Dec 5, 2017
4abf798
usermembership - Clean up instances of printStackTrace
Dec 5, 2017
ae2bf0e
Velocity - Clean up instances of printStackTrace
Dec 5, 2017
99d8719
Web - Clean up instances of printStackTrace
Dec 5, 2017
364406f
Webservices - Clean up instances of printStackTrace
Dec 5, 2017
1cb3169
Rwiki - Clean up instances of printStackTrace
Dec 11, 2017
91b863c
rubrics - Clean up instances of printStackTrace
Dec 11, 2017
a18cd74
rsf - Clean up instances of printStackTrace
Dec 11, 2017
bb18392
roster2 - Clean up instances of printStackTrace
Dec 11, 2017
bb54fe8
reset-pass - Clean up instances of printStackTrace
Dec 11, 2017
8165fb2
providers - Clean up instances of printStackTrace
Dec 11, 2017
e6c1a66
Profile2 - Clean up instances of printStackTrace
Dec 11, 2017
914f008
Kernel - Clean up instances of printStackTrace
josecebe Dec 11, 2017
969d6c3
Presence - Clean up instances of printStackTrace
Dec 11, 2017
7ba0a9b
Postem - Clean up instances of printStackTrace
Dec 11, 2017
86344d5
Portal - Clean up instances of printStackTrace
Dec 11, 2017
6c2c842
polls - Clean up instances of printStackTrace
Dec 11, 2017
500b969
Podcasts - Clean up instances of printStackTrace
Dec 11, 2017
57834d5
Pasystem - Clean up instances of printStackTrace
Dec 11, 2017
b6039f4
oauth - Clean up instances of printStackTrace
Dec 11, 2017
40ea310
Lessonbuilder - Clean up instances of printStackTrace
josecebe Dec 11, 2017
993ad10
Login - Clean up instances of printStackTrace
josecebe Dec 11, 2017
8402e5c
Mailarchive - Clean up instances of printStackTrace
josecebe Dec 12, 2017
10f2e65
Mailsender - Clean up instances of printStackTrace
josecebe Dec 12, 2017
98ceee0
Message - Clean up instances of printStackTrace
josecebe Dec 12, 2017
c8de889
MSGCNTR - Clean up instances of printStackTrace
Dec 12, 2017
40e0f7c
Extra cases - Clean up instances of printStackTrace
Dec 12, 2017
8694da6
Extra cases - Clean up instances of System.out.println
Dec 12, 2017
f2b911f
Extra cases - Use Slf4j Annotation
Dec 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;

import org.sakaiproject.authz.api.SecurityAdvisor;
import org.sakaiproject.authz.api.SecurityService;
import org.sakaiproject.cheftool.VmServlet;
Expand Down Expand Up @@ -71,11 +71,9 @@
*
* @author Sakai Software Development Team
*/
@Slf4j
public class AccessServlet extends VmServlet
{
/** Our log (commons). */
private static Logger M_log = LoggerFactory.getLogger(AccessServlet.class);

/** Resource bundle using current language locale */
protected static ResourceLoader rb = new ResourceLoader("access");

Expand Down Expand Up @@ -350,7 +348,7 @@ public SecurityAdvice isAllowed(String userId, String function, String reference
catch (EntityNotDefinedException e)
{
// the request was not valid in some way
M_log.debug("dispatch(): ref: " + ref.getReference(), e);
log.debug("dispatch(): ref: " + ref.getReference(), e);
sendError(res, HttpServletResponse.SC_NOT_FOUND);
return;
}
Expand All @@ -368,13 +366,13 @@ public SecurityAdvice isAllowed(String userId, String function, String reference
}

// otherwise reject the request
M_log.debug("dispatch(): ref: " + ref.getReference(), e);
log.debug("dispatch(): ref: " + ref.getReference(), e);
sendError(res, HttpServletResponse.SC_FORBIDDEN);
}

catch (EntityAccessOverloadException e)
{
M_log.info("dispatch(): ref: " + ref.getReference(), e);
log.info("dispatch(): ref: " + ref.getReference(), e);
sendError(res, HttpServletResponse.SC_SERVICE_UNAVAILABLE);
}

Expand All @@ -397,15 +395,15 @@ public SecurityAdvice isAllowed(String userId, String function, String reference

catch (Throwable e)
{
M_log.warn("dispatch(): exception: ", e);
log.warn("dispatch(): exception: ", e);
sendError(res, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}

finally
{
// log
if (M_log.isDebugEnabled())
M_log.debug("from:" + req.getRemoteAddr() + " path:" + params.getPath() + " options: " + info.optionsString()
if (log.isDebugEnabled())
log.debug("from:" + req.getRemoteAddr() + " path:" + params.getPath() + " options: " + info.optionsString()
+ " time: " + info.getElapsedTime());
}
}
Expand Down Expand Up @@ -458,7 +456,7 @@ protected void doLogin(HttpServletRequest req, HttpServletResponse res, String p
{
// if basic auth is valid do that
if ( basicAuth.doAuth(req,res) ) {
//System.err.println("BASIC Auth Request Sent to the Browser ");
log.info("BASIC Auth Request Sent to the Browser ");
return;
}

Expand All @@ -482,7 +480,7 @@ protected void doLogin(HttpServletRequest req, HttpServletResponse res, String p
// check that we have a return path set; might have been done earlier
if (session.getAttribute(Tool.HELPER_DONE_URL) == null)
{
M_log.warn("doLogin - proceeding with null HELPER_DONE_URL");
log.warn("doLogin - proceeding with null HELPER_DONE_URL");
}

// map the request to the helper, leaving the path after ".../options" for the helper
Expand All @@ -505,7 +503,7 @@ protected void sendError(HttpServletResponse res, int code)
}
catch (Throwable t)
{
M_log.warn("sendError: " + t);
log.warn("sendError: " + t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUpload;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.sakaiproject.component.cover.ComponentManager;
import org.sakaiproject.content.api.ContentCollection;
import org.sakaiproject.content.api.ContentHostingService;
Expand All @@ -60,16 +60,13 @@
*
* @author Sakai Software Development Team
*/
@Slf4j
public class WebServlet extends AccessServlet
{
/** Our log (commons). */
private static Logger M_log = LoggerFactory.getLogger(WebServlet.class);
protected ContentHostingService contentHostingService;
protected UserDirectoryService userDirectoryService;
protected TimeService timeService;



/* (non-Javadoc)
* @see org.sakaiproject.access.tool.AccessServlet#init(javax.servlet.ServletConfig)
*/
Expand Down Expand Up @@ -181,15 +178,15 @@ protected String preProcessPath(String path, HttpServletRequest req)
protected void postUpload(HttpServletRequest req, HttpServletResponse res)
{
String path = req.getPathInfo();
// System.out.println("path " + path);
log.debug("path {}", path);
if (path == null) path = "";
// assume caller has verified that it is a request for content and that it's multipart
// loop over attributes in request, picking out the ones
// that are file uploads and doing them
for (Enumeration e = req.getAttributeNames(); e.hasMoreElements();)
{
String iname = (String) e.nextElement();
// System.out.println("Item " + iname);
log.debug("Item {}", iname);
Object o = req.getAttribute(iname);
// NOTE: Fileitem is from
// org.apache.commons.fileupload.FileItem, not
Expand All @@ -201,7 +198,7 @@ protected void postUpload(HttpServletRequest req, HttpServletResponse res)
{
if (!writeFile(fi.getName(), fi.getContentType(), inputStream, path, req, res, true)) return;
} catch (IOException ioe) {
M_log.warn("Problem getting InputStream", ioe);
log.warn("Problem getting InputStream", ioe);
}
}
}
Expand All @@ -217,7 +214,7 @@ protected boolean writeFile(String name, String type, InputStream inputStream, S
if (i >= 0) name = name.substring(i + 1);
if (name.length() < 1)
{
// System.out.println("no name left / removal");
log.debug("no name left / removal");
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
return false;
}
Expand All @@ -241,14 +238,14 @@ protected boolean writeFile(String name, String type, InputStream inputStream, S
// Try to delete the resource
try
{
// System.out.println("Trying Del " + path);
log.debug("Trying Del {}", path);
// The existing document may be a collection or a file.
boolean isCollection = contentHostingService.getProperties(path).getBooleanProperty(
ResourceProperties.PROP_IS_COLLECTION);

if (isCollection)
{
// System.out.println("Can't del, iscoll");
log.debug("Can't del, iscoll");
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
return false;
}
Expand All @@ -258,7 +255,7 @@ protected boolean writeFile(String name, String type, InputStream inputStream, S
// work for my workspace
ContentResourceEdit edit = contentHostingService.editResource(path);
// if (edit != null)
// System.out.println("Got edit");
log.debug("Got edit");
contentHostingService.removeResource(edit);
}
}
Expand All @@ -268,7 +265,7 @@ protected boolean writeFile(String name, String type, InputStream inputStream, S
}
catch (Exception e)
{
// System.out.println("Can't del, exception " + e.getClass() + ": " + e.getMessage());
log.debug("Can't del, exception {}: {}", e.getClass(), e.getMessage());
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
return false;
}
Expand All @@ -287,7 +284,7 @@ protected boolean writeFile(String name, String type, InputStream inputStream, S

resourceProperties.addProperty(ResourceProperties.PROP_DISPLAY_NAME, name);

// System.out.println("Trying Add " + path);
log.debug("Trying Add {}", path);
ContentResource resource = contentHostingService.addResource(path, type, inputStream, resourceProperties,
NotificationService.NOTI_NONE);

Expand All @@ -306,29 +303,29 @@ protected boolean writeFile(String name, String type, InputStream inputStream, S
{
}
}
// System.out.println("Add fail, inconsistent");
log.debug("Add fail, inconsistent");
resp.sendError(HttpServletResponse.SC_CONFLICT);
return false;
}
catch (IdUsedException e)
{
// Should not happen because we deleted above (unless tawo requests at same time)
// System.out.println("Add fail, in use");
M_log.warn("access post IdUsedException:" + e.getMessage());
log.debug("Add fail, in use");
log.warn("access post IdUsedException:" + e.getMessage());

resp.sendError(HttpServletResponse.SC_CONFLICT);
return false;
}
catch (Exception e)
{
// System.out.println("Add failed, exception " + e.getClass() + ": " + e.getMessage());
log.debug("Add failed, exception {}: {}", e.getClass(), e.getMessage());
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
return false;
}
}
catch (IOException e)
{
// System.out.println("overall fail IOException " + e);
log.debug("overall fail IOException {}", e);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.SuffixFileFilter;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sakaiproject.archive.api.ArchiveService;
import org.sakaiproject.archive.tool.model.SparseFile;
import org.sakaiproject.archive.tool.model.SparseSite;
Expand Down Expand Up @@ -65,9 +63,12 @@
import java.text.SimpleDateFormat;
import java.util.*;

import lombok.extern.slf4j.Slf4j;

/**
* <p>ArchiveAction is the Sakai archive tool.</p>
*/
@Slf4j
public class ArchiveAction
extends VelocityPortletPaneledAction
{
Expand All @@ -93,8 +94,6 @@ public class ArchiveAction
private SecurityService securityService;
private IdManager idManager;

private static final Logger log = LoggerFactory.getLogger(ArchiveAction.class);

// for batch archive
private long batchArchiveStarted = 0;
private long maxJobTime;
Expand Down Expand Up @@ -603,7 +602,7 @@ private void archiveSites(List<SparseSite> sites, String selectedTerm, Session c
try {
archiveService.archiveAndZip(s.getId());
} catch (IOException e) {
e.printStackTrace();
log.error("Failed to archive and compress it the site with id {}", s.getId(), e);
}

archiveCount++;
Expand Down
Loading