Skip to content

Commit

Permalink
Merge pull request #61 from arturobernalg/feature/FILEUPLOAD-313
Browse files Browse the repository at this point in the history
FILEUPLOAD-313 - Remove redundant local variable
  • Loading branch information
jochenw committed Apr 22, 2021
2 parents b825323 + bc47cab commit 97df331
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
Expand Up @@ -76,10 +76,7 @@ public static final boolean isMultipartContent(final RequestContext ctx) {
if (contentType == null) {
return false;
}
if (contentType.toLowerCase(Locale.ENGLISH).startsWith(MULTIPART)) {
return true;
}
return false;
return contentType.toLowerCase(Locale.ENGLISH).startsWith(MULTIPART);
}

/**
Expand Down
Expand Up @@ -343,8 +343,7 @@ public String getContentType() {
*/
@Override
public ServletInputStream getInputStream() throws IOException {
final ServletInputStream sis = new MyServletInputStream(m_requestData, readLimit);
return sis;
return new MyServletInputStream(m_requestData, readLimit);
}

/**
Expand Down
Expand Up @@ -182,8 +182,7 @@ private List<FileItem> parseUpload(final InputStream pStream, final int pLength)
final HttpServletRequest request = new MockHttpServletRequest(pStream,
pLength, contentType);

final List<FileItem> fileItems = upload.parseRequest(new ServletRequestContext(request));
return fileItems;
return upload.parseRequest(new ServletRequestContext(request));
}

private String getHeader(final String pField) {
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/apache/commons/fileupload2/Util.java
Expand Up @@ -40,8 +40,7 @@ public static List<FileItem> parseUpload(final FileUpload upload, final byte[] b

public static List<FileItem> parseUpload(final FileUpload upload, final byte[] bytes, final String contentType) throws FileUploadException {
final HttpServletRequest request = new MockHttpServletRequest(bytes, contentType);
final List<FileItem> fileItems = upload.parseRequest(new ServletRequestContext(request));
return fileItems;
return upload.parseRequest(new ServletRequestContext(request));
}

public static List<FileItem> parseUpload(final FileUpload upload, final String content)
Expand Down
Expand Up @@ -357,8 +357,7 @@ public String getContentType() {
*/
@Override
public ServletInputStream getInputStream() throws IOException {
final ServletInputStream sis = new MyServletInputStream(m_requestData, readLimit);
return sis;
return (ServletInputStream) new MyServletInputStream(m_requestData, readLimit);
}

/**
Expand Down

0 comments on commit 97df331

Please sign in to comment.