From c4a3855f1d909ac246016c4fb423d052f49f5998 Mon Sep 17 00:00:00 2001
From: Lachlan Roberts
{@code - * * UNPARSED - Parsing has not started, there are no parts which need to be cleaned up. * PARSING - The parsing thread is reading from the InputStream and generating parts. * PARSED - Parsing has complete and no more parts will be generated. - * ERROR - deleteParts() has been called while we were in parsing state. + * DELETING - deleteParts() has been called while we were in PARSING state, parsing thread will do the delete. * DELETED - The parts have been deleted, this is the terminal state. * * deleteParts() @@ -86,8 +85,8 @@ private enum State UNPARSED, PARSING, PARSED, - DELETED, - ERROR + DELETING, + DELETED } private static final Logger LOG = Log.getLogger(MultiPartFormInputStream.class); @@ -413,11 +412,11 @@ public void deleteParts() switch (state) { case DELETED: - case ERROR: + case DELETING: return; case PARSING: - state = State.ERROR; + state = State.DELETING; return; case UNPARSED: @@ -430,10 +429,10 @@ public void deleteParts() } } - uncheckedDeleteParts(); + delete(); } - private void uncheckedDeleteParts() + private void delete() { MultiException err = null; for (Listparts : _parts.values()) @@ -638,7 +637,7 @@ else if (len == -1) state = State.PARSED; break; - case ERROR: + case DELETING: state = State.DELETED; cleanup = true; break; @@ -649,7 +648,7 @@ else if (len == -1) } if (cleanup) - uncheckedDeleteParts(); + delete(); } }