diff --git a/api/src/main/java/org/sakaiproject/content/api/DavManager.java b/api/src/main/java/org/sakaiproject/content/api/DavManager.java index e37e69e..1321779 100644 --- a/api/src/main/java/org/sakaiproject/content/api/DavManager.java +++ b/api/src/main/java/org/sakaiproject/content/api/DavManager.java @@ -46,22 +46,22 @@ import org.sakaiproject.exception.TypeException; public interface DavManager { /** Status code (201) indicating the request succeeded and created a new resource on the server. */ - public final static Integer STATUS_CREATED = new Integer(HttpServletResponse.SC_CREATED); + public final static Integer STATUS_CREATED = Integer.valueOf(HttpServletResponse.SC_CREATED); /** Status reporting an operation succeeded without creation of a new resource */ - public final static Integer STATUS_NO_CONTENT = new Integer(HttpServletResponse.SC_NO_CONTENT); + public final static Integer STATUS_NO_CONTENT = Integer.valueOf(HttpServletResponse.SC_NO_CONTENT); /** Status code (401) indicating that the request requires HTTP authentication. */ - public final static Integer STATUS_UNAUTHORIZED = new Integer(HttpServletResponse.SC_UNAUTHORIZED); + public final static Integer STATUS_UNAUTHORIZED = Integer.valueOf(HttpServletResponse.SC_UNAUTHORIZED); /** Status code (403) indicating the server understood the request but refused to fulfill it. */ - public final static Integer STATUS_FORBIDDEN = new Integer(HttpServletResponse.SC_FORBIDDEN); + public final static Integer STATUS_FORBIDDEN = Integer.valueOf(HttpServletResponse.SC_FORBIDDEN); /** Status code (409) indicating requested action cannot be executed on an existing resource. */ - public final static Integer STATUS_METHOD_NOT_ALLOWED = new Integer(HttpServletResponse.SC_METHOD_NOT_ALLOWED); + public final static Integer STATUS_METHOD_NOT_ALLOWED = Integer.valueOf(HttpServletResponse.SC_METHOD_NOT_ALLOWED); /** Status code (409) indicating a resource cannot be created at the destination until one or more intermediate collections have been created. */ - public final static Integer STATUS_CONFLICT = new Integer(HttpServletResponse.SC_CONFLICT); + public final static Integer STATUS_CONFLICT = Integer.valueOf(HttpServletResponse.SC_CONFLICT); /* diff --git a/api/src/main/java/org/sakaiproject/content/api/FilePickerHelper.java b/api/src/main/java/org/sakaiproject/content/api/FilePickerHelper.java index e7b2e52..2a19c3f 100755 --- a/api/src/main/java/org/sakaiproject/content/api/FilePickerHelper.java +++ b/api/src/main/java/org/sakaiproject/content/api/FilePickerHelper.java @@ -44,10 +44,10 @@ public interface FilePickerHelper static final String FILE_PICKER_MAX_ATTACHMENTS = FilePickerHelper.PREFIX + "maxAttachments"; /** A constant indicating maximum of one item can be attached. */ - public static final Integer CARDINALITY_SINGLE = new Integer(1); + public static final Integer CARDINALITY_SINGLE = Integer.valueOf(1); /** A constant indicating any the number of attachments is unlimited. */ - public static final Integer CARDINALITY_MULTIPLE = new Integer(Integer.MAX_VALUE); + public static final Integer CARDINALITY_MULTIPLE = Integer.valueOf(Integer.MAX_VALUE); /** * title for the file selection helper (Corresponds to ResourcesAction.STATE_ATTACH_TITLE) diff --git a/api/src/main/java/org/sakaiproject/util/RequestFilter.java b/api/src/main/java/org/sakaiproject/util/RequestFilter.java index 71ec552..748cb43 100644 --- a/api/src/main/java/org/sakaiproject/util/RequestFilter.java +++ b/api/src/main/java/org/sakaiproject/util/RequestFilter.java @@ -476,7 +476,6 @@ public class RequestFilter implements Filter public String[] getParameterValues(String name) { - String[] ret = null; Map map = getParameterMap(); return (String[]) map.get(name); } @@ -525,7 +524,7 @@ public class RequestFilter implements Filter try { ThreadLocalManager.set(CURRENT_REMOTE_USER, Boolean.valueOf(m_sakaiRemoteUser)); - ThreadLocalManager.set(CURRENT_HTTP_SESSION, new Integer(m_sakaiHttpSession)); + ThreadLocalManager.set(CURRENT_HTTP_SESSION, Integer.valueOf(m_sakaiHttpSession)); ThreadLocalManager.set(CURRENT_CONTEXT, m_contextId); // make the servlet context available @@ -996,7 +995,7 @@ public class RequestFilter implements Filter // TODO: for 1.2 commons-fileupload, switch this to a FileSizeLimitExceededException req.setAttribute("upload.exception", new FileUploadBase.SizeLimitExceededException("", item.getSize(), uploadMax)); - req.setAttribute("upload.limit", new Long((uploadMax / 1024L) / 1024L)); + req.setAttribute("upload.limit", Long.valueOf((uploadMax / 1024L) / 1024L)); } else { @@ -1019,7 +1018,7 @@ public class RequestFilter implements Filter // so that the tool down-the-line can handle the problem req.setAttribute("upload.status", "size_limit_exceeded"); req.setAttribute("upload.exception", ex); - req.setAttribute("upload.limit", new Long((upload.getSizeMax() / 1024L) / 1024L)); + req.setAttribute("upload.limit", Long.valueOf((upload.getSizeMax() / 1024L) / 1024L)); } // TODO: put in for commons-fileupload 1.2 // catch (FileUploadBase.FileSizeLimitExceededException ex) diff --git a/kernel-impl/src/main/java/org/sakaiproject/email/impl/BasicEmailService.java b/kernel-impl/src/main/java/org/sakaiproject/email/impl/BasicEmailService.java index eb5f37e..ac6fc49 100644 --- a/kernel-impl/src/main/java/org/sakaiproject/email/impl/BasicEmailService.java +++ b/kernel-impl/src/main/java/org/sakaiproject/email/impl/BasicEmailService.java @@ -35,6 +35,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.StringTokenizer; +import java.util.Map.Entry; import javax.activation.DataHandler; import javax.activation.FileDataSource; @@ -829,10 +830,10 @@ public class BasicEmailService implements EmailService if (headers != null && !headers.isEmpty()) { retval = new ArrayList(); - for (String key : headers.keySet()) +// for (String key : headers.keySet()) + for (Entry entry : headers.entrySet()) { - String value = headers.get(key); - retval.add(key + ": " + value); + retval.add(entry.getKey() + ": " + entry.getValue()); } } return retval; @@ -1040,7 +1041,6 @@ public class BasicEmailService implements EmailService { MimeBodyPart attachPart = new MimeBodyPart(); FileDataSource source = new FileDataSource(attachment.getFile()); - attachPart = new MimeBodyPart(); attachPart.setDataHandler(new DataHandler(source)); attachPart.setFileName(attachment.getFile().getPath()); return attachPart; @@ -1210,7 +1210,7 @@ public class BasicEmailService implements EmailService * retained, you will have to create your own MimeMessage subclass, override the updateMessageID * method and use an instance of this subclass.

*/ - protected class MyMessage extends MimeMessage + protected static class MyMessage extends MimeMessage { protected String m_id = null; @@ -1292,11 +1292,11 @@ public class BasicEmailService implements EmailService } } - if (charset != null && canUseCharset(message, charset) && canUseCharset(getSubject(), charset)) + if (charset != null && canUseCharset(message, charset) && canUseCharset(getSubject(), charset)) { // use the charset from the Content-Type header } - else if (canUseCharset(message, CharacterSet.ISO_8859_1) && canUseCharset(getSubject(), CharacterSet.ISO_8859_1)) + else if (canUseCharset(message, CharacterSet.ISO_8859_1) && canUseCharset(getSubject(), CharacterSet.ISO_8859_1)) { if (contentType != null && charset != null) contentType = contentType.replaceAll(charset, CharacterSet.ISO_8859_1); @@ -1304,7 +1304,7 @@ public class BasicEmailService implements EmailService contentType += "; charset=" + CharacterSet.ISO_8859_1; charset = CharacterSet.ISO_8859_1; } - else if (canUseCharset(message, CharacterSet.WINDOWS_1252) && canUseCharset(getSubject(), CharacterSet.WINDOWS_1252)) + else if (canUseCharset(message, CharacterSet.WINDOWS_1252) && canUseCharset(getSubject(), CharacterSet.WINDOWS_1252)) { if (contentType != null && charset != null) contentType = contentType.replaceAll(charset, CharacterSet.WINDOWS_1252); @@ -1326,7 +1326,7 @@ public class BasicEmailService implements EmailService charset = CharacterSet.UTF_8; } - if (contentType.contains("multipart/")) { + if (contentType != null && contentType.contains("multipart/")) { MimeMultipart multiPartContent = new MimeMultipart("alternative"); int indexOfStartOfBoundary = contentType.indexOf("boundary=\"") + 10; String headerStartingWithBoundary = contentType.substring(indexOfStartOfBoundary); diff --git a/kernel-impl/src/main/java/org/sakaiproject/email/impl/DbDigestService.java b/kernel-impl/src/main/java/org/sakaiproject/email/impl/DbDigestService.java index c4afd3b..a6b054e 100644 --- a/kernel-impl/src/main/java/org/sakaiproject/email/impl/DbDigestService.java +++ b/kernel-impl/src/main/java/org/sakaiproject/email/impl/DbDigestService.java @@ -84,7 +84,7 @@ public class DbDigestService extends BaseDigestService */ public void setLocksInDb(String value) { - m_locksInDb = new Boolean(value).booleanValue(); + m_locksInDb = Boolean.parseBoolean(value); } /** Configuration: to run the ddl on init or not. */ @@ -98,7 +98,7 @@ public class DbDigestService extends BaseDigestService */ public void setAutoDdl(String value) { - m_autoDdl = new Boolean(value).booleanValue(); + m_autoDdl = Boolean.parseBoolean(value); } /********************************************************************************************************************************************************************************************************************************************************** @@ -139,7 +139,7 @@ public class DbDigestService extends BaseDigestService */ protected Storage newStorage() { - return new DbStorage(this); + return new DbStorage(m_tableName, m_locksInDb, this, sqlService); } /********************************************************************************************************************************************************************************************************************************************************** @@ -149,7 +149,7 @@ public class DbDigestService extends BaseDigestService /** * Covers for the BaseXmlFileStorage, providing Digest and DigestEdit parameters */ - protected class DbStorage extends BaseDbSingleStorage implements Storage + protected static class DbStorage extends BaseDbSingleStorage implements Storage { /** * Construct. @@ -157,9 +157,9 @@ public class DbDigestService extends BaseDigestService * @param realm * The StorageUser class to call back for creation of Resource and Edit objects. */ - public DbStorage(StorageUser user) + public DbStorage(String tableName, boolean locksInDb, StorageUser user, SqlService sqlService) { - super(m_tableName, "DIGEST_ID", null, m_locksInDb, "digest", user, sqlService); + super(tableName, "DIGEST_ID", null, locksInDb, "digest", user, sqlService); } public boolean check(String id)