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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0022235
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajoralways2012-11-08 11:192013-01-03 13:12
ReportercaristuView Statuspublic 
Assigned Tomtaal 
PriorityurgentResolutionfixedFixed in Version3.0MP19
StatusclosedFix in branchFixed in SCM revisionf2eb38f962af
ProjectionnoneETAnoneTarget Version3.0MP19
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned ToAugustoMauch
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0022235: OBMessageUtils asumes incorrectly that RequestContext is set

DescriptionIf you extend a class from DalProcess and you call call RequestContext.get().getVariablesSecureApp(); it returns null.

So for example, if you use any of the public methods of OBMessageUtils() that uses the previous statement, the process crashes because we are obtaining a null reference. For example, the translateError() method is using this practise:

public static OBError translateError(String message) {
  VariablesSecureApp vars = RequestContext.get().getVariablesSecureApp();
  final String strLanguage = OBContext.getOBContext().getLanguage().getLanguage();
return translateError(new DalConnectionProvider(false), vars, strLanguage, message);
}

So, we can't use this approach, instead we must use the ProcessBudle class to obtain the vars variable: bundle.getContext().toVars();
Steps To Reproduce- Create a new process extending DalBaseProcess class
- Try to use any of the methods of OBMessageUtils() that uses RequestContext(), for example the translateError() method
Proposed SolutionThe current implementation of OBMessageUtils incorrectly uses the RequestContext, assuming that it is always set. Proposed Solutions:

- deprecate this OBMessageUtils method or remove it (api change)
- add an abstraction for RequestContext that only provides the things common to process threads and http request threads (like VariablesSecureApp) and then use this ThreadContext object in all the places in core where RequestContext is being used.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 00248323.0MP29 closedshankarb EntityPersistenceEventObserver: cascade errors from ProcessBundle are not displayed 

-  Notes
(0055229)
mtaal (manager)
2012-12-27 08:23

For now I decided to re-use the RequestContext class. It is a fine class for this purpose and RequestContext and ThreadContext are very similar concepts.

This also means the least changes in the code.
(0055230)
hgbot (developer)
2012-12-27 08:26

Repository: erp/devel/pi
Changeset: f2eb38f962af844d217dd50974a355521094841c
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Dec 27 08:24:46 2012 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/f2eb38f962af844d217dd50974a355521094841c [^]

Fixes issue 22235: OBMessageUtils asumes incorrectly that RequestContext is set
Set variables secure app in RequestContext in case of running a process

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/RequestContext.java
M src-test/org/openbravo/test/dal/IssuesTest.java
M src/org/openbravo/service/db/DalBaseProcess.java
---
(0055231)
hgbot (developer)
2012-12-27 08:27

Repository: erp/devel/pi
Changeset: 4fd1d28743f189e4d94949af1a02e68d72d82d30
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Dec 27 08:27:09 2012 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/4fd1d28743f189e4d94949af1a02e68d72d82d30 [^]

Related to issue 22235: OBMessageUtils asumes incorrectly that RequestContext is set

---
M src-test/org/openbravo/test/dal/IssuesTest.java
---
(0055303)
AugustoMauch (manager)
2013-01-02 11:05

Code reviewed and verified in pi@6735d51a4790
(0055325)
hudsonbot (developer)
2013-01-03 13:12

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/792728467ed0 [^]

Maturity status: Test
(0055326)
hudsonbot (developer)
2013-01-03 13:12

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/792728467ed0 [^]

Maturity status: Test

- Issue History
Date Modified Username Field Change
2012-11-08 11:19 caristu New Issue
2012-11-08 11:19 caristu Assigned To => AugustoMauch
2012-11-08 11:19 caristu Modules => Core
2012-11-08 11:19 caristu Resolution time => 1355094000
2012-11-19 17:09 AugustoMauch Assigned To AugustoMauch => shankarb
2012-11-21 11:31 shankarb Assigned To shankarb => AugustoMauch
2012-12-04 12:39 AugustoMauch Target Version 3.0MP18 => 3.0MP19
2012-12-10 14:28 mtaal Assigned To AugustoMauch => mtaal
2012-12-27 08:23 mtaal Review Assigned To => AugustoMauch
2012-12-27 08:23 mtaal Triggers an Emergency Pack => No
2012-12-27 08:23 mtaal Note Added: 0055229
2012-12-27 08:26 hgbot Checkin
2012-12-27 08:26 hgbot Note Added: 0055230
2012-12-27 08:26 hgbot Status new => resolved
2012-12-27 08:26 hgbot Resolution open => fixed
2012-12-27 08:26 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/f2eb38f962af844d217dd50974a355521094841c [^]
2012-12-27 08:27 hgbot Checkin
2012-12-27 08:27 hgbot Note Added: 0055231
2013-01-02 11:05 AugustoMauch Note Added: 0055303
2013-01-02 11:05 AugustoMauch Status resolved => closed
2013-01-02 11:05 AugustoMauch Fixed in Version => 3.0MP19
2013-01-03 13:12 hudsonbot Checkin
2013-01-03 13:12 hudsonbot Note Added: 0055325
2013-01-03 13:12 hudsonbot Checkin
2013-01-03 13:12 hudsonbot Note Added: 0055326
2013-09-25 17:51 vmromanos Relationship added related to 0024832


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker