New and Improved 3.13 Beta. Highlights: Shareable filters and dashboards and lots of other goodies. Any feedback can be raised as JIRA issues in the JIRA project.
Issue Details (XML | Word | Printable)

Key: JRA-14269
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Masha Khokhlova
Votes: 0
Watchers: 1
Operations

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

NullPointerException when creating an issue with poorly-configured workflow using AssignToLeadDeveloper function

Created: 11/Jan/08 01:18 PM   Updated: 18/Jun/08 03:05 AM
Component/s: Workflow
Affects Version/s: None
Fix Version/s: 3.12.2

Time Tracking:
Not Specified

File Attachments: 1. Text File Stack.txt (6 kB)

Image Attachments:

1. ErrorUI.jpg
(357 kB)

2. Workflow.jpg
(134 kB)
Environment:
Standalone
MS WIndows Server 2003 (Standard, SP2)
Issue Links:
Cloners
 
Reference
 

Participants: Masha Khokhlova and Michael Tokar [Atlassian]
Since last comment: 10 weeks, 1 day ago
Resolution Date: 18/Jun/08 03:05 AM
Labels:


 Description  « Hide
I added post function ("Assign the issue to the lead developer. ") to CREATE transition and placed it above all other post functions (please see the attached workflow.jpg)
I attached the workflow to my project and started filing an issue
On Save I got NullPointerException error (see stack.txt and errorui.jpg) though the issue was created

When I tried to detach the workflow from my project tp correct it I didn't manage to do this until I delete the issue.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Michael Tokar [Atlassian] added a comment - 13/Jan/08 08:23 PM
This problem is directly related to the implementation of the aforementioned post function AssignToLeadFunction and its placement in the workflow configuration.

The post function incorrectly attempts to store the changes made to the issue object to the database at the end of processing. This creates a race condition when the function is being used in the Create Issue step of a workflow (the initial step), placed before the "Creates the issue originally" function (IssueCreateFunction). When this is the case, the issue object is persisted to the database for the first time by AssignToLeadFunction instead of IssueCreateFunction. This leads to some information not being persisted (workflow_id), which in turn causes the NullPointerException.

Post functions which modify issue fields are supposed to defer the responsibility of persisting changes to the "store issue to database" or "create issue originally" post functions, so that the update for all fields can occur in a single post function, resulting in fewer database calls. However, the fix for this issue is not simply to remove the "store" call from the AssignToLeadFunction, as this would change the behaviour of the post function when it occurs after the "store issue to database" post functions (i.e. it would no longer work). So, the fix is to modify the AssignToLeadFunction so that it does not prematurely persist a new issue to the database; but if the issue already exists in the database, it will call store as before.

If you are using AssignToLeadFunction in a transition, and it is placed after the "store issue to database" post function, then for correctness we recommend you modify your workflows so that the function is placed correctly before the relevant "store issue to database" post function. For more information, please read the "Adding a post function" section in the JIRA workflow transitions documentation.


Michael Tokar [Atlassian] added a comment - 15/Jun/08 07:49 PM
This problem still exists for the AssignToReporter post function. A similar fix should be made, where the post function only calls store() if the issue has already been created.

Note: post functions need to be standardised in how they deal with issue persistence, and this needs to be documented.


Michael Tokar [Atlassian] added a comment - 18/Jun/08 03:05 AM
Re-resolving this issue, and raising the issue with AssignToReporter function as a separate issue.