Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033909
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajoralways2016-09-06 12:212016-09-26 09:31
ReportergorkaionView Statuspublic 
Assigned Togorkaion 
PrioritynormalResolutionfixedFixed in Version3.0PR16Q4
StatusclosedFix in branchFixed in SCM revisione46e66b4f219
ProjectionnoneETAnoneTarget Versionpi
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toalostale
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033909: NPE exception if a commitAndClose() is executed in a onTransactionComplete handler

DescriptionConsider a EventHandler that fires on the TransactionCompleted event and that performs a commitAndClose() in its code.

If the event handler is fired by another commitAndClose() a NPE is thrown on the second commitAndClose execution.

This is happens as both executions are on the same SessionHandler instance. The first one does "setSession(null)" so when the second one executes the "closeSession()" a NPE is thrown because the "session" object is null.
Steps To ReproduceUpdate pi to cd08dd7274e3 revision.

1 Go to product characteristics window.
2 Create a new characteristic and a new value.
3 On the new value click on AddProducts and select a couple of products.
4 Press done and the process fails with a NPE.

The reason of the NPE is:

1 DalThreadHandler executes the commitAndClose() when the add product process finishes.
2 this fires the ProductCharacteristicValueEventHandler which executes "importEntryManager.createImportEntry()"
3. the createImportEntry does another commitAndClose() on the same SessionHandler instance whichs sets to null the session
4. the first commitAndClose() continues the execution and when doint the closeSession() the session is already null and fails.
Proposed SolutionAdd a null check in the SessionHandler.closeSession() method:

  protected void closeSession() {
    if (session != null && session.isOpen()) {
      session.close();
    }
  }
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0089797)
hgbot (developer)
2016-09-07 09:52

Repository: erp/devel/pi
Changeset: e46e66b4f2191ff0a1ca2e4c4ac1818dc2353532
Author: Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
Date: Tue Sep 06 12:25:45 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/e46e66b4f2191ff0a1ca2e4c4ac1818dc2353532 [^]

Fixes issue 33909. Add null check on closeSession

On some very specific scenarios it is possible to execute 2 commitAndClose or
rollbacks on the same SessionHandler instance. As both methods calls the
setSession(null) and closeSession() methods a NPE is thrown on the second
execution.

---
M src/org/openbravo/dal/core/SessionHandler.java
---
(0089813)
hudsonbot (developer)
2016-09-07 19:58

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/97008b02fc55 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2016-09-06 12:21 gorkaion New Issue
2016-09-06 12:21 gorkaion Assigned To => gorkaion
2016-09-06 12:21 gorkaion Modules => Core
2016-09-06 12:21 gorkaion Triggers an Emergency Pack => No
2016-09-07 09:52 hgbot Checkin
2016-09-07 09:52 hgbot Note Added: 0089797
2016-09-07 09:52 hgbot Status new => resolved
2016-09-07 09:52 hgbot Resolution open => fixed
2016-09-07 09:52 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e46e66b4f2191ff0a1ca2e4c4ac1818dc2353532 [^]
2016-09-07 19:58 hudsonbot Checkin
2016-09-07 19:58 hudsonbot Note Added: 0089813
2016-09-15 09:37 gorkaion Review Assigned To => alostale
2016-09-26 09:31 alostale Status resolved => closed
2016-09-26 09:31 alostale Fixed in Version => 3.0PR16Q4


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker