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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033515
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminoralways2016-07-20 16:442016-07-26 09:29
ReporterSanjotaView Statuspublic 
Assigned Toalostale 
PriorityhighResolutionfixedFixed in Version3.0PR16Q4
StatusclosedFix in branchFixed in SCM revisionb7bce66ab192
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033515: NPE in AdvancedQueryBuilder with joinAssociatedEntities if entity has computed columns

DescriptionAdvancedQueryBuilder has a joinAssociatedEntities which creates the query including joins for all many-to-one properties. If the entity being queried includes computed columns, a NPE is thrown.

Note this does not affect standard behavior, as the default value for joinAssociatedEntities is always null when invoked from UI.
Steps To ReproduceWhenever we use advanced query builder for retrieving records from the table,
if the table has computed column(as property) then property.getTargetEntity() is null and
KernelUtils.hasNullableIdentifierProperties(property.getTargetEntity()) will through null pointer exception.

Example Scenario : Following are steps for one of the scenario faced
1) Install module org.openbravo.authorize.net to pi environment.
2) Test IssuesTest.java i.e Run as Junit.
3) Test - test20733() present in IssuesTest.java fails
Giving details of the stack trace for Null pointer exception as
 java.lang.NullPointerException
    at org.openbravo.client.kernel.KernelUtils.hasNullableIdentifierProperties(KernelUtils.java:520)
    at org.openbravo.service.json.AdvancedQueryBuilder$JoinDefinition.getJoinStatement(AdvancedQueryBuilder.java:1838)
    at org.openbravo.service.json.AdvancedQueryBuilder.getJoinClause(AdvancedQueryBuilder.java:1349)
    at org.openbravo.service.json.DataEntityQueryService.getWhereClause(DataEntityQueryService.java:120)
    at org.openbravo.service.json.DataEntityQueryService.buildOBQuery(DataEntityQueryService.java:127)
    at org.openbravo.service.json.DataEntityQueryService.list(DataEntityQueryService.java:106)
    at org.openbravo.test.dal.IssuesTest.test20733(IssuesTest.java:818)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
TagsNo tags attached.
Attached Filesdiff file icon 33515.diff [^] (1,463 bytes) 2016-07-20 16:52 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0088607)
hgbot (developer)
2016-07-21 09:13

Repository: erp/devel/pi
Changeset: b7bce66ab19202bc3cad0ca6070c6d5d21c6fed8
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Jul 21 09:12:30 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/b7bce66ab19202bc3cad0ca6070c6d5d21c6fed8 [^]

fixed 33515: NPE in AQB with associated entities if entity has computed columns

  When AdvancedQueryBuilder was used with the joinAssociatedEntities property set
  to true and the queried entity included computed columns, a NPE was trhown.

  Fixed by treating computed column property as an special case forcing always
  a left join for it.

---
M modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
---
(0088657)
caristu (developer)
2016-07-26 09:29

Code review + testing OK.

Tested using steps to reproduce in pi@c1dff2b0991a

- Issue History
Date Modified Username Field Change
2016-07-20 16:44 Sanjota New Issue
2016-07-20 16:44 Sanjota Assigned To => platform
2016-07-20 16:44 Sanjota Modules => Core
2016-07-20 16:44 Sanjota Triggers an Emergency Pack => No
2016-07-20 16:45 Sanjota Severity major => minor
2016-07-20 16:52 aferraz File Added: 33515.diff
2016-07-21 09:08 alostale Summary Nullpointer exception in KernelUtils.hasNullableIdentifierProperties() present in KernelUtils.java => NPE in AdvancedQueryBuilder with joinAssociatedEntities if entity has computed columns
2016-07-21 09:08 alostale Description Updated View Revisions
2016-07-21 09:12 alostale Review Assigned To => caristu
2016-07-21 09:12 alostale Assigned To platform => alostale
2016-07-21 09:13 hgbot Checkin
2016-07-21 09:13 hgbot Note Added: 0088607
2016-07-21 09:13 hgbot Status new => resolved
2016-07-21 09:13 hgbot Resolution open => fixed
2016-07-21 09:13 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/b7bce66ab19202bc3cad0ca6070c6d5d21c6fed8 [^]
2016-07-26 09:29 caristu Note Added: 0088657
2016-07-26 09:29 caristu Status resolved => closed
2016-07-26 09:29 caristu Fixed in Version => 3.0PR16Q4


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker