Skip to content

Commit

Permalink
Issue #4383 - declare some MultiPartFormInputStream fields as final
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
  • Loading branch information
lachlan-roberts committed Dec 4, 2019
1 parent 269e885 commit bb931e4
Showing 1 changed file with 8 additions and 13 deletions.
Expand Up @@ -59,13 +59,13 @@
public class MultiPartFormInputStream
{
private static final Logger LOG = Log.getLogger(MultiPartFormInputStream.class);
private InputStream _in;
private MultipartConfigElement _config;
private String _contentType;
private MultiMap<Part> _parts = new MultiMap<>();
private final MultiMap<Part> _parts = new MultiMap<>();
private final InputStream _in;
private final MultipartConfigElement _config;
private final File _contextTmpDir;
private final String _contentType;
private Throwable _err;
private File _tmpDir;
private File _contextTmpDir;
private boolean _deleteOnExit;
private boolean _writeFilesWithFilenames;
private boolean _parsed;
Expand Down Expand Up @@ -332,14 +332,10 @@ public String getContentDispositionFilename()
public MultiPartFormInputStream(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir)
{
_contentType = contentType;
_config = config;
_contextTmpDir = contextTmpDir;
if (_contextTmpDir == null)
_contextTmpDir = new File(System.getProperty("java.io.tmpdir"));

if (_config == null)
_config = new MultipartConfigElement(_contextTmpDir.getAbsolutePath());
_contextTmpDir = (contextTmpDir != null) ? contextTmpDir : new File(System.getProperty("java.io.tmpdir"));
_config = (config != null) ? config : new MultipartConfigElement(_contextTmpDir.getAbsolutePath());

_in = new BufferedInputStream(in);
if (in instanceof ServletInputStream)
{
if (((ServletInputStream)in).isFinished())
Expand All @@ -348,7 +344,6 @@ public MultiPartFormInputStream(InputStream in, String contentType, MultipartCon
return;
}
}
_in = new BufferedInputStream(in);
}

/**
Expand Down

0 comments on commit bb931e4

Please sign in to comment.