Author: ivassile
Date: 2012-06-21 16:48:33 -0400 (Thu, 21 Jun 2012)
New Revision: 23216
Modified:
branches/enterprise/3.3.1.SP3_BZ-832503/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
branches/enterprise/3.3.1.SP3_BZ-832503/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
branches/enterprise/3.3.1.SP3_BZ-832503/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
branches/enterprise/3.3.1.SP3_BZ-832503/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
Log:
One-off patch BZ-832503
Modified:
branches/enterprise/3.3.1.SP3_BZ-832503/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
---
branches/enterprise/3.3.1.SP3_BZ-832503/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2012-06-15
15:14:42 UTC (rev 23215)
+++
branches/enterprise/3.3.1.SP3_BZ-832503/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2012-06-21
20:48:33 UTC (rev 23216)
@@ -75,9 +75,9 @@
private String encoding = null;
- private Integer contentLength = 0;
+ private Long contentLength = new Long(0);
- private int bytesRead = 0;
+ private long bytesRead = 0;
//we shouldn't allow to stop until request reaches PhaseListener because of
portlets
private boolean canStop = false;
@@ -86,7 +86,7 @@
private Map<String, Object> percentMap = null;
- private Map<String, Integer> requestSizeMap = null;
+ private Map<String, Long> requestSizeMap = null;
private Map<String, String> requestKeysMap = null;
@@ -109,14 +109,14 @@
private boolean canceled;
public MultipartRequest(HttpServletRequest request, boolean createTempFiles,
- String tempFilesDirectory, int maxRequestSize, String uid) {
+ String tempFilesDirectory, long maxRequestSize, String uid) {
super(request);
this.createTempFiles = createTempFiles;
this.tempFilesDirectory = tempFilesDirectory;
this.uid = uid;
String contentLength = request.getHeader("Content-Length");
- this.contentLength = Integer.parseInt(contentLength);
+ this.contentLength = Long.parseLong(contentLength);
if (contentLength != null && maxRequestSize > 0
&& this.contentLength > maxRequestSize) {
// TODO : we should make decision if can generate exception in this
@@ -434,9 +434,9 @@
}
if (requestSizeMap == null) {
- requestSizeMap = (Map<String, Integer>)
sessionMap.get(FileUploadConstants.REQUEST_SIZE_BEAN_NAME);
+ requestSizeMap = (Map<String, Long>)
sessionMap.get(FileUploadConstants.REQUEST_SIZE_BEAN_NAME);
if (requestSizeMap == null) {
- requestSizeMap = new ConcurrentHashMap<String, Integer>();
+ requestSizeMap = new ConcurrentHashMap<String, Long>();
sessionMap.put(FileUploadConstants.REQUEST_SIZE_BEAN_NAME, requestSizeMap);
}
}
@@ -562,7 +562,7 @@
return param;
}
- public Integer getSize() {
+ public Long getSize() {
return contentLength;
}
@@ -707,7 +707,7 @@
public boolean isDone() {
return !(this.shouldStop && (this.canceled ||
- this.contentLength != null && this.contentLength.intValue() !=
this.bytesRead));
+ this.contentLength != null && this.contentLength.longValue() !=
this.bytesRead));
}
@Override
Modified:
branches/enterprise/3.3.1.SP3_BZ-832503/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
===================================================================
---
branches/enterprise/3.3.1.SP3_BZ-832503/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2012-06-15
15:14:42 UTC (rev 23215)
+++
branches/enterprise/3.3.1.SP3_BZ-832503/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2012-06-21
20:48:33 UTC (rev 23216)
@@ -131,7 +131,7 @@
/**
* The maximum size of a file upload request. 0 means no limit.
*/
- private int maxRequestSize = 0;
+ private long maxRequestSize = 0;
/** Multipart request start */
public static final String MULTIPART = "multipart/";
@@ -186,7 +186,7 @@
param = filterConfig.getInitParameter("maxRequestSize");
if (param != null) {
- this.maxRequestSize = Integer.parseInt(param);
+ this.maxRequestSize = Long.parseLong(param);
}
}
@@ -242,7 +242,7 @@
return false;
}
- private boolean isFileSizeRestricted(ServletRequest request, int maxSize) {
+ private boolean isFileSizeRestricted(ServletRequest request, long maxSize) {
if (maxSize != 0 && request.getContentLength() > maxSize) {
return true;
}
Modified:
branches/enterprise/3.3.1.SP3_BZ-832503/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
===================================================================
---
branches/enterprise/3.3.1.SP3_BZ-832503/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2012-06-15
15:14:42 UTC (rev 23215)
+++
branches/enterprise/3.3.1.SP3_BZ-832503/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2012-06-21
20:48:33 UTC (rev 23216)
@@ -71,7 +71,7 @@
private String localFileName;
- private Integer localFileSize;
+ private Long localFileSize;
private InputStream localInputStream;
@@ -113,11 +113,11 @@
this.localFileName = localFileName;
}
- public Integer getLocalFileSize() {
+ public Long getLocalFileSize() {
return localFileSize;
}
- public void setLocalFileSize(Integer localFileSize) {
+ public void setLocalFileSize(Long localFileSize) {
this.localFileSize = localFileSize;
}
@@ -201,7 +201,7 @@
if ("progress".equals(actionString)) {
Map<String, Object> sessionMap = externalContext.getSessionMap();
- Map<String, Integer> requestsSizeMap = (Map<String, Integer>)
sessionMap.get(FileUploadConstants.REQUEST_SIZE_BEAN_NAME);
+ Map<String, Long> requestsSizeMap = (Map<String, Long>)
sessionMap.get(FileUploadConstants.REQUEST_SIZE_BEAN_NAME);
if (requestsSizeMap != null) {
setupProgressBarValueExpression(facesContext, uid);
Modified:
branches/enterprise/3.3.1.SP3_BZ-832503/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
---
branches/enterprise/3.3.1.SP3_BZ-832503/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2012-06-15
15:14:42 UTC (rev 23215)
+++
branches/enterprise/3.3.1.SP3_BZ-832503/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2012-06-21
20:48:33 UTC (rev 23216)
@@ -148,8 +148,8 @@
if (isFlash && !formUpload && fileList.size() > 0) {
try {
UploadItem item = fileList.get(0);
- int actualSize = item.getFileSize();
- int clientSize =
Integer.parseInt(requestParameterMap.get("_richfaces_size"));
+ long actualSize = item.getFileSize();
+ long clientSize =
Long.parseLong(requestParameterMap.get("_richfaces_size"));
if (actualSize != clientSize) {
return; // File uploading has been stopped on the client side