Issue Details (XML | Word | Printable)

Key: GLASSFISH-19838
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: martin.mares
Reporter: martin.mares
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
glassfish

asadmin redeploy --upload command does not work

Created: 12/Mar/13 02:55 PM   Updated: 11/Apr/13 11:19 AM   Resolved: 11/Apr/13 11:19 AM
Component/s: admin
Affects Version/s: 4.0_b79
Fix Version/s: 4.0_b84_RC1

Time Tracking:
Not Specified

Tags:
Participants: martin.mares and Tom Mueller


 Description  « Hide

asadmin redeploy --upload FAILS
while:
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.


martin.mares added a comment - 12/Mar/13 02:58 PM

I assigned this issue to Tom because I need opponent for choosing fix method.


Tom Mueller added a comment - 12/Mar/13 04:01 PM

Agree with your analysis and the recommended solution (#3).


martin.mares added a comment - 11/Apr/13 11:19 AM

Fixed