Skip to content
Permalink
Browse files
Merge pull request #79 from arturobernalg/feature/FILEUPLOAD-327
FILEUPLOAD-327 - Solve SpotBug warning/errors
  • Loading branch information
jochenw committed May 2, 2021
2 parents 32eade4 + 1c732d7 commit b27fca22a365bc9449f9c7d1052965d0a6b71046
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
@@ -32,19 +32,10 @@
<Class name="org.apache.commons.fileupload2.MultipartStream" />
<Bug pattern="MS_PKGPROTECT" />
</Match>
<Match>
<Class name="org.apache.commons.fileupload2.ParameterParser" />
<Method name="parse" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="org.apache.commons.fileupload2.disk.DiskFileItem" />
<Bug pattern="DM_DEFAULT_ENCODING" />
</Match>
<Match>
<Class name="org.apache.commons.fileupload2.disk.DiskFileItem" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="org.apache.commons.fileupload2.disk.DiskFileItem" />
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" />
@@ -299,7 +299,7 @@ public Map<String, String> parse(
return new HashMap<>();
}
final HashMap<String, String> params = new HashMap<>();
this.chars = charArray;
this.chars = charArray.clone();
this.pos = offset;
this.len = length;

@@ -305,7 +305,7 @@ public byte[] get() throws UncheckedIOException {
if (cachedContent == null && dfos != null) {
cachedContent = dfos.getData();
}
return cachedContent;
return cachedContent != null ? cachedContent.clone() : new byte[0];
}

byte[] fileData = new byte[(int) getSize()];
@@ -347,16 +347,15 @@ public String getString(final String charset)
*/
@Override
public String getString() {
byte[] rawdata = new byte[0];
try {
rawdata = get();
byte[] rawData = get();
String charset = getCharSet();
if (charset == null) {
charset = defaultCharset;
}
return new String(rawdata, charset);
return new String(rawData, charset);
} catch (final IOException e) {
return new String(rawdata);
return new String(new byte[0]);
}
}

0 comments on commit b27fca2

Please sign in to comment.