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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0037238
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorhave not tried2017-11-07 10:502018-01-03 12:39
ReportergorkaionView Statuspublic 
Assigned Tocaristu 
PriorityurgentResolutionfixedFixed in Version3.0PR18Q1
StatusclosedFix in branchFixed in SCM revision698a79b5ee76
ProjectionnoneETAnoneTarget Version
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

0037238: OBMessageUtils class fails generating the vars when there is no Request

DescriptionWhen a java process is executed without any request. For example a background process that implements the Process interface. The OBMessageUtils fails to generate the exeception message if it needs to load a VariablesSecureApp instance.

The problem is that it is loading the vars using:
final VariablesSecureApp vars = RequestContext.get().getVariablesSecureApp();

Which throws a OBException in case the RequestContext has no session.
Steps To ReproduceModify a background process to generate a message using "parseTranslation(String text)"

check that it fails with a exception similar to this.

ERROR org.openbravo.base.exception.OBException - No request object set
org.openbravo.base.exception.OBException: No request object set
at org.openbravo.client.kernel.RequestContext.getVariablesSecureApp(RequestContext.java:167)
at org.openbravo.erpCommon.utility.OBMessageUtils.parseTranslation(OBMessageUtils.java:201)
Proposed SolutionThe vars Object in OBMessageUtils methods is mainly used to load Session variables. The proposed solution is to initialize it only when it is needed in the translate() and translateError() methods and keep it null until then.
TagsNo tags attached.
Attached Files? file icon testIssue37238.dif [^] (3,214 bytes) 2017-11-23 14:08

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0100687)
caristu (developer)
2017-11-23 13:51
edited on: 2017-11-23 14:08

This issue can not be reproduced with background processes that extends DalBaseProcess, because they are already initializing the vars on their execute method[1]. Description has been updated.

[1] https://code.openbravo.com/erp/devel/pi/file/tip/src/org/openbravo/service/db/DalBaseProcess.java#l71 [^]

Attached a test case where the issue can be reproduced.

(0100795)
hgbot (developer)
2017-11-28 18:04

Repository: erp/devel/pi
Changeset: 698a79b5ee76f0ddcf63ccd2066d3281ae8ba5e4
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Tue Nov 28 18:01:43 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/698a79b5ee76f0ddcf63ccd2066d3281ae8ba5e4 [^]

fixes bug 37238: OBMessageUtils fails on vars retrieval if there isn't request

  Two main changes:
    1- Postponed the vars initialization until it is really needed.
    2- If the vars retrieval fails because there is no request then the exception thrown in that case is now catched and then the message is tried to be loaded from database.

---
M src/org/openbravo/erpCommon/utility/OBMessageUtils.java
---
(0100798)
hgbot (developer)
2017-11-28 19:00

Repository: erp/devel/pi
Changeset: 07a264cb64e423af67528db8523434eb8dea99a7
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Tue Nov 28 18:59:16 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/07a264cb64e423af67528db8523434eb8dea99a7 [^]

related to issue 37238: added test cases

---
M src-test/src/org/openbravo/test/scheduling/ProcessSchedulingTest.java
---
(0100883)
alostale (developer)
2017-12-01 11:03

reviewed + tested
(0101494)
hudsonbot (developer)
2018-01-03 12:39

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/c81e0d3cbab5 [^]
Maturity status: Test
(0101495)
hudsonbot (developer)
2018-01-03 12:39

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/c81e0d3cbab5 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2017-11-07 10:50 gorkaion New Issue
2017-11-07 10:50 gorkaion Assigned To => platform
2017-11-07 10:50 gorkaion Modules => Core
2017-11-07 10:50 gorkaion Triggers an Emergency Pack => No
2017-11-23 13:47 caristu Description Updated View Revisions
2017-11-23 13:51 caristu Note Added: 0100687
2017-11-23 14:08 caristu File Added: testIssue37238.dif
2017-11-23 14:08 caristu Note Edited: 0100687 View Revisions
2017-11-23 14:08 caristu Status new => acknowledged
2017-11-28 18:04 hgbot Checkin
2017-11-28 18:04 hgbot Note Added: 0100795
2017-11-28 18:04 hgbot Status acknowledged => resolved
2017-11-28 18:04 hgbot Resolution open => fixed
2017-11-28 18:04 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/698a79b5ee76f0ddcf63ccd2066d3281ae8ba5e4 [^]
2017-11-28 18:05 caristu Assigned To platform => caristu
2017-11-28 19:00 hgbot Checkin
2017-11-28 19:00 hgbot Note Added: 0100798
2017-12-01 11:03 alostale Review Assigned To => alostale
2017-12-01 11:03 alostale Note Added: 0100883
2017-12-01 11:03 alostale Status resolved => closed
2017-12-01 11:03 alostale Fixed in Version => 3.0PR18Q1
2018-01-03 12:39 hudsonbot Checkin
2018-01-03 12:39 hudsonbot Note Added: 0101494
2018-01-03 12:39 hudsonbot Checkin
2018-01-03 12:39 hudsonbot Note Added: 0101495


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker