Skip to content

Commit

Permalink
use long instead of int in AjaxFileUpload classes
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Nov 6, 2013
1 parent f8eb344 commit ea7805e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public WOResponse handleRequest(WORequest request) {
String uploadIdentifier = null;
String uploadFileName = null;
InputStream uploadInputStream = null;
int streamLength = -1;
long streamLength = -1L;

try {
String sessionIdKey = WOApplication.application().sessionIdKey();
Expand Down Expand Up @@ -114,7 +114,7 @@ else if (formData.isFileUpload()) {
}

try {
if (_maxUploadSize >= 0 && streamLength > _maxUploadSize) {
if (_maxUploadSize >= 0L && streamLength > _maxUploadSize) {
IOException e = new IOException("You attempted to upload a file larger than the maximum allowed size of " + new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE).format(_maxUploadSize) + ".");
progress.setFailure(e);
progress.dispose();
Expand Down
14 changes: 12 additions & 2 deletions Frameworks/Ajax/Ajax/Sources/er/ajax/AjaxProgress.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,31 @@ public class AjaxProgress {
*
* @param maximum the maximum value of this progress
*/
public AjaxProgress(int maximum) {
public AjaxProgress(long maximum) {
this("AjaxProgress" + System.currentTimeMillis(), maximum);
}

@Deprecated
public AjaxProgress(int maximum) {
this((long) maximum);
}

/**
* Construct an AjaxProgress
*
* @param id the id of this AjaxProgress (only useful if you're registering it with AjaxProgressBar's registry)
* @param maximum the maximum value of this progress
*/
public AjaxProgress(String id, int maximum) {
public AjaxProgress(String id, long maximum) {
_id = id;
_maximum = maximum;
}

@Deprecated
public AjaxProgress(String id, int maximum) {
this(id, (long) maximum);
}

/**
* Returns the id of this progress model.
*
Expand Down
9 changes: 7 additions & 2 deletions Frameworks/Ajax/Ajax/Sources/er/ajax/AjaxUploadProgress.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ public static interface Delegate {
* @param fileName the name of the file uploaded from the client
* @param streamLength the total length of the stream
*/
public AjaxUploadProgress(String id, File tempFile, String fileName, int streamLength) {
public AjaxUploadProgress(String id, File tempFile, String fileName, long streamLength) {
super(id, streamLength);
_tempFile = tempFile;
_fileName = fileName;
}


@Deprecated
public AjaxUploadProgress(String id, File tempFile, String fileName, int streamLength) {
this(id, tempFile, fileName, (long) streamLength);
}

/**
* Returns the name of the file the client uploaded.
*
Expand Down

0 comments on commit ea7805e

Please sign in to comment.