asadmin redeploy --upload FAILS
asadmin redeploy OK
asadmin deploy --upload OK
Together with it I see also related minnot issue that command fails by NullPointerExceptin created in catch block. It is because there is unchecked manipulation with field assigned from the middle of related try block. So, when try block fails before this assignment then original exception is hidden by non-relevant NPE. See DeployCommand around line 305.
What I know
After very short investigation I found out that core of issue is that file to deploy (refered by DeployCommand.path) exists (in standard upload directory) but it is empty.
I also have theory why it is. Originally is path param injected into ReDeployCommand . Then ReDeployCommand calls DeployCommand using standard invocation in CommandRunnerImpl. Path is loaded from Payload.inbound. But Payload.inboud use stream as data source for its parts. So, for second call when injecting into DeployCommand.path it has no more data in stream because all of original stream was loaded when injecting into ReDeployCommand.
Contract of Payload that can contains stream is there from history but in current version we really use it in command call case. Before it was created from Zip file entry. So, it was possible to reenter it.
We need first to choose what to do with Payload contract. If payload part is created from stream we can
- copy stream to file just after construction
- copy stream to file while loading
- update entry when we move data to file from Payload somewhere in CommandRunnerImpl or related class. = This solution is my favorite because max one file for one Payload.part will be created.