Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0029665Openbravo ERPA. Platformpublic2015-04-22 11:122015-05-07 22:17
umartirena 
caristu 
immediatemajoralways
closedfixed 
5
 
3.0PR15Q3 
alostale
Core
No
0029665: NPE Error raised when using HQL Based Tables on a tab (level 2) inside a standard window (not P&E)
NPE Error raised when using HQL Based Tables on a tab (level 2) inside a standard window (not P&E).

Install the following module:
 
https://code.openbravo.com/erp/mods/org.openbravo.costing.explaincostadjustments/ [^]

As F&B Group Admin:

 * Go to Product Window and select any product (i.e. "Cerveza Ale 0,5L").
 * Go to Costing Tab.
 * Check that an error has been raised in the log.

c59635e2 6336371 [http-8080-4] ERROR org.openbravo.service.datasource.DataSourceServlet -
java.lang.NullPointerException
    at org.openbravo.service.datasource.HQLDataSourceService.existsInsertionPoint(HQLDataSourceService.java:482)
    at org.openbravo.service.datasource.HQLDataSourceService.fillInInsertionPoints(HQLDataSourceService.java:374)
    at org.openbravo.service.datasource.HQLDataSourceService.getQuery(HQLDataSourceService.java:311)
    at org.openbravo.service.datasource.HQLDataSourceService.getData(HQLDataSourceService.java:165)
    at org.openbravo.service.datasource.ReadOnlyDataSourceService.fetchJSONObject(ReadOnlyDataSourceService.java:137)
    at org.openbravo.service.datasource.ReadOnlyDataSourceService.fetch(ReadOnlyDataSourceService.java:70)
    at org.openbravo.service.datasource.DataSourceServlet.doFetch(DataSourceServlet.java:261)
    at org.openbravo.service.datasource.DataSourceServlet.doPost(DataSourceServlet.java:747)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
    at org.openbravo.base.HttpBaseServlet.serviceInitialized(HttpBaseServlet.java:222)
    at org.openbravo.base.secureApp.HttpSecureAppServlet.service(HttpSecureAppServlet.java:449)
    at org.openbravo.client.kernel.BaseKernelServlet.callServiceInSuper(BaseKernelServlet.java:88)
    at org.openbravo.client.kernel.BaseKernelServlet.service(BaseKernelServlet.java:59)
    at org.openbravo.service.datasource.DataSourceServlet.service(DataSourceServlet.java:140)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.openbravo.utils.SessionExpirationFilter.doFilter(SessionExpirationFilter.java:66)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.openbravo.utils.CharsetFilter.doFilter(CharsetFilter.java:35)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.openbravo.client.kernel.KernelFilter$1.doAction(KernelFilter.java:62)
    at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:46)
    at org.openbravo.client.kernel.KernelFilter.doFilter(KernelFilter.java:71)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.openbravo.dal.core.DalRequestFilter$1.doAction(DalRequestFilter.java:81)
    at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:46)
    at org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:103)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:701)
The problem seems to be that the HQL Query is being executed even when the tab of level two is not being opened. At this point hqlquery variable that should contain the hqlquery is still null, and NPE error is obtained.

The query should not be executed till the level 2 tab is opened.
No tags attached.
related to defect 0029667 closed caristu NPE Error raised when a tab is child of another tab that as table has an HQL Query table 
related to feature request 00259963.0PR14Q3 closed AugustoMauch HQL based tables 
Issue History
2015-04-22 11:12umartirenaNew Issue
2015-04-22 11:12umartirenaAssigned To => platform
2015-04-22 11:12umartirenaModules => Core
2015-04-22 11:12umartirenaTriggers an Emergency Pack => No
2015-04-22 11:13umartirenaNote Added: 0076685
2015-04-22 12:00umartirenaNote Edited: 0076685bug_revision_view_page.php?bugnote_id=0076685#r8325
2015-04-23 08:52alostaleRelationship addedrelated to 0029667
2015-04-23 08:52alostaleAssigned Toplatform => caristu
2015-04-24 08:42alostaleRelationship addedrelated to 0025996
2015-04-24 12:53caristuNote Added: 0076750
2015-04-24 12:54caristuNote Edited: 0076750bug_revision_view_page.php?bugnote_id=0076750#r8344
2015-04-29 08:51caristuReview Assigned To => alostale
2015-04-29 08:51caristuIssue Monitored: alostale
2015-04-29 08:53hgbotCheckin
2015-04-29 08:53hgbotNote Added: 0076845
2015-04-29 08:53hgbotStatusnew => resolved
2015-04-29 08:53hgbotResolutionopen => fixed
2015-04-29 08:53hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e9d6d5b57fd1a6aadff36076f1d679dcee0975c7 [^]
2015-04-29 11:04alostaleNote Added: 0076857
2015-04-29 11:04alostaleStatusresolved => closed
2015-04-29 11:04alostaleFixed in Version => 3.0PR15Q3
2015-05-07 22:17hudsonbotCheckin
2015-05-07 22:17hudsonbotNote Added: 0077177

Notes
(0076685)
umartirena   
2015-04-22 11:13   
(edited on: 2015-04-22 12:00)
The issue is being reported as an immediate because the module mentioned in the Steps to Reproduce has to be published at the same time of PR15Q1.4.

(0076750)
caristu   
2015-04-24 12:53   
(edited on: 2015-04-24 12:54)
In the module[1], if the Costing Adjustments tab is configured to have a parent key reference column, i.e, the m_costing_id set as link to parent and the tab has the disable parent key property unchecked, the problem is not reproducible. This would be the correct configuration for the tab.

In any case, this error should be controlled in the code, in case other tabs are configured in this way.

[1] https://code.openbravo.com/erp/mods/org.openbravo.costing.explaincostadjustments/ [^]

(0076845)
hgbot   
2015-04-29 08:53   
Repository: erp/devel/pi
Changeset: e9d6d5b57fd1a6aadff36076f1d679dcee0975c7
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Apr 29 08:53:03 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/e9d6d5b57fd1a6aadff36076f1d679dcee0975c7 [^]

fixes issue 29665: NP Error raised when using HQL Based Tables on a level 2 tab

A unnecessary request was being done when accessing to the HQL query based subtab. This was caused because the tab was not being identified properly as a subtab.
The view.parentProperty was used to identify if we are on a child tab. This property could be undefined depending on the configuration of the tab in the application dictionary.
Now view.parentView is used instead of view.parentProperty because it does not return undefined in this cases

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
---
(0076857)
alostale   
2015-04-29 11:04   
code reviewed + tested
(0077177)
hudsonbot   
2015-05-07 22:17   
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/a1817f84bd8b [^]
Maturity status: Test